RFR: 8290047: (fs) FileSystem.getPathMatcher needlessly checks syntaxAndInput.length [v2]

Brian Burkhalter bpb at openjdk.org
Thu Jul 21 18:29:03 UTC 2022


> 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: Ensure that colon is not at the last index

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9595/files
  - new: https://git.openjdk.org/jdk/pull/9595/files/291ef674..5765fa1c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9595&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9595&range=00-01

  Stats: 55 lines in 8 files changed: 43 ins; 0 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/9595.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9595/head:pull/9595

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


More information about the core-libs-dev mailing list