8234147: Avoid looking up standard charsets in core libraries

Reviewed-by: alanb
This commit is contained in:
Ivan Gerasimov 2019-12-01 15:29:37 -08:00
parent 4e64af81a2
commit cd589d8469
36 changed files with 200 additions and 237 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,9 @@
package sun.util;
import sun.nio.cs.ISO_8859_1;
import sun.nio.cs.UTF_8;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
@ -70,7 +73,7 @@ public class PropertyResourceBundleCharset extends Charset {
private final class PropertiesFileDecoder extends CharsetDecoder {
private CharsetDecoder cdUTF_8 = StandardCharsets.UTF_8.newDecoder()
private CharsetDecoder cdUTF_8 = UTF_8.INSTANCE.newDecoder()
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
private CharsetDecoder cdISO_8859_1 = null;
@ -98,7 +101,7 @@ public class PropertyResourceBundleCharset extends Charset {
assert cr.isMalformed() || cr.isUnmappable();
in.reset();
out.reset();
cdISO_8859_1 = StandardCharsets.ISO_8859_1.newDecoder();
cdISO_8859_1 = ISO_8859_1.INSTANCE.newDecoder();
return cdISO_8859_1.decode(in, out, false);
}
}