RFR: 8358319: Pem.decode should cache the Pattern

Aleksey Shipilev shade at openjdk.org
Mon Jun 2 11:15:28 UTC 2025


SonarCloud complains we are using the String.replaceAll() method that creates Pattern internally every time. This looks a minor inefficiency in preview feature, but we can fix it from the day 1. Also fixed the variable name style in adjacent cached Pattern.

Additional testing:
 - [x] Linux x86_64 server fastdebug, `jdk_security`

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

Commit messages:
 - Fix

Changes: https://git.openjdk.org/jdk/pull/25583/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25583&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8358319
  Stats: 9 lines in 1 file changed: 4 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/25583.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25583/head:pull/25583

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


More information about the security-dev mailing list