author | weijun |
Fri, 20 May 2016 11:20:49 +0800 | |
changeset 38439 | 8a3871cd7fca |
parent 34882 | ce2a8ec851c1 |
permissions | -rw-r--r-- |
28969
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
1 |
/* |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
2 |
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
3 |
* |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
5 |
* |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. Oracle designates this |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
9 |
* particular file as subject to the "Classpath" exception as provided |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
10 |
* by Oracle in the LICENSE file that accompanied this code. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
11 |
* |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
12 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
14 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
15 |
* version 2 for more details (a copy is included in the LICENSE file that |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
16 |
* accompanied this code). |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
17 |
* |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License version |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
19 |
* 2 along with this work; if not, write to the Free Software Foundation, |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
20 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
21 |
* |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
22 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
23 |
* or visit www.oracle.com if you need additional information or have any |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
24 |
* questions. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
25 |
* |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
26 |
*/ |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
27 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
28 |
// -- This file was mechanically generated: Do not edit! -- // |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
29 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
30 |
package sun.nio.cs.ext; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
31 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
32 |
import java.lang.ref.SoftReference; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
33 |
import java.nio.charset.Charset; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
34 |
import java.nio.charset.spi.CharsetProvider; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
35 |
import java.security.AccessController; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
36 |
import java.security.PrivilegedAction; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
37 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
38 |
/** |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
39 |
* Provider for extended charsets. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
40 |
*/ |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
41 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
42 |
public class ExtendedCharsets extends AbstractCharsetProvider { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
43 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
44 |
static volatile ExtendedCharsets instance = null; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
45 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
46 |
public ExtendedCharsets() { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
47 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
48 |
super("sun.nio.cs.ext"); // identify provider pkg name. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
49 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
50 |
_CHARSETS_DEF_LIST_ |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
51 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
52 |
instance = this; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
53 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
54 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
55 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
56 |
private boolean initialized = false; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
57 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
58 |
// If the sun.nio.cs.map property is defined on the command line we won't |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
59 |
// see it in the system-properties table until after the charset subsystem |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
60 |
// has been initialized. We therefore delay the effect of this property |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
61 |
// until after the JRE has completely booted. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
62 |
// |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
63 |
// At the moment following values for this property are supported, property |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
64 |
// value string is case insensitive. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
65 |
// |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
66 |
// (1)"Windows-31J/Shift_JIS" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
67 |
// In 1.4.1 we added a correct implementation of the Shift_JIS charset |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
68 |
// but in previous releases this charset name had been treated as an alias |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
69 |
// for Windows-31J, aka MS932. Users who have existing code that depends |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
70 |
// upon this alias can restore the previous behavior by defining this |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
71 |
// property to have this value. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
72 |
// |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
73 |
// (2)"x-windows-50221/ISO-2022-JP" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
74 |
// "x-windows-50220/ISO-2022-JP" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
75 |
// "x-windows-iso2022jp/ISO-2022-JP" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
76 |
// The charset ISO-2022-JP is a "standard based" implementation by default, |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
77 |
// which supports ASCII, JIS_X_0201 and JIS_X_0208 mappings based encoding |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
78 |
// and decoding only. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
79 |
// There are three Microsoft iso-2022-jp variants, namely x-windows-50220, |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
80 |
// x-windows-50221 and x-windows-iso2022jp which behaves "slightly" differently |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
81 |
// compared to the "standard based" implementation. See ISO2022_JP.java for |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
82 |
// detailed description. Users who prefer the behavior of MS iso-2022-jp |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
83 |
// variants should use these names explicitly instead of using "ISO-2022-JP" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
84 |
// and its aliases. However for those who need the ISO-2022-JP charset behaves |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
85 |
// exactly the same as MS variants do, above properties can be defined to |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
86 |
// switch. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
87 |
// |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
88 |
// If we need to define other charset-alias mappings in the future then |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
89 |
// this property could be further extended, the general idea being that its |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
90 |
// value should be of the form |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
91 |
// |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
92 |
// new-charset-1/old-charset-1,new-charset-2/old-charset-2,... |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
93 |
// |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
94 |
// where each charset named to the left of a slash is intended to replace |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
95 |
// (most) uses of the charset named to the right of the slash. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
96 |
// |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
97 |
protected void init() { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
98 |
if (initialized) |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
99 |
return; |
34882 | 100 |
if (!jdk.internal.misc.VM.isBooted()) |
28969
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
101 |
return; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
102 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
103 |
String map = getProperty("sun.nio.cs.map"); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
104 |
boolean sjisIsMS932 = false; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
105 |
boolean iso2022jpIsMS50221 = false; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
106 |
boolean iso2022jpIsMS50220 = false; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
107 |
boolean iso2022jpIsMSISO2022JP = false; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
108 |
if (map != null) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
109 |
String[] maps = map.split(","); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
110 |
for (int i = 0; i < maps.length; i++) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
111 |
if (maps[i].equalsIgnoreCase("Windows-31J/Shift_JIS")) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
112 |
sjisIsMS932 = true; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
113 |
} else if (maps[i].equalsIgnoreCase("x-windows-50221/ISO-2022-JP")) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
114 |
iso2022jpIsMS50221 = true; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
115 |
} else if (maps[i].equalsIgnoreCase("x-windows-50220/ISO-2022-JP")) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
116 |
iso2022jpIsMS50220 = true; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
117 |
} else if (maps[i].equalsIgnoreCase("x-windows-iso2022jp/ISO-2022-JP")) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
118 |
iso2022jpIsMSISO2022JP = true; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
119 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
120 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
121 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
122 |
if (sjisIsMS932 && hasCharset("Shift_JIS")) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
123 |
deleteCharset("Shift_JIS", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
124 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
125 |
// IANA aliases |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
126 |
"sjis", // historical |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
127 |
"shift_jis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
128 |
"shift-jis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
129 |
"ms_kanji", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
130 |
"x-sjis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
131 |
"csShiftJIS" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
132 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
133 |
deleteCharset("windows-31j", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
134 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
135 |
"MS932", // JDK historical |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
136 |
"windows-932", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
137 |
"csWindows31J" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
138 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
139 |
charset("Shift_JIS", "SJIS", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
140 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
141 |
// IANA aliases |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
142 |
"sjis" // JDK historical |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
143 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
144 |
charset("windows-31j", "MS932", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
145 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
146 |
"MS932", // JDK historical |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
147 |
"windows-932", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
148 |
"csWindows31J", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
149 |
"shift-jis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
150 |
"ms_kanji", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
151 |
"x-sjis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
152 |
"csShiftJIS", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
153 |
// This alias takes precedence over the actual |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
154 |
// Shift_JIS charset itself since aliases are always |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
155 |
// resolved first, before looking up canonical names. |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
156 |
"shift_jis" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
157 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
158 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
159 |
if (iso2022jpIsMS50221 || |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
160 |
iso2022jpIsMS50220 || |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
161 |
iso2022jpIsMSISO2022JP) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
162 |
deleteCharset("ISO-2022-JP", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
163 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
164 |
"iso2022jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
165 |
"jis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
166 |
"csISO2022JP", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
167 |
"jis_encoding", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
168 |
"csjisencoding" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
169 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
170 |
if (iso2022jpIsMS50221) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
171 |
deleteCharset("x-windows-50221", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
172 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
173 |
"cp50221", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
174 |
"ms50221" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
175 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
176 |
charset("x-windows-50221", "MS50221", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
177 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
178 |
"cp50221", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
179 |
"ms50221", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
180 |
"iso-2022-jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
181 |
"iso2022jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
182 |
"jis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
183 |
"csISO2022JP", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
184 |
"jis_encoding", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
185 |
"csjisencoding" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
186 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
187 |
} else if (iso2022jpIsMS50220) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
188 |
deleteCharset("x-windows-50220", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
189 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
190 |
"cp50220", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
191 |
"ms50220" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
192 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
193 |
charset("x-windows-50220", "MS50220", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
194 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
195 |
"cp50220", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
196 |
"ms50220", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
197 |
"iso-2022-jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
198 |
"iso2022jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
199 |
"jis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
200 |
"csISO2022JP", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
201 |
"jis_encoding", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
202 |
"csjisencoding" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
203 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
204 |
} else { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
205 |
deleteCharset("x-windows-iso2022jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
206 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
207 |
"windows-iso2022jp" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
208 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
209 |
charset("x-windows-iso2022jp", "MSISO2022JP", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
210 |
new String[] { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
211 |
"windows-iso2022jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
212 |
"iso-2022-jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
213 |
"iso2022jp", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
214 |
"jis", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
215 |
"csISO2022JP", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
216 |
"jis_encoding", |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
217 |
"csjisencoding" |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
218 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
219 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
220 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
221 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
222 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
223 |
initialized = true; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
224 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
225 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
226 |
private static String getProperty(String key) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
227 |
// this method may be called during initialization of |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
228 |
// system class loader and thus not using lambda |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
229 |
return AccessController.doPrivileged( |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
230 |
new PrivilegedAction<String>() { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
231 |
@Override |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
232 |
public String run() { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
233 |
return System.getProperty(key); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
234 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
235 |
}); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
236 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
237 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
238 |
public static String[] aliasesFor(String charsetName) { |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
239 |
if (instance == null) |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
240 |
return null; |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
241 |
return instance.aliases(charsetName); |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
242 |
} |
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
243 |
|
f980bee32887
8073152: Update Standard/ExtendedCharsets to work with module system
sherman
parents:
diff
changeset
|
244 |
} |