< prev index next >

src/java.base/share/classes/sun/util/PropertyResourceBundleCharset.java

Print this page
rev 49550 : 8201179: Regression due loading java.nio.charset.StandardCharsets during bootstrap
Reviewed-by: sherman

*** 30,42 **** import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; - import java.nio.charset.StandardCharsets; import java.util.Objects; /** * A Charset implementation for reading PropertyResourceBundle, in order * for loading properties files. This first tries to load the properties * file with UTF-8 encoding). If it fails, then load the file with ISO-8859-1 */ --- 30,44 ---- import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; import java.util.Objects; + import sun.nio.cs.ISO_8859_1; + import sun.nio.cs.UTF_8; + /** * A Charset implementation for reading PropertyResourceBundle, in order * for loading properties files. This first tries to load the properties * file with UTF-8 encoding). If it fails, then load the file with ISO-8859-1 */
*** 68,78 **** throw new UnsupportedOperationException("Encoding is not supported"); } private final class PropertiesFileDecoder extends CharsetDecoder { ! private CharsetDecoder cdUTF_8 = StandardCharsets.UTF_8.newDecoder() .onMalformedInput(CodingErrorAction.REPORT) .onUnmappableCharacter(CodingErrorAction.REPORT); private CharsetDecoder cdISO_8859_1 = null; protected PropertiesFileDecoder(Charset cs, --- 70,80 ---- throw new UnsupportedOperationException("Encoding is not supported"); } private final class PropertiesFileDecoder extends CharsetDecoder { ! private CharsetDecoder cdUTF_8 = UTF_8.INSTANCE.newDecoder() .onMalformedInput(CodingErrorAction.REPORT) .onUnmappableCharacter(CodingErrorAction.REPORT); private CharsetDecoder cdISO_8859_1 = null; protected PropertiesFileDecoder(Charset cs,
*** 96,105 **** // Invalid or unmappable UTF-8 sequence detected. // Switching to the ISO 8859-1 decorder. assert cr.isMalformed() || cr.isUnmappable(); in.reset(); out.reset(); ! cdISO_8859_1 = StandardCharsets.ISO_8859_1.newDecoder(); return cdISO_8859_1.decode(in, out, false); } } } --- 98,107 ---- // Invalid or unmappable UTF-8 sequence detected. // Switching to the ISO 8859-1 decorder. assert cr.isMalformed() || cr.isUnmappable(); in.reset(); out.reset(); ! cdISO_8859_1 = ISO_8859_1.INSTANCE.newDecoder(); return cdISO_8859_1.decode(in, out, false); } } }
< prev index next >