RFR: 8290047: (fs) FileSystem.getPathMatcher does not check for ":" at last index [v4]

Alan Bateman alanb at openjdk.org
Tue Aug 2 16:47:13 UTC 2022


On Tue, 2 Aug 2022 16:18:16 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> For a `String` “s”, `s.indexOf(int)` can never return a value `>= s.length()` so change the check
>> 
>>         int pos = syntaxAndInput.indexOf(':');
>>         if (pos <= 0 || pos == syntaxAndInput.length())
>> 
>> to
>> 
>>         if (pos <= 0)
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8290047: Remove check for ':' at last position

src/java.base/share/classes/java/nio/file/FileSystem.java line 307:

> 305:      * <i>syntax</i><b>:</b><i>pattern</i>
> 306:      * </pre></blockquote>
> 307:      * where <i>syntax</i> must not be empty and {@code ':'} stands for itself.

We could flesh this out a bit more with something like:

"where <i>syntax</i> is the non-empty name of the syntax,  <i>pattern</i> is a possibly-empty pattern string, and {@code ':'} stands for itself."

-------------

PR: https://git.openjdk.org/jdk/pull/9595


More information about the core-libs-dev mailing list