eolivelli commented on a change in pull request #3: [MWAR-371] Overlays break 
first-win rule for web resource with target path ending with '/'
URL: https://github.com/apache/maven-war-plugin/pull/3#discussion_r244169699
 
 

 ##########
 File path: src/main/java/org/apache/maven/plugins/war/util/PathSet.java
 ##########
 @@ -42,25 +41,50 @@
 public class PathSet
     implements Iterable<String>
 {
-
+    private static final String SEPARATOR = "/";
+    private static final char SEPARATOR_CHAR = SEPARATOR.charAt(0);
     /**
      * Set of normalized paths
      */
-    private Set<String> pathsSet = new LinkedHashSet<String>();
+    private Set<String> pathsSet = new LinkedHashSet<>();
 
-    /**
-     * The method normalizes the path.
-     * <ul>
-     * <li>changes directory separator to unix's separator(/)</li>
-     * <li>deletes all trailing slashes</li>
-     * </ul>
-     *
-     * @param path to normalization
-     * @return normalized path
-     */
-    protected String normalizeFilePath( String path )
+    static String normalizeSubPath( String path )
     {
-        return normalizeFilePathStatic( path );
+        if ( path.isEmpty() )
+        {
+            return path;
+        }
+        /*String cleanPath = path.replaceAll( "[\\\\]+", SEPARATOR )
+                .replaceAll( "[/]+" , SEPARATOR );*/
+
+        String cleanPath = path.replace( File.separatorChar, SEPARATOR_CHAR );
+        /*
+        This results in the following test errors:
 
 Review comment:
   Okay. it is clear.
   
   Let's leave 
   ```
   String cleanPath = path.replaceAll( "[\\\\]+", SEPARATOR )
                   .replaceAll( "[/]+" , SEPARATOR );
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to