IO-475: Fix UNC path prefix validation in FilenameUtils#825
IO-475: Fix UNC path prefix validation in FilenameUtils#825MiriamCohenDev wants to merge 5 commits intoapache:masterfrom
Conversation
garydgregory
left a comment
There was a problem hiding this comment.
Hello @MiriamCohenDev
Thank you for your PR. Please see my comments. Run mvn by itself before you push and fix any issues that come up.
|
Jira ticket is https://issues.apache.org/jira/browse/IO-475 |
51f04e9 to
090b9f9
Compare
090b9f9 to
64038e1
Compare
garydgregory
left a comment
There was a problem hiding this comment.
Hello @MiriamCohenDev
Thank you for your updates. You missed a few spots. It's simpler to review a PR if you don't delete assertions. Instead, change them to reflect the new behavior.
garydgregory
left a comment
There was a problem hiding this comment.
See my previous comments, and run mvn without anything else and fix:
[INFO] --- checkstyle:3.6.0:check (default-cli) @ commons-io ---
[INFO] There are 16 errors reported by Checkstyle 13.0.0 with /Users/garygregory/git/commons/commons-io/src/conf/checkstyle.xml ruleset.
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[940,13] (coding) FinalLocalVariable: Variable 'pos' should be declared final.
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[941,16] (coding) FinalLocalVariable: Variable 'hostnamePart' should be declared final.
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[942,9] (whitespace) WhitespaceAfter: 'if' is not followed by whitespace.
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[942,9] (whitespace) WhitespaceAround: 'if' is not followed by whitespace.
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[942,56] (whitespace) WhitespaceAround: '{' is not preceded with whitespace.
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[945,9] (blocks) RightCurly: '}' at column 9 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally).
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[946,9] (whitespace) WhitespaceAfter: 'else' is not followed by whitespace.
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[946,9] (whitespace) WhitespaceAround: 'else' is not followed by whitespace.
[ERROR] src/main/java/org/apache/commons/io/FilenameUtils.java:[946,13] (whitespace) WhitespaceAround: '{' is not preceded with whitespace.
[ERROR] src/test/java/org/apache/commons/io/FilenameUtilsTest.java:[410,24] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
[ERROR] src/test/java/org/apache/commons/io/FilenameUtilsTest.java:[457,24] (whitespace) WhitespaceAfter: ',' is not followed by whitespace.
[ERROR] src/test/java/org/apache/commons/io/FilenameUtilsTest.java:[561,54] (whitespace) ParenPad: '(' is followed by whitespace.
[ERROR] src/test/java/org/apache/commons/io/FilenameUtilsTest.java:[780,21] (whitespace) ParenPad: '(' is followed by whitespace.
[ERROR] src/test/java/org/apache/commons/io/FilenameUtilsTest.java:[919,21] (whitespace) ParenPad: '(' is followed by whitespace.
[ERROR] src/test/java/org/apache/commons/io/FilenameUtilsTest.java:[992,21] (whitespace) ParenPad: '(' is followed by whitespace.
[ERROR] src/test/java/org/apache/commons/io/FilenameUtilsTest.java:[1132,21] (whitespace) ParenPad: '(' is followed by whitespace.
b6454e2 to
860bc20
Compare
|
Is that good now? |
|
The build is green and I'll check the patch later today or tomorrow. |
|
Jira ticket is https://issues.apache.org/jira/browse/IO-475 |
|
Hello @MiriamCohenDev It looks to me that there are still bugs. The PR should include Javadoc updates with new or fixed examples. The A UNC name is:
For example: Such that the prefix should be IMO A shared folder can be a remote drive so it would make sense to skip the share name just like we skip a drive letter. This would mean that our current Javadoc for I think we might have to leave the Extended ( All of this needs careful consideration! |
|
I would be happy to better understand what you meant. |
Fixes a bug in FilenameUtils#normalizeNoEndSeparator when handling UNC paths that do not end with a slash.
What:
How:
Why:
Testing:
Files changed:
src/main/java/org/apache/commons/io/FilenameUtils.javasrc/test/java/org/apache/commons/io/FilenameUtilsTest.java