RFR: 8272120: Avoid looking for standard encodings in "java." modules

Sergey Bylokhov serb at openjdk.java.net
Tue Aug 10 05:20:42 UTC 2021


This is the continuation of JDK-8233884 and JDK-8271456. This change affects fewer cases so I fix all "java." modules at once.

In many places standard charsets are looked up via their names, for example:
absolutePath.getBytes("UTF-8");

This could be done more efficiently(up to x20 time faster) with use of java.nio.charset.StandardCharsets:
absolutePath.getBytes(StandardCharsets.UTF_8);

The later variant also makes the code cleaner, as it is known not to throw UnsupportedEncodingException in contrary to the former variant.

tested by the tier1/tier2/tier3 tests on Linux/Windows/macOS.

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

Commit messages:
 - Initial fix of JDK-8272120

Changes: https://git.openjdk.java.net/jdk/pull/5063/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5063&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8272120
  Stats: 127 lines in 15 files changed: 24 ins; 53 del; 50 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5063.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5063/head:pull/5063

PR: https://git.openjdk.java.net/jdk/pull/5063



More information about the security-dev mailing list