You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/09/04 12:00:23 UTC

[commons-io] 03/06: Don't create extra strings.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git

commit a4b281be07c1830a161eec70b640771f32b0cca6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Sep 3 17:52:08 2021 -0400

    Don't create extra strings.
---
 src/main/java/org/apache/commons/io/FilenameUtils.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/FilenameUtils.java b/src/main/java/org/apache/commons/io/FilenameUtils.java
index fd7cd64..325dd00 100644
--- a/src/main/java/org/apache/commons/io/FilenameUtils.java
+++ b/src/main/java/org/apache/commons/io/FilenameUtils.java
@@ -772,7 +772,7 @@ public class FilenameUtils {
             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 class FilenameUtils {
      */
     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");
         }
     }
     /**
@@ -1491,7 +1491,7 @@ public class FilenameUtils {
     }
     /**
      * Returns '/' if given true, '\\' otherwise.
-     * 
+     *
      * @param unixSeparator which separator to return.
      * @return '/' if given true, '\\' otherwise.
      */