Details
-
Enhancement
-
Status: Resolved
-
P4
-
Resolution: Fixed
-
11, 17
-
b10
-
generic
-
generic
Description
This is a request to clean up a desktop module as was done in JDK-8233884 for "java.base" module.
In many places standard charsets are looked up via their names, for example:
absolutePath.getBytes("UTF-8");
This could be done more efficiently 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.
In many places standard charsets are looked up via their names, for example:
absolutePath.getBytes("UTF-8");
This could be done more efficiently 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.