Don't create extra strings.
MODIFY
src/main/java/org/apache/commons/io/FilenameUtils.java
src/main/java/org/apache/commons/io/FilenameUtils.java
@@ -772,7 +772,7 @@ public static String getPrefix(final String fileName) {
return null;
}
if (len > fileName.length()) {
- requireNonNullChars(fileName + UNIX_NAME_SEPARATOR);
+ requireNonNullChars(fileName);
return fileName + UNIX_NAME_SEPARATOR;
}
final String path = fileName.substring(0, len);
@@ -1405,8 +1405,8 @@ public static String removeExtension(final String fileName) {
*/
private static void requireNonNullChars(final String path) {
if (path.indexOf(0) >= 0) {
- throw new IllegalArgumentException("Null byte present in file/path name. There are no "
- + "known legitimate use cases for such data, but several injection attacks may use it");
+ throw new IllegalArgumentException(
+ "Null byte present in file/path name. There are no known legitimate use cases for such data, but several injection attacks may use it");
}
}
/**

Don't create extra strings.