RFR: 8290047: (fs) FileSystem.getPathMatcher needlessly checks syntaxAndInput.length [v2]
Brian Burkhalter
bpb at openjdk.org
Thu Jul 21 18:31:24 UTC 2022
On Thu, 21 Jul 2022 17:13:58 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java line 178:
>>
>>> 176: public PathMatcher getPathMatcher(String syntaxAndInput) {
>>> 177: int pos = syntaxAndInput.indexOf(':');
>>> 178: if (pos <= 0 || pos == syntaxAndInput.length()) {
>>
>> Is this really a different bug? Should it be checking for `length() - 1` to throw IAE.
>> That would then throw if there was no string after the syntax selector; for example "glob:"
>
> You have a point there. It does not want the ":" to be at the first position so it should not want it at the last position as the "pattern" part of the string would be empty. That fits with the specification
>
> IllegalArgumentException.html - If the parameter does not take the form: syntax:pattern
Corrected in 5765fa1c6883575da57499c7b70f6626443d869d.
-------------
PR: https://git.openjdk.org/jdk/pull/9595
More information about the core-libs-dev
mailing list