Skip to content

Commit 318fab9

Browse files
author
Ichiroh Takiguchi
committed
8242541: Small charset issues (ISO8859-16, x-eucJP-Open, x-IBM834 and x-IBM949C)
Modify ISO8859-16, x-eucJP-Open, x-IBM834 and x-IBM949C charset related files Reviewed-by: naoto
1 parent 60b4157 commit 318fab9

File tree

5 files changed

+39
-14
lines changed

5 files changed

+39
-14
lines changed

make/data/charsetmapping/charsets

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -282,6 +282,7 @@ charset ISO-8859-16 ISO_8859_16
282282
alias iso-ir-226
283283
alias ISO_8859-16:2001
284284
alias ISO_8859-16
285+
alias ISO8859_16
285286
alias latin10
286287
alias l10
287288
alias csISO885916
@@ -697,7 +698,7 @@ charset x-euc-jp-linux EUC_JP_LINUX
697698
charset x-eucJP-Open EUC_JP_Open
698699
package sun.nio.cs.ext
699700
type template
700-
hisname EUC_JP_Solari
701+
hisname EUC_JP_Solaris
701702
ascii true
702703
alias EUC_JP_Solaris # JDK historical
703704
alias eucJP-open
@@ -1391,7 +1392,7 @@ charset x-IBM833 IBM833
13911392

13921393
charset x-IBM834 IBM834 # EBCDIC DBCS-only Korean
13931394
package sun.nio.cs.ext
1394-
type source
1395+
type template
13951396
alias cp834
13961397
alias ibm834
13971398
alias 834
@@ -1485,7 +1486,7 @@ charset x-IBM949 IBM949
14851486

14861487
charset x-IBM949C IBM949C
14871488
package sun.nio.cs.ext
1488-
type source
1489+
type template
14891490
alias cp949C # JDK historical
14901491
alias ibm949C
14911492
alias ibm-949C

src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM834.java renamed to src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM834.java.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*
3-
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
3+
* Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
2727
/*
2828
*/
2929

30-
package sun.nio.cs.ext;
30+
package $PACKAGE$;
3131

3232
import java.nio.ByteBuffer;
3333
import java.nio.charset.Charset;
@@ -41,7 +41,7 @@
4141
public class IBM834 extends Charset
4242
{
4343
public IBM834() {
44-
super("x-IBM834", ExtendedCharsets.aliasesFor("x-IBM834"));
44+
super("x-IBM834", $ALIASES$);
4545
}
4646

4747
public boolean contains(Charset cs) {

src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM949C.java renamed to src/jdk.charsets/share/classes/sun/nio/cs/ext/IBM949C.java.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323
* questions.
2424
*/
2525

26-
package sun.nio.cs.ext;
26+
package $PACKAGE$;
2727

2828
import java.nio.charset.Charset;
2929
import java.nio.charset.CharsetDecoder;
@@ -36,7 +36,7 @@ public class IBM949C extends Charset implements HistoricallyNamedCharset
3636
{
3737

3838
public IBM949C() {
39-
super("x-IBM949C", ExtendedCharsets.aliasesFor("x-IBM949C"));
39+
super("x-IBM949C", $ALIASES$);
4040
}
4141

4242
public String historicalName() {

test/jdk/java/nio/charset/Charset/RegisteredCharsets.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/* @test
2525
* @bug 4473201 4696726 4652234 4482298 4784385 4966197 4267354 5015668
26-
6911753 8071447 8186751
26+
6911753 8071447 8186751 8242541
2727
* @summary Check that registered charsets are actually registered
2828
* @modules jdk.charsets
2929
*/
@@ -443,6 +443,7 @@ public static void main(String[] args) throws Exception {
443443
"iso-ir-226",
444444
"ISO_8859-16:2001",
445445
"ISO_8859-16",
446+
"ISO8859_16",
446447
"latin10",
447448
"l10",
448449
"csISO885916"

test/jdk/sun/nio/cs/CheckHistoricalNames.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,12 +22,14 @@
2222
*/
2323

2424
/* @test
25-
* @bug 4513767 4961027 6217210
25+
* @bug 4513767 4961027 6217210 8242541
2626
* @summary Checks canonical names match between old and (NIO) core charsets
2727
* @modules jdk.charsets
2828
*/
2929
import java.io.InputStreamReader;
3030
import java.io.IOException;
31+
import java.nio.charset.Charset;
32+
import java.nio.charset.UnsupportedCharsetException;
3133

3234
public class CheckHistoricalNames {
3335
static int failed = 0;
@@ -294,6 +296,7 @@ public static void main (String[] args) throws Exception {
294296
checkMappedName("x-MacThai", "MacThai");
295297
checkMappedName("x-MacTurkish", "MacTurkish");
296298
checkMappedName("x-MacUkraine", "MacUkraine");
299+
checkCharsetAndHistoricalName();
297300

298301
if (failed != 0)
299302
throw new Exception("Test Failed: " + failed);
@@ -315,4 +318,24 @@ private static void checkMappedName(String alias, String canonical)
315318
failed++;
316319
}
317320
}
321+
322+
private static void checkCharsetAndHistoricalName() {
323+
for (Charset cs : Charset.availableCharsets().values()) {
324+
InputStreamReader isr = new InputStreamReader(System.in, cs);
325+
String encoding = isr.getEncoding();
326+
try {
327+
Charset csHist = Charset.forName(encoding);
328+
if (!cs.equals(csHist)) {
329+
System.out.println("Failed charset name"
330+
+ " - expected " + cs.name()
331+
+ ", got " + csHist.name());
332+
failed++;
333+
}
334+
} catch (UnsupportedCharsetException uce) {
335+
System.out.println("Failed : charset - " + cs.name()
336+
+ ", missing alias entry - " + encoding);
337+
failed++;
338+
}
339+
}
340+
}
318341
}

0 commit comments

Comments
 (0)