Skip to content

Commit d7f1943

Browse files
committed
[IO-886] Fixed incorrect regular expression in
PathUtils.RelativeSortedPaths.extractKey(String, String). #828 Javadoc
1 parent 3cc801f commit d7f1943

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/changes/changes.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ The <action> type attribute can be add,update,fix,remove.
5959
<action type="fix" dev="ggregory" due-to="Gary Gregory">ThrottledInputStream.throttle() doesn't preserve the original InterruptedException as the cause of its InterruptedIOException.</action>
6060
<action type="fix" dev="ggregory" due-to="Gary Gregory">All thread names are now prefixed with "commons-io-".</action>
6161
<action type="fix" dev="ggregory" due-to="Kishor, Mashrur Mia" issue="IO-639">ReversedLinesFileReader does not read first line if its empty #829.</action>
62+
<action type="fix" dev="ggregory" due-to="Peter De Maeyer" issue="IO-886">Fixed incorrect regular expression in PathUtils.RelativeSortedPaths.extractKey(String, String).</action>
63+
6264
<!-- ADD -->
6365
<action type="add" dev="ggregory" due-to="Gary Gregory, Piotr P. Karwasz">Add and use IOUtils.closeQuietlySuppress(Closeable, Throwable) #818.</action>
6466
<!-- UPDATE -->

src/main/java/org/apache/commons/io/file/PathUtils.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,14 @@ private static boolean equalsIgnoreFileSystem(final Path path1, final Path path2
137137
return extractKey(separator1, string1).equals(extractKey(separator2, string2));
138138
}
139139

140+
/**
141+
* Replaces the file separator in a path string with a string that is not legal in a path on Windows, Linux, and macOS.
142+
*
143+
* @param separator the file separator.
144+
* @param string a path.
145+
* @return a key.
146+
*/
140147
static String extractKey(final String separator, final String string) {
141-
// Replace the file separator in a path string with a string that is not legal in a path on Windows, Linux, and macOS.
142148
return string.replace(separator, ">");
143149
}
144150

0 commit comments

Comments
 (0)