Skip to content

Commit

Permalink
8242541: Small charset issues (ISO8859-16, x-eucJP-Open, x-IBM834 and…
Browse files Browse the repository at this point in the history
… x-IBM949C)

Modify ISO8859-16, x-eucJP-Open, x-IBM834 and x-IBM949C charset related files

Reviewed-by: naoto
  • Loading branch information
Ichiroh Takiguchi committed May 1, 2020
1 parent 60b4157 commit 318fab9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
9 changes: 5 additions & 4 deletions make/data/charsetmapping/charsets
@@ -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
Expand Down Expand Up @@ -282,6 +282,7 @@ charset ISO-8859-16 ISO_8859_16
alias iso-ir-226
alias ISO_8859-16:2001
alias ISO_8859-16
alias ISO8859_16
alias latin10
alias l10
alias csISO885916
Expand Down Expand Up @@ -697,7 +698,7 @@ charset x-euc-jp-linux EUC_JP_LINUX
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
Expand Down Expand Up @@ -1391,7 +1392,7 @@ charset x-IBM833 IBM833

charset x-IBM834 IBM834 # EBCDIC DBCS-only Korean
package sun.nio.cs.ext
type source
type template
alias cp834
alias ibm834
alias 834
Expand Down Expand Up @@ -1485,7 +1486,7 @@ charset x-IBM949 IBM949

charset x-IBM949C IBM949C
package sun.nio.cs.ext
type source
type template
alias cp949C # JDK historical
alias ibm949C
alias ibm-949C
Expand Down
@@ -1,6 +1,6 @@

/*
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
* 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
Expand All @@ -27,7 +27,7 @@
/*
*/

package sun.nio.cs.ext;
package $PACKAGE$;

import java.nio.ByteBuffer;
import java.nio.charset.Charset;
Expand All @@ -41,7 +41,7 @@
public class IBM834 extends Charset
{
public IBM834() {
super("x-IBM834", ExtendedCharsets.aliasesFor("x-IBM834"));
super("x-IBM834", $ALIASES$);
}

public boolean contains(Charset cs) {
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* 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
Expand All @@ -23,7 +23,7 @@
* questions.
*/

package sun.nio.cs.ext;
package $PACKAGE$;

import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
Expand All @@ -36,7 +36,7 @@ public class IBM949C extends Charset implements HistoricallyNamedCharset
{

public IBM949C() {
super("x-IBM949C", ExtendedCharsets.aliasesFor("x-IBM949C"));
super("x-IBM949C", $ALIASES$);
}

public String historicalName() {
Expand Down
5 changes: 3 additions & 2 deletions test/jdk/java/nio/charset/Charset/RegisteredCharsets.java
@@ -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
Expand All @@ -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
*/
Expand Down Expand Up @@ -443,6 +443,7 @@ public static void main(String[] args) throws Exception {
"iso-ir-226",
"ISO_8859-16:2001",
"ISO_8859-16",
"ISO8859_16",
"latin10",
"l10",
"csISO885916"
Expand Down
27 changes: 25 additions & 2 deletions test/jdk/sun/nio/cs/CheckHistoricalNames.java
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -294,6 +296,7 @@ public static void main (String[] args) throws Exception {
checkMappedName("x-MacThai", "MacThai");
checkMappedName("x-MacTurkish", "MacTurkish");
checkMappedName("x-MacUkraine", "MacUkraine");
checkCharsetAndHistoricalName();

if (failed != 0)
throw new Exception("Test Failed: " + failed);
Expand All @@ -315,4 +318,24 @@ private static void checkMappedName(String alias, String canonical)
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++;
}
}
}
}

0 comments on commit 318fab9

Please sign in to comment.