On Mon, 1 Aug 2022 17:32:28 GMT, Roger Riggs <[email protected]> wrote:
> The existing code downstream of the check handles an empty glob or regex
> pattern as matching the empty string. If I read it correctly, it will now
> throw an exception instead of not matching. It might be safer to not change
> that behavior.
Indeed for this code
FileSystem fs = ...;
PathMatcher pm = fs.getPathMatcher("glob:");
System.out.println(pm.matches(Path.of("")));
without the proposed change `true` is printed but with the change an
`IllegalArgumentException` is thrown so it would be safer to change
if (pos <= 0 || pos == syntaxAndInput.length())
to
if (pos <= 0)
as originally suggested.
-------------
PR: https://git.openjdk.org/jdk/pull/9595