diff --git a/src/java.base/share/classes/java/nio/charset/Charset.java b/src/java.base/share/classes/java/nio/charset/Charset.java index 82d0a72d5a082..35c7e5b1cd5bd 100644 --- a/src/java.base/share/classes/java/nio/charset/Charset.java +++ b/src/java.base/share/classes/java/nio/charset/Charset.java @@ -705,12 +705,12 @@ public static Charset defaultCharset() { * If the canonical name or any of the aliases are illegal */ protected Charset(String canonicalName, String[] aliases) { - String[] as = aliases == null ? + String[] as = + aliases == null ? zeroAliases : - (this.getClass().getClassLoader() == null || - this.getClass().getClassLoader() == ClassLoader.getPlatformClassLoader()) ? - aliases : - Arrays.copyOf(aliases, aliases.length); + VM.isSystemDomainLoader(getClass().getClassLoader()) ? + aliases : + Arrays.copyOf(aliases, aliases.length); // Skip checks for the standard, built-in Charsets we always load // during initialization.