This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push: new bcc9f75 Better name to reflect that we are populating the map based on the JRE's StandardCharsets. bcc9f75 is described below commit bcc9f755ae8f2ec4552708f0b1f893e515720fe7 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Thu Jun 11 08:43:35 2020 -0400 Better name to reflect that we are populating the map based on the JRE's StandardCharsets. --- src/main/java/org/apache/commons/io/Charsets.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/apache/commons/io/Charsets.java b/src/main/java/org/apache/commons/io/Charsets.java index 5ca62ba..56b572b 100644 --- a/src/main/java/org/apache/commons/io/Charsets.java +++ b/src/main/java/org/apache/commons/io/Charsets.java @@ -51,25 +51,25 @@ import java.util.TreeMap; * * @see <a href="https://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Standard charsets</a> * @since 2.3 - * */ public class Charsets { + // // This class should only contain Charset instances for required encodings. This guarantees that it will load // correctly and without delay on all Java platforms. // - private static final SortedMap<String, Charset> REQUIRED_CHARSETS; + private static final SortedMap<String, Charset> STANDARD_CHARSET_MAP; static { - SortedMap<String, Charset> requiredCharsets = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); - requiredCharsets.put(StandardCharsets.ISO_8859_1.name(), StandardCharsets.ISO_8859_1); - requiredCharsets.put(StandardCharsets.US_ASCII.name(), StandardCharsets.US_ASCII); - requiredCharsets.put(StandardCharsets.UTF_16.name(), StandardCharsets.UTF_16); - requiredCharsets.put(StandardCharsets.UTF_16BE.name(), StandardCharsets.UTF_16BE); - requiredCharsets.put(StandardCharsets.UTF_16LE.name(), StandardCharsets.UTF_16LE); - requiredCharsets.put(StandardCharsets.UTF_8.name(), StandardCharsets.UTF_8); - REQUIRED_CHARSETS = Collections.unmodifiableSortedMap(requiredCharsets); + SortedMap<String, Charset> standardCharsetMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); + standardCharsetMap.put(StandardCharsets.ISO_8859_1.name(), StandardCharsets.ISO_8859_1); + standardCharsetMap.put(StandardCharsets.US_ASCII.name(), StandardCharsets.US_ASCII); + standardCharsetMap.put(StandardCharsets.UTF_16.name(), StandardCharsets.UTF_16); + standardCharsetMap.put(StandardCharsets.UTF_16BE.name(), StandardCharsets.UTF_16BE); + standardCharsetMap.put(StandardCharsets.UTF_16LE.name(), StandardCharsets.UTF_16LE); + standardCharsetMap.put(StandardCharsets.UTF_8.name(), StandardCharsets.UTF_8); + STANDARD_CHARSET_MAP = Collections.unmodifiableSortedMap(standardCharsetMap); } /** @@ -85,7 +85,7 @@ public class Charsets { * @since 2.5 */ public static SortedMap<String, Charset> requiredCharsets() { - return REQUIRED_CHARSETS; + return STANDARD_CHARSET_MAP; } /**