StringUtils.chompLast(@NonNull String str, @NonNull String sep) (line 853) computes str.substring(str.length() - sep.length()) at line 857. If sep is longer than str, the start index is negative, causing StringIndexOutOfBoundsException.
For example: chompLast("x", "ab") throws.
Fix: add a guard returning str when sep.length() > str.length().
StringUtils.chompLast(@NonNull String str, @NonNull String sep)(line 853) computesstr.substring(str.length() - sep.length())at line 857. Ifsepis longer thanstr, the start index is negative, causingStringIndexOutOfBoundsException.For example:
chompLast("x", "ab")throws.Fix: add a guard returning
strwhensep.length() > str.length().