mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8319817: Charset constructor should make defensive copy of aliases
Reviewed-by: rriggs, alanb, bpb, iris, jpai
This commit is contained in:
parent
0712b22a3a
commit
d6d7bdc774
2 changed files with 75 additions and 2 deletions
|
@ -42,7 +42,6 @@ import java.util.Iterator;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.ServiceConfigurationError;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Set;
|
||||
|
@ -706,7 +705,12 @@ public abstract class Charset
|
|||
* If the canonical name or any of the aliases are illegal
|
||||
*/
|
||||
protected Charset(String canonicalName, String[] aliases) {
|
||||
String[] as = Objects.requireNonNullElse(aliases, zeroAliases);
|
||||
String[] as =
|
||||
aliases == null ?
|
||||
zeroAliases :
|
||||
VM.isSystemDomainLoader(getClass().getClassLoader()) ?
|
||||
aliases :
|
||||
Arrays.copyOf(aliases, aliases.length);
|
||||
|
||||
// Skip checks for the standard, built-in Charsets we always load
|
||||
// during initialization.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue