diff --git a/src/main/java/sirius/kernel/commons/Strings.java b/src/main/java/sirius/kernel/commons/Strings.java index ed651c1f..8f752bd4 100644 --- a/src/main/java/sirius/kernel/commons/Strings.java +++ b/src/main/java/sirius/kernel/commons/Strings.java @@ -463,9 +463,9 @@ private static String limit(@Nullable Object input, charactersToPreserveAtTheEnd = 0; } - String str = String.valueOf(input).trim(); - if (str.length() <= length + charactersToPreserveAtTheEnd) { - return str; + String trimmedInputString = String.valueOf(input).trim(); + if (trimmedInputString.length() <= length + charactersToPreserveAtTheEnd) { + return trimmedInputString; } String middle = generateTruncatedSignal(showEllipsis, showTruncated, charactersToPreserveAtTheEnd > 0); @@ -474,8 +474,8 @@ private static String limit(@Nullable Object input, effectiveLength = length; } - String start = str.substring(0, effectiveLength).trim(); - String end = str.substring(str.length() - charactersToPreserveAtTheEnd).trim(); + String start = trimmedInputString.substring(0, effectiveLength).trim(); + String end = trimmedInputString.substring(trimmedInputString.length() - charactersToPreserveAtTheEnd).trim(); return start + middle + end; }