--- old/make/data/charsetmapping/charsets 2020-04-29 03:28:55.867408019 +0900 +++ new/make/data/charsetmapping/charsets 2020-04-29 03:28:55.617408019 +0900 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2020, 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 @@ -282,6 +282,7 @@ alias iso-ir-226 alias ISO_8859-16:2001 alias ISO_8859-16 + alias ISO8859_16 alias latin10 alias l10 alias csISO885916 @@ -697,7 +698,7 @@ charset x-eucJP-Open EUC_JP_Open package sun.nio.cs.ext type template - hisname EUC_JP_Solari + hisname EUC_JP_Solaris ascii true alias EUC_JP_Solaris # JDK historical alias eucJP-open @@ -1391,7 +1392,7 @@ charset x-IBM834 IBM834 # EBCDIC DBCS-only Korean package sun.nio.cs.ext - type source + type template alias cp834 alias ibm834 alias 834 @@ -1485,7 +1486,7 @@ charset x-IBM949C IBM949C package sun.nio.cs.ext - type source + type template alias cp949C # JDK historical alias ibm949C alias ibm-949C --- old/test/jdk/java/nio/charset/Charset/RegisteredCharsets.java 2020-04-29 03:28:56.237408019 +0900 +++ new/test/jdk/java/nio/charset/Charset/RegisteredCharsets.java 2020-04-29 03:28:55.957408019 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2020, 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 @@ -23,7 +23,7 @@ /* @test * @bug 4473201 4696726 4652234 4482298 4784385 4966197 4267354 5015668 - 6911753 8071447 8186751 + 6911753 8071447 8186751 8242541 * @summary Check that registered charsets are actually registered * @modules jdk.charsets */ @@ -443,6 +443,7 @@ "iso-ir-226", "ISO_8859-16:2001", "ISO_8859-16", + "ISO8859_16", "latin10", "l10", "csISO885916" --- old/test/jdk/sun/nio/cs/CheckHistoricalNames.java 2020-04-29 03:28:56.577408019 +0900 +++ new/test/jdk/sun/nio/cs/CheckHistoricalNames.java 2020-04-29 03:28:56.297408019 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2020, 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 @@ -22,12 +22,14 @@ */ /* @test - * @bug 4513767 4961027 6217210 + * @bug 4513767 4961027 6217210 8242541 * @summary Checks canonical names match between old and (NIO) core charsets * @modules jdk.charsets */ import java.io.InputStreamReader; import java.io.IOException; +import java.nio.charset.Charset; +import java.nio.charset.UnsupportedCharsetException; public class CheckHistoricalNames { static int failed = 0; @@ -294,6 +296,7 @@ checkMappedName("x-MacThai", "MacThai"); checkMappedName("x-MacTurkish", "MacTurkish"); checkMappedName("x-MacUkraine", "MacUkraine"); + checkCharsetAndHistoricalName(); if (failed != 0) throw new Exception("Test Failed: " + failed); @@ -315,4 +318,24 @@ failed++; } } + + private static void checkCharsetAndHistoricalName() { + for (Charset cs : Charset.availableCharsets().values()) { + InputStreamReader isr = new InputStreamReader(System.in, cs); + String encoding = isr.getEncoding(); + try { + Charset csHist = Charset.forName(encoding); + if (!cs.equals(csHist)) { + System.out.println("Failed charset name" + + " - expected " + cs.name() + + ", got " + csHist.name()); + failed++; + } + } catch (UnsupportedCharsetException uce) { + System.out.println("Failed : charset - " + cs.name() + + ", missing alias entry - " + encoding); + failed++; + } + } + } } --- old/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM834.java 2020-04-29 03:28:56.927408019 +0900 +++ /dev/null 2020-02-10 10:55:16.047408019 +0900 @@ -1,98 +0,0 @@ - -/* - * Copyright (c) 2006, 2012, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - */ - -package sun.nio.cs.ext; - -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CoderResult; -import sun.nio.cs.DoubleByte; -import static sun.nio.cs.CharsetMapping.*; - -// EBCDIC DBCS-only Korean -public class IBM834 extends Charset -{ - public IBM834() { - super("x-IBM834", ExtendedCharsets.aliasesFor("x-IBM834")); - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM834); - } - - public CharsetDecoder newDecoder() { - IBM933.initb2c(); - return new DoubleByte.Decoder_DBCSONLY( - this, IBM933.b2c, null, 0x40, 0xfe); // hardcode the b2min/max - } - - public CharsetEncoder newEncoder() { - IBM933.initc2b(); - return new Encoder(this); - } - - protected static class Encoder extends DoubleByte.Encoder_DBCSONLY { - public Encoder(Charset cs) { - super(cs, new byte[] {(byte)0xfe, (byte)0xfe}, - IBM933.c2b, IBM933.c2bIndex, false); - } - - public int encodeChar(char ch) { - int bb = super.encodeChar(ch); - if (bb == UNMAPPABLE_ENCODING) { - // Cp834 has 6 additional non-roundtrip char->bytes - // mappings, see#6379808 - if (ch == '\u00b7') { - return 0x4143; - } else if (ch == '\u00ad') { - return 0x4148; - } else if (ch == '\u2015') { - return 0x4149; - } else if (ch == '\u223c') { - return 0x42a1; - } else if (ch == '\uff5e') { - return 0x4954; - } else if (ch == '\u2299') { - return 0x496f; - } - } - return bb; - } - - public boolean isLegalReplacement(byte[] repl) { - if (repl.length == 2 && - repl[0] == (byte)0xfe && repl[1] == (byte)0xfe) - return true; - return super.isLegalReplacement(repl); - } - - } -} --- /dev/null 2020-02-10 10:55:16.047408019 +0900 +++ new/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM834.java.template 2020-04-29 03:28:56.627408019 +0900 @@ -0,0 +1,98 @@ + +/* + * Copyright (c) 2006, 2020, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + */ + +package $PACKAGE$; + +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CharsetEncoder; +import java.nio.charset.CoderResult; +import sun.nio.cs.DoubleByte; +import static sun.nio.cs.CharsetMapping.*; + +// EBCDIC DBCS-only Korean +public class IBM834 extends Charset +{ + public IBM834() { + super("x-IBM834", $ALIASES$); + } + + public boolean contains(Charset cs) { + return (cs instanceof IBM834); + } + + public CharsetDecoder newDecoder() { + IBM933.initb2c(); + return new DoubleByte.Decoder_DBCSONLY( + this, IBM933.b2c, null, 0x40, 0xfe); // hardcode the b2min/max + } + + public CharsetEncoder newEncoder() { + IBM933.initc2b(); + return new Encoder(this); + } + + protected static class Encoder extends DoubleByte.Encoder_DBCSONLY { + public Encoder(Charset cs) { + super(cs, new byte[] {(byte)0xfe, (byte)0xfe}, + IBM933.c2b, IBM933.c2bIndex, false); + } + + public int encodeChar(char ch) { + int bb = super.encodeChar(ch); + if (bb == UNMAPPABLE_ENCODING) { + // Cp834 has 6 additional non-roundtrip char->bytes + // mappings, see#6379808 + if (ch == '\u00b7') { + return 0x4143; + } else if (ch == '\u00ad') { + return 0x4148; + } else if (ch == '\u2015') { + return 0x4149; + } else if (ch == '\u223c') { + return 0x42a1; + } else if (ch == '\uff5e') { + return 0x4954; + } else if (ch == '\u2299') { + return 0x496f; + } + } + return bb; + } + + public boolean isLegalReplacement(byte[] repl) { + if (repl.length == 2 && + repl[0] == (byte)0xfe && repl[1] == (byte)0xfe) + return true; + return super.isLegalReplacement(repl); + } + + } +} --- old/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM949C.java 2020-04-29 03:28:57.287408019 +0900 +++ /dev/null 2020-02-10 10:55:16.047408019 +0900 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio.cs.ext; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.util.Arrays; -import sun.nio.cs.DoubleByte; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM949C extends Charset implements HistoricallyNamedCharset -{ - - public IBM949C() { - super("x-IBM949C", ExtendedCharsets.aliasesFor("x-IBM949C")); - } - - public String historicalName() { - return "Cp949C"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof IBM949C)); - } - - public CharsetDecoder newDecoder() { - return new DoubleByte.Decoder(this, - IBM949.b2c, - b2cSB, - 0xa1, - 0xfe); - } - - public CharsetEncoder newEncoder() { - return new DoubleByte.Encoder(this, c2b, c2bIndex); - } - - final static char[] b2cSB; - final static char[] c2b; - final static char[] c2bIndex; - - static { - IBM949.initb2c(); - b2cSB = new char[0x100]; - for (int i = 0; i < 0x80; i++) { - b2cSB[i] = (char)i; - } - for (int i = 0x80; i < 0x100; i++) { - b2cSB[i] = IBM949.b2cSB[i]; - } - IBM949.initc2b(); - c2b = Arrays.copyOf(IBM949.c2b, IBM949.c2b.length); - c2bIndex = Arrays.copyOf(IBM949.c2bIndex, IBM949.c2bIndex.length); - for (char c = '\0'; c < '\u0080'; ++c) { - int index = c2bIndex[c >> 8]; - c2b[index + (c & 0xff)] = c; - } - } -} --- /dev/null 2020-02-10 10:55:16.047408019 +0900 +++ new/src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM949C.java.template 2020-04-29 03:28:56.997408019 +0900 @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2003, 2020, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package $PACKAGE$; + +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CharsetEncoder; +import java.util.Arrays; +import sun.nio.cs.DoubleByte; +import sun.nio.cs.HistoricallyNamedCharset; + +public class IBM949C extends Charset implements HistoricallyNamedCharset +{ + + public IBM949C() { + super("x-IBM949C", $ALIASES$); + } + + public String historicalName() { + return "Cp949C"; + } + + public boolean contains(Charset cs) { + return ((cs.name().equals("US-ASCII")) + || (cs instanceof IBM949C)); + } + + public CharsetDecoder newDecoder() { + return new DoubleByte.Decoder(this, + IBM949.b2c, + b2cSB, + 0xa1, + 0xfe); + } + + public CharsetEncoder newEncoder() { + return new DoubleByte.Encoder(this, c2b, c2bIndex); + } + + final static char[] b2cSB; + final static char[] c2b; + final static char[] c2bIndex; + + static { + IBM949.initb2c(); + b2cSB = new char[0x100]; + for (int i = 0; i < 0x80; i++) { + b2cSB[i] = (char)i; + } + for (int i = 0x80; i < 0x100; i++) { + b2cSB[i] = IBM949.b2cSB[i]; + } + IBM949.initc2b(); + c2b = Arrays.copyOf(IBM949.c2b, IBM949.c2b.length); + c2bIndex = Arrays.copyOf(IBM949.c2bIndex, IBM949.c2bIndex.length); + for (char c = '\0'; c < '\u0080'; ++c) { + int index = c2bIndex[c >> 8]; + c2b[index + (c & 0xff)] = c; + } + } +}