author | joehw |
Wed, 04 Oct 2017 10:54:18 -0700 | |
changeset 47312 | d4f959806fe9 |
parent 47216 | 71c04702a3d5 |
child 47359 | e1a6c0168741 |
permissions | -rw-r--r-- |
12005 | 1 |
/* |
47312 | 2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
3 |
* @LastModified: Sep 2017 |
|
12005 | 4 |
*/ |
5 |
/* |
|
44797
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
6 |
* Licensed to the Apache Software Foundation (ASF) under one or more |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
7 |
* contributor license agreements. See the NOTICE file distributed with |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
8 |
* this work for additional information regarding copyright ownership. |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
9 |
* The ASF licenses this file to You under the Apache License, Version 2.0 |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
10 |
* (the "License"); you may not use this file except in compliance with |
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
11 |
* the License. You may obtain a copy of the License at |
12005 | 12 |
* |
44797
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
13 |
* http://www.apache.org/licenses/LICENSE-2.0 |
12005 | 14 |
* |
15 |
* Unless required by applicable law or agreed to in writing, software |
|
16 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
17 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
18 |
* See the License for the specific language governing permissions and |
|
19 |
* limitations under the License. |
|
20 |
*/ |
|
44797
8b3b3b911b8a
8162572: Update License Header for all JAXP sources
joehw
parents:
25868
diff
changeset
|
21 |
|
12005 | 22 |
package com.sun.org.apache.xml.internal.serializer; |
23 |
||
47312 | 24 |
import java.io.BufferedWriter; |
25 |
import java.io.IOException; |
|
12005 | 26 |
import java.io.InputStream; |
27 |
import java.io.OutputStream; |
|
28 |
import java.io.OutputStreamWriter; |
|
29 |
import java.io.UnsupportedEncodingException; |
|
30 |
import java.io.Writer; |
|
47312 | 31 |
import java.net.MalformedURLException; |
12005 | 32 |
import java.net.URL; |
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
33 |
import java.nio.charset.Charset; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
34 |
import java.nio.charset.IllegalCharsetNameException; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
35 |
import java.nio.charset.UnsupportedCharsetException; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
36 |
import java.util.Collections; |
47312 | 37 |
import java.util.Enumeration; |
38 |
import java.util.HashMap; |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
39 |
import java.util.Map.Entry; |
47312 | 40 |
import java.util.Map; |
41 |
import java.util.Properties; |
|
42 |
import java.util.StringTokenizer; |
|
43 |
import jdk.xml.internal.SecuritySupport; |
|
12005 | 44 |
|
45 |
/** |
|
46 |
* Provides information about encodings. Depends on the Java runtime |
|
47 |
* to provides writers for the different encodings, but can be used |
|
48 |
* to override encoding names and provide the last printable character |
|
49 |
* for each encoding. |
|
50 |
* |
|
51 |
* @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a> |
|
52 |
*/ |
|
53 |
||
54 |
public final class Encodings extends Object |
|
55 |
{ |
|
56 |
||
57 |
/** |
|
58 |
* The last printable character for unknown encodings. |
|
59 |
*/ |
|
60 |
private static final int m_defaultLastPrintable = 0x7F; |
|
61 |
||
62 |
/** |
|
63 |
* Standard filename for properties file with encodings data. |
|
64 |
*/ |
|
65 |
private static final String ENCODINGS_FILE = "com/sun/org/apache/xml/internal/serializer/Encodings.properties"; |
|
66 |
||
67 |
/** |
|
68 |
* Standard filename for properties file with encodings data. |
|
69 |
*/ |
|
70 |
private static final String ENCODINGS_PROP = "com.sun.org.apache.xalan.internal.serialize.encodings"; |
|
71 |
||
72 |
||
73 |
/** |
|
74 |
* Returns a writer for the specified encoding based on |
|
75 |
* an output stream. |
|
76 |
* |
|
77 |
* @param output The output stream |
|
78 |
* @param encoding The encoding |
|
79 |
* @return A suitable writer |
|
80 |
* @throws UnsupportedEncodingException There is no convertor |
|
81 |
* to support this encoding |
|
82 |
*/ |
|
83 |
static Writer getWriter(OutputStream output, String encoding) |
|
84 |
throws UnsupportedEncodingException |
|
85 |
{ |
|
86 |
||
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
87 |
final EncodingInfo ei = _encodingInfos.findEncoding(toUpperCaseFast(encoding)); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
88 |
if (ei != null) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
89 |
try { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
90 |
return new BufferedWriter(new OutputStreamWriter( |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
91 |
output, ei.javaName)); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
92 |
} catch (UnsupportedEncodingException usee) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
93 |
// keep trying |
12005 | 94 |
} |
95 |
} |
|
96 |
||
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
97 |
return new BufferedWriter(new OutputStreamWriter(output, encoding)); |
12005 | 98 |
} |
99 |
||
100 |
||
101 |
/** |
|
102 |
* Returns the last printable character for an unspecified |
|
103 |
* encoding. |
|
104 |
* |
|
105 |
* @return the default size |
|
106 |
*/ |
|
107 |
public static int getLastPrintable() |
|
108 |
{ |
|
109 |
return m_defaultLastPrintable; |
|
110 |
} |
|
111 |
||
112 |
||
113 |
||
114 |
/** |
|
115 |
* Returns the EncodingInfo object for the specified |
|
116 |
* encoding. |
|
117 |
* <p> |
|
118 |
* This is not a public API. |
|
119 |
* |
|
120 |
* @param encoding The encoding |
|
121 |
* @return The object that is used to determine if |
|
122 |
* characters are in the given encoding. |
|
123 |
* @xsl.usage internal |
|
124 |
*/ |
|
125 |
static EncodingInfo getEncodingInfo(String encoding) |
|
126 |
{ |
|
127 |
EncodingInfo ei; |
|
128 |
||
129 |
String normalizedEncoding = toUpperCaseFast(encoding); |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
130 |
ei = _encodingInfos.findEncoding(normalizedEncoding); |
12005 | 131 |
if (ei == null) { |
132 |
// We shouldn't have to do this, but just in case. |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
133 |
try { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
134 |
// This may happen if the caller tries to use |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
135 |
// an encoding that wasn't registered in the |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
136 |
// (java name)->(preferred mime name) mapping file. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
137 |
// In that case we attempt to load the charset for the |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
138 |
// given encoding, and if that succeeds - we create a new |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
139 |
// EncodingInfo instance - assuming the canonical name |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
140 |
// of the charset can be used as the mime name. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
141 |
final Charset c = Charset.forName(encoding); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
142 |
final String name = c.name(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
143 |
ei = new EncodingInfo(name, name); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
144 |
_encodingInfos.putEncoding(normalizedEncoding, ei); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
145 |
} catch (IllegalCharsetNameException | UnsupportedCharsetException x) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
146 |
ei = new EncodingInfo(null,null); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
147 |
} |
12005 | 148 |
} |
149 |
||
150 |
return ei; |
|
151 |
} |
|
152 |
||
153 |
/** |
|
25834
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
154 |
* Determines if the encoding specified was recognized by the |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
155 |
* serializer or not. |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
156 |
* |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
157 |
* @param encoding The encoding |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
158 |
* @return boolean - true if the encoding was recognized else false |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
159 |
*/ |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
160 |
public static boolean isRecognizedEncoding(String encoding) |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
161 |
{ |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
162 |
EncodingInfo ei; |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
163 |
|
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
164 |
String normalizedEncoding = toUpperCaseFast(encoding); |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
165 |
ei = _encodingInfos.findEncoding(normalizedEncoding); |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
166 |
if (ei != null) |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
167 |
return true; |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
168 |
return false; |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
169 |
} |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
170 |
|
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
171 |
/** |
12005 | 172 |
* A fast and cheap way to uppercase a String that is |
173 |
* only made of printable ASCII characters. |
|
174 |
* <p> |
|
175 |
* This is not a public API. |
|
176 |
* @param s a String of ASCII characters |
|
177 |
* @return an uppercased version of the input String, |
|
178 |
* possibly the same String. |
|
179 |
* @xsl.usage internal |
|
180 |
*/ |
|
181 |
static private String toUpperCaseFast(final String s) { |
|
182 |
||
183 |
boolean different = false; |
|
184 |
final int mx = s.length(); |
|
185 |
char[] chars = new char[mx]; |
|
186 |
for (int i=0; i < mx; i++) { |
|
187 |
char ch = s.charAt(i); |
|
188 |
// is the character a lower case ASCII one? |
|
189 |
if ('a' <= ch && ch <= 'z') { |
|
190 |
// a cheap and fast way to uppercase that is good enough |
|
191 |
ch = (char) (ch + ('A' - 'a')); |
|
192 |
different = true; // the uppercased String is different |
|
193 |
} |
|
194 |
chars[i] = ch; |
|
195 |
} |
|
196 |
||
197 |
// A little optimization, don't call String.valueOf() if |
|
198 |
// the uppercased string is the same as the input string. |
|
199 |
final String upper; |
|
200 |
if (different) |
|
201 |
upper = String.valueOf(chars); |
|
202 |
else |
|
203 |
upper = s; |
|
204 |
||
205 |
return upper; |
|
206 |
} |
|
207 |
||
208 |
/** The default encoding, ISO style, ISO style. */ |
|
209 |
static final String DEFAULT_MIME_ENCODING = "UTF-8"; |
|
210 |
||
211 |
/** |
|
212 |
* Get the proper mime encoding. From the XSLT recommendation: "The encoding |
|
213 |
* attribute specifies the preferred encoding to use for outputting the result |
|
214 |
* tree. XSLT processors are required to respect values of UTF-8 and UTF-16. |
|
215 |
* For other values, if the XSLT processor does not support the specified |
|
216 |
* encoding it may signal an error; if it does not signal an error it should |
|
217 |
* use UTF-8 or UTF-16 instead. The XSLT processor must not use an encoding |
|
218 |
* whose name does not match the EncName production of the XML Recommendation |
|
219 |
* [XML]. If no encoding attribute is specified, then the XSLT processor should |
|
220 |
* use either UTF-8 or UTF-16." |
|
221 |
* |
|
222 |
* @param encoding Reference to java-style encoding string, which may be null, |
|
223 |
* in which case a default will be found. |
|
224 |
* |
|
225 |
* @return The ISO-style encoding string, or null if failure. |
|
226 |
*/ |
|
227 |
static String getMimeEncoding(String encoding) |
|
228 |
{ |
|
229 |
||
230 |
if (null == encoding) |
|
231 |
{ |
|
232 |
try |
|
233 |
{ |
|
234 |
||
235 |
// Get the default system character encoding. This may be |
|
236 |
// incorrect if they passed in a writer, but right now there |
|
237 |
// seems to be no way to get the encoding from a writer. |
|
16953 | 238 |
encoding = SecuritySupport.getSystemProperty("file.encoding", "UTF8"); |
12005 | 239 |
|
240 |
if (null != encoding) |
|
241 |
{ |
|
242 |
||
243 |
/* |
|
244 |
* See if the mime type is equal to UTF8. If you don't |
|
245 |
* do that, then convertJava2MimeEncoding will convert |
|
246 |
* 8859_1 to "ISO-8859-1", which is not what we want, |
|
247 |
* I think, and I don't think I want to alter the tables |
|
248 |
* to convert everything to UTF-8. |
|
249 |
*/ |
|
250 |
String jencoding = |
|
251 |
(encoding.equalsIgnoreCase("Cp1252") |
|
252 |
|| encoding.equalsIgnoreCase("ISO8859_1") |
|
253 |
|| encoding.equalsIgnoreCase("8859_1") |
|
254 |
|| encoding.equalsIgnoreCase("UTF8")) |
|
255 |
? DEFAULT_MIME_ENCODING |
|
256 |
: convertJava2MimeEncoding(encoding); |
|
257 |
||
258 |
encoding = |
|
259 |
(null != jencoding) ? jencoding : DEFAULT_MIME_ENCODING; |
|
260 |
} |
|
261 |
else |
|
262 |
{ |
|
263 |
encoding = DEFAULT_MIME_ENCODING; |
|
264 |
} |
|
265 |
} |
|
266 |
catch (SecurityException se) |
|
267 |
{ |
|
268 |
encoding = DEFAULT_MIME_ENCODING; |
|
269 |
} |
|
270 |
} |
|
271 |
else |
|
272 |
{ |
|
273 |
encoding = convertJava2MimeEncoding(encoding); |
|
274 |
} |
|
275 |
||
276 |
return encoding; |
|
277 |
} |
|
278 |
||
279 |
/** |
|
280 |
* Try the best we can to convert a Java encoding to a XML-style encoding. |
|
281 |
* |
|
282 |
* @param encoding non-null reference to encoding string, java style. |
|
283 |
* |
|
284 |
* @return ISO-style encoding string. |
|
285 |
*/ |
|
286 |
private static String convertJava2MimeEncoding(String encoding) |
|
287 |
{ |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
288 |
final EncodingInfo enc = |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
289 |
_encodingInfos.getEncodingFromJavaKey(toUpperCaseFast(encoding)); |
12005 | 290 |
if (null != enc) |
291 |
return enc.name; |
|
292 |
return encoding; |
|
293 |
} |
|
294 |
||
295 |
/** |
|
296 |
* Try the best we can to convert a Java encoding to a XML-style encoding. |
|
297 |
* |
|
298 |
* @param encoding non-null reference to encoding string, java style. |
|
299 |
* |
|
300 |
* @return ISO-style encoding string. |
|
301 |
*/ |
|
302 |
public static String convertMime2JavaEncoding(String encoding) |
|
303 |
{ |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
304 |
final EncodingInfo info = _encodingInfos.findEncoding(toUpperCaseFast(encoding)); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
305 |
return info != null ? info.javaName : encoding; |
12005 | 306 |
} |
307 |
||
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
308 |
// Using an inner static class here prevent initialization races |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
309 |
// where the hash maps could be used before they were populated. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
310 |
// |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
311 |
private final static class EncodingInfos { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
312 |
// These maps are final and not modified after initialization. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
313 |
private final Map<String, EncodingInfo> _encodingTableKeyJava = new HashMap<>(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
314 |
private final Map<String, EncodingInfo> _encodingTableKeyMime = new HashMap<>(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
315 |
// This map will be added to after initialization: make sure it's |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
316 |
// thread-safe. This map should not be used frequently - only in cases |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
317 |
// where the mapping requested was not declared in the Encodings.properties |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
318 |
// file. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
319 |
private final Map<String, EncodingInfo> _encodingDynamicTable = |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
320 |
Collections.synchronizedMap(new HashMap<String, EncodingInfo>()); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
321 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
322 |
private EncodingInfos() { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
323 |
loadEncodingInfo(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
324 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
325 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
326 |
// Opens the file/resource containing java charset name -> preferred mime |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
327 |
// name mapping and returns it as an InputStream. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
328 |
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException { |
12005 | 329 |
String urlString = null; |
330 |
InputStream is = null; |
|
331 |
||
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
332 |
try { |
16953 | 333 |
urlString = SecuritySupport.getSystemProperty(ENCODINGS_PROP, ""); |
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
334 |
} catch (SecurityException e) { |
12005 | 335 |
} |
336 |
||
337 |
if (urlString != null && urlString.length() > 0) { |
|
338 |
URL url = new URL(urlString); |
|
339 |
is = url.openStream(); |
|
340 |
} |
|
341 |
||
342 |
if (is == null) { |
|
12458 | 343 |
is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE); |
12005 | 344 |
} |
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
345 |
return is; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
346 |
} |
12005 | 347 |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
348 |
// Loads the Properties resource containing the mapping: |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
349 |
// java charset name -> preferred mime name |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
350 |
// and returns it. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
351 |
private Properties loadProperties() throws MalformedURLException, IOException { |
12005 | 352 |
Properties props = new Properties(); |
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
353 |
try (InputStream is = openEncodingsFileStream()) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
354 |
if (is != null) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
355 |
props.load(is); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
356 |
} else { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
357 |
// Seems to be no real need to force failure here, let the |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
358 |
// system do its best... The issue is not really very critical, |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
359 |
// and the output will be in any case _correct_ though maybe not |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
360 |
// always human-friendly... :) |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
361 |
// But maybe report/log the resource problem? |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
362 |
// Any standard ways to report/log errors (in static context)? |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
363 |
} |
12005 | 364 |
} |
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
365 |
return props; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
366 |
} |
12005 | 367 |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
368 |
// Parses the mime list associated to a java charset name. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
369 |
// The first mime name in the list is supposed to be the preferred |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
370 |
// mime name. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
371 |
private String[] parseMimeTypes(String val) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
372 |
int pos = val.indexOf(' '); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
373 |
//int lastPrintable; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
374 |
if (pos < 0) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
375 |
// Maybe report/log this problem? |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
376 |
// "Last printable character not defined for encoding " + |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
377 |
// mimeName + " (" + val + ")" ... |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
378 |
return new String[] { val }; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
379 |
//lastPrintable = 0x00FF; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
380 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
381 |
//lastPrintable = |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
382 |
// Integer.decode(val.substring(pos).trim()).intValue(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
383 |
StringTokenizer st = |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
384 |
new StringTokenizer(val.substring(0, pos), ","); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
385 |
String[] values = new String[st.countTokens()]; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
386 |
for (int i=0; st.hasMoreTokens(); i++) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
387 |
values[i] = st.nextToken(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
388 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
389 |
return values; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
390 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
391 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
392 |
// This method here attempts to find the canonical charset name for the |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
393 |
// the given name - which is supposed to be either a java name or a mime |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
394 |
// name. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
395 |
// For that, it attempts to load the charset using the given name, and |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
396 |
// then returns the charset's canonical name. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
397 |
// If the charset could not be loaded from the given name, |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
398 |
// the method returns null. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
399 |
private String findCharsetNameFor(String name) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
400 |
try { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
401 |
return Charset.forName(name).name(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
402 |
} catch (Exception x) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
403 |
return null; |
12005 | 404 |
} |
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
405 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
406 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
407 |
// This method here attempts to find the canonical charset name for the |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
408 |
// the set javaName+mimeNames - which are supposed to all refer to the |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
409 |
// same charset. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
410 |
// For that it attempts to load the charset using the javaName, and if |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
411 |
// not found, attempts again using each of the mime names in turn. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
412 |
// If the charset could be loaded from the javaName, then the javaName |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
413 |
// itself is returned as charset name. Otherwise, each of the mime names |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
414 |
// is tried in turn, until a charset can be loaded from one of the names, |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
415 |
// and the loaded charset's canonical name is returned. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
416 |
// If no charset can be loaded from either the javaName or one of the |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
417 |
// mime names, then null is returned. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
418 |
// |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
419 |
// Note that the returned name is the 'java' name that will be used in |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
420 |
// instances of EncodingInfo. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
421 |
// This is important because EncodingInfo uses that 'java name' later on |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
422 |
// in calls to String.getBytes(javaName). |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
423 |
// As it happens, sometimes only one element of the set mime names/javaName |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
424 |
// is known by Charset: sometimes only one of the mime names is known, |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
425 |
// sometime only the javaName is known, sometimes all are known. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
426 |
// |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
427 |
// By using this method here, we fix the problem where one of the mime |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
428 |
// names is known but the javaName is unknown, by associating the charset |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
429 |
// loaded from one of the mime names with the unrecognized javaName. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
430 |
// |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
431 |
// When none of the mime names or javaName are known - there's not much we can |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
432 |
// do... It can mean that this encoding is not supported for this |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
433 |
// OS. If such a charset is ever use it will result in having all characters |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
434 |
// escaped. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
435 |
// |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
436 |
private String findCharsetNameFor(String javaName, String[] mimes) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
437 |
String cs = findCharsetNameFor(javaName); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
438 |
if (cs != null) return javaName; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
439 |
for (String m : mimes) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
440 |
cs = findCharsetNameFor(m); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
441 |
if (cs != null) break; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
442 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
443 |
return cs; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
444 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
445 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
446 |
/** |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
447 |
* Loads a list of all the supported encodings. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
448 |
* |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
449 |
* System property "encodings" formatted using URL syntax may define an |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
450 |
* external encodings list. Thanks to Sergey Ushakov for the code |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
451 |
* contribution! |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
452 |
*/ |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
453 |
private void loadEncodingInfo() { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
454 |
try { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
455 |
// load (java name)->(preferred mime name) mapping. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
456 |
final Properties props = loadProperties(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
457 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
458 |
// create instances of EncodingInfo from the loaded mapping |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
459 |
Enumeration keys = props.keys(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
460 |
Map<String, EncodingInfo> canonicals = new HashMap<>(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
461 |
while (keys.hasMoreElements()) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
462 |
final String javaName = (String) keys.nextElement(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
463 |
final String[] mimes = parseMimeTypes(props.getProperty(javaName)); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
464 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
465 |
final String charsetName = findCharsetNameFor(javaName, mimes); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
466 |
if (charsetName != null) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
467 |
final String kj = toUpperCaseFast(javaName); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
468 |
final String kc = toUpperCaseFast(charsetName); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
469 |
for (int i = 0; i < mimes.length; ++i) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
470 |
final String mimeName = mimes[i]; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
471 |
final String km = toUpperCaseFast(mimeName); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
472 |
EncodingInfo info = new EncodingInfo(mimeName, charsetName); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
473 |
_encodingTableKeyMime.put(km, info); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
474 |
if (!canonicals.containsKey(kc)) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
475 |
// canonicals will map the charset name to |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
476 |
// the info containing the prefered mime name |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
477 |
// (the preferred mime name is the first mime |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
478 |
// name in the list). |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
479 |
canonicals.put(kc, info); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
480 |
_encodingTableKeyJava.put(kc, info); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
481 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
482 |
_encodingTableKeyJava.put(kj, info); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
483 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
484 |
} else { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
485 |
// None of the java or mime names on the line were |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
486 |
// recognized => this charset is not supported? |
12005 | 487 |
} |
488 |
} |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
489 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
490 |
// Fix up the _encodingTableKeyJava so that the info mapped to |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
491 |
// the java name contains the preferred mime name. |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
492 |
// (a given java name can correspond to several mime name, |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
493 |
// but we want the _encodingTableKeyJava to point to the |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
494 |
// preferred mime name). |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
495 |
for (Entry<String, EncodingInfo> e : _encodingTableKeyJava.entrySet()) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
496 |
e.setValue(canonicals.get(toUpperCaseFast(e.getValue().javaName))); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
497 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
498 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
499 |
} catch (java.net.MalformedURLException mue) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
500 |
throw new com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException(mue); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
501 |
} catch (java.io.IOException ioe) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
502 |
throw new com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException(ioe); |
12005 | 503 |
} |
504 |
} |
|
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
505 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
506 |
EncodingInfo findEncoding(String normalizedEncoding) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
507 |
EncodingInfo info = _encodingTableKeyJava.get(normalizedEncoding); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
508 |
if (info == null) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
509 |
info = _encodingTableKeyMime.get(normalizedEncoding); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
510 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
511 |
if (info == null) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
512 |
info = _encodingDynamicTable.get(normalizedEncoding); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
513 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
514 |
return info; |
12005 | 515 |
} |
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
516 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
517 |
EncodingInfo getEncodingFromMimeKey(String normalizedMimeName) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
518 |
return _encodingTableKeyMime.get(normalizedMimeName); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
519 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
520 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
521 |
EncodingInfo getEncodingFromJavaKey(String normalizedJavaName) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
522 |
return _encodingTableKeyJava.get(normalizedJavaName); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
523 |
} |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
524 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
525 |
void putEncoding(String key, EncodingInfo info) { |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
526 |
_encodingDynamicTable.put(key, info); |
12005 | 527 |
} |
528 |
} |
|
529 |
||
530 |
/** |
|
531 |
* Return true if the character is the high member of a surrogate pair. |
|
532 |
* <p> |
|
533 |
* This is not a public API. |
|
534 |
* @param ch the character to test |
|
535 |
* @xsl.usage internal |
|
536 |
*/ |
|
537 |
static boolean isHighUTF16Surrogate(char ch) { |
|
538 |
return ('\uD800' <= ch && ch <= '\uDBFF'); |
|
539 |
} |
|
540 |
/** |
|
541 |
* Return true if the character is the low member of a surrogate pair. |
|
542 |
* <p> |
|
543 |
* This is not a public API. |
|
544 |
* @param ch the character to test |
|
545 |
* @xsl.usage internal |
|
546 |
*/ |
|
547 |
static boolean isLowUTF16Surrogate(char ch) { |
|
548 |
return ('\uDC00' <= ch && ch <= '\uDFFF'); |
|
549 |
} |
|
550 |
/** |
|
551 |
* Return the unicode code point represented by the high/low surrogate pair. |
|
552 |
* <p> |
|
553 |
* This is not a public API. |
|
554 |
* @param highSurrogate the high char of the high/low pair |
|
555 |
* @param lowSurrogate the low char of the high/low pair |
|
556 |
* @xsl.usage internal |
|
557 |
*/ |
|
558 |
static int toCodePoint(char highSurrogate, char lowSurrogate) { |
|
559 |
int codePoint = |
|
560 |
((highSurrogate - 0xd800) << 10) |
|
561 |
+ (lowSurrogate - 0xdc00) |
|
562 |
+ 0x10000; |
|
563 |
return codePoint; |
|
564 |
} |
|
565 |
/** |
|
566 |
* Return the unicode code point represented by the char. |
|
567 |
* A bit of a dummy method, since all it does is return the char, |
|
568 |
* but as an int value. |
|
569 |
* <p> |
|
570 |
* This is not a public API. |
|
571 |
* @param ch the char. |
|
572 |
* @xsl.usage internal |
|
573 |
*/ |
|
574 |
static int toCodePoint(char ch) { |
|
575 |
int codePoint = ch; |
|
576 |
return codePoint; |
|
577 |
} |
|
578 |
||
17533
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
579 |
private final static EncodingInfos _encodingInfos = new EncodingInfos(); |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
580 |
|
12005 | 581 |
} |