author | joehw |
Tue, 29 Jul 2014 20:52:36 -0700 | |
changeset 25834 | aba3efbf4ec5 |
parent 25264 | 040625ce9b72 |
permissions | -rw-r--r-- |
12005 | 1 |
/* |
2 |
* reserved comment block |
|
3 |
* DO NOT REMOVE OR ALTER! |
|
4 |
*/ |
|
5 |
/* |
|
6 |
* Copyright 1999-2004 The Apache Software Foundation. |
|
7 |
* |
|
8 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
9 |
* you may not use this file except in compliance with the License. |
|
10 |
* You may obtain a copy of the License at |
|
11 |
* |
|
12 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|
13 |
* |
|
14 |
* Unless required by applicable law or agreed to in writing, software |
|
15 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|
16 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
17 |
* See the License for the specific language governing permissions and |
|
18 |
* limitations under the License. |
|
19 |
*/ |
|
20 |
/* |
|
21 |
* $Id: Encodings.java,v 1.3 2005/09/28 13:49:04 pvedula Exp $ |
|
22 |
*/ |
|
23 |
package com.sun.org.apache.xml.internal.serializer; |
|
24 |
||
25 |
import java.io.InputStream; |
|
26 |
import java.io.OutputStream; |
|
27 |
import java.io.OutputStreamWriter; |
|
28 |
import java.io.UnsupportedEncodingException; |
|
29 |
import java.io.Writer; |
|
30 |
import java.io.BufferedWriter; |
|
31 |
import java.net.URL; |
|
32 |
import java.util.Enumeration; |
|
33 |
import java.util.HashMap; |
|
34 |
import java.util.Properties; |
|
35 |
import java.util.StringTokenizer; |
|
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
|
36 |
import java.io.IOException; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
37 |
import java.net.MalformedURLException; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
38 |
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
|
39 |
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
|
40 |
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
|
41 |
import java.util.Collections; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
42 |
import java.util.Map; |
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
43 |
import java.util.Map.Entry; |
12005 | 44 |
|
12458 | 45 |
import com.sun.org.apache.xalan.internal.utils.SecuritySupport; |
12005 | 46 |
|
47 |
/** |
|
48 |
* Provides information about encodings. Depends on the Java runtime |
|
49 |
* to provides writers for the different encodings, but can be used |
|
50 |
* to override encoding names and provide the last printable character |
|
51 |
* for each encoding. |
|
52 |
* |
|
53 |
* @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a> |
|
54 |
*/ |
|
55 |
||
56 |
public final class Encodings extends Object |
|
57 |
{ |
|
58 |
||
59 |
/** |
|
60 |
* The last printable character for unknown encodings. |
|
61 |
*/ |
|
62 |
private static final int m_defaultLastPrintable = 0x7F; |
|
63 |
||
64 |
/** |
|
65 |
* Standard filename for properties file with encodings data. |
|
66 |
*/ |
|
67 |
private static final String ENCODINGS_FILE = "com/sun/org/apache/xml/internal/serializer/Encodings.properties"; |
|
68 |
||
69 |
/** |
|
70 |
* Standard filename for properties file with encodings data. |
|
71 |
*/ |
|
72 |
private static final String ENCODINGS_PROP = "com.sun.org.apache.xalan.internal.serialize.encodings"; |
|
73 |
||
74 |
||
75 |
/** |
|
76 |
* Returns a writer for the specified encoding based on |
|
77 |
* an output stream. |
|
78 |
* |
|
79 |
* @param output The output stream |
|
80 |
* @param encoding The encoding |
|
81 |
* @return A suitable writer |
|
82 |
* @throws UnsupportedEncodingException There is no convertor |
|
83 |
* to support this encoding |
|
84 |
*/ |
|
85 |
static Writer getWriter(OutputStream output, String encoding) |
|
86 |
throws UnsupportedEncodingException |
|
87 |
{ |
|
88 |
||
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
|
89 |
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
|
90 |
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
|
91 |
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
|
92 |
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
|
93 |
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
|
94 |
} 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
|
95 |
// keep trying |
12005 | 96 |
} |
97 |
} |
|
98 |
||
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
|
99 |
return new BufferedWriter(new OutputStreamWriter(output, encoding)); |
12005 | 100 |
} |
101 |
||
102 |
||
103 |
/** |
|
104 |
* Returns the last printable character for an unspecified |
|
105 |
* encoding. |
|
106 |
* |
|
107 |
* @return the default size |
|
108 |
*/ |
|
109 |
public static int getLastPrintable() |
|
110 |
{ |
|
111 |
return m_defaultLastPrintable; |
|
112 |
} |
|
113 |
||
114 |
||
115 |
||
116 |
/** |
|
117 |
* Returns the EncodingInfo object for the specified |
|
118 |
* encoding. |
|
119 |
* <p> |
|
120 |
* This is not a public API. |
|
121 |
* |
|
122 |
* @param encoding The encoding |
|
123 |
* @return The object that is used to determine if |
|
124 |
* characters are in the given encoding. |
|
125 |
* @xsl.usage internal |
|
126 |
*/ |
|
127 |
static EncodingInfo getEncodingInfo(String encoding) |
|
128 |
{ |
|
129 |
EncodingInfo ei; |
|
130 |
||
131 |
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
|
132 |
ei = _encodingInfos.findEncoding(normalizedEncoding); |
12005 | 133 |
if (ei == null) { |
134 |
// 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
|
135 |
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
|
136 |
// 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
|
137 |
// 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
|
138 |
// (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
|
139 |
// 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
|
140 |
// 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
|
141 |
// 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
|
142 |
// 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
|
143 |
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
|
144 |
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
|
145 |
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
|
146 |
_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
|
147 |
} 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
|
148 |
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
|
149 |
} |
12005 | 150 |
} |
151 |
||
152 |
return ei; |
|
153 |
} |
|
154 |
||
155 |
/** |
|
25834
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
156 |
* 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
|
157 |
* serializer or not. |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
158 |
* |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
159 |
* @param encoding The encoding |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
160 |
* @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
|
161 |
*/ |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
162 |
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
|
163 |
{ |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
164 |
EncodingInfo ei; |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
165 |
|
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
166 |
String normalizedEncoding = toUpperCaseFast(encoding); |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
167 |
ei = _encodingInfos.findEncoding(normalizedEncoding); |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
168 |
if (ei != null) |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
169 |
return true; |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
170 |
return false; |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
171 |
} |
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
172 |
|
aba3efbf4ec5
8035467: Xerces Update: Move to Xalan based DOM L3 serializer. Deprecate Xerces' native serializer.
joehw
parents:
25264
diff
changeset
|
173 |
/** |
12005 | 174 |
* A fast and cheap way to uppercase a String that is |
175 |
* only made of printable ASCII characters. |
|
176 |
* <p> |
|
177 |
* This is not a public API. |
|
178 |
* @param s a String of ASCII characters |
|
179 |
* @return an uppercased version of the input String, |
|
180 |
* possibly the same String. |
|
181 |
* @xsl.usage internal |
|
182 |
*/ |
|
183 |
static private String toUpperCaseFast(final String s) { |
|
184 |
||
185 |
boolean different = false; |
|
186 |
final int mx = s.length(); |
|
187 |
char[] chars = new char[mx]; |
|
188 |
for (int i=0; i < mx; i++) { |
|
189 |
char ch = s.charAt(i); |
|
190 |
// is the character a lower case ASCII one? |
|
191 |
if ('a' <= ch && ch <= 'z') { |
|
192 |
// a cheap and fast way to uppercase that is good enough |
|
193 |
ch = (char) (ch + ('A' - 'a')); |
|
194 |
different = true; // the uppercased String is different |
|
195 |
} |
|
196 |
chars[i] = ch; |
|
197 |
} |
|
198 |
||
199 |
// A little optimization, don't call String.valueOf() if |
|
200 |
// the uppercased string is the same as the input string. |
|
201 |
final String upper; |
|
202 |
if (different) |
|
203 |
upper = String.valueOf(chars); |
|
204 |
else |
|
205 |
upper = s; |
|
206 |
||
207 |
return upper; |
|
208 |
} |
|
209 |
||
210 |
/** The default encoding, ISO style, ISO style. */ |
|
211 |
static final String DEFAULT_MIME_ENCODING = "UTF-8"; |
|
212 |
||
213 |
/** |
|
214 |
* Get the proper mime encoding. From the XSLT recommendation: "The encoding |
|
215 |
* attribute specifies the preferred encoding to use for outputting the result |
|
216 |
* tree. XSLT processors are required to respect values of UTF-8 and UTF-16. |
|
217 |
* For other values, if the XSLT processor does not support the specified |
|
218 |
* encoding it may signal an error; if it does not signal an error it should |
|
219 |
* use UTF-8 or UTF-16 instead. The XSLT processor must not use an encoding |
|
220 |
* whose name does not match the EncName production of the XML Recommendation |
|
221 |
* [XML]. If no encoding attribute is specified, then the XSLT processor should |
|
222 |
* use either UTF-8 or UTF-16." |
|
223 |
* |
|
224 |
* @param encoding Reference to java-style encoding string, which may be null, |
|
225 |
* in which case a default will be found. |
|
226 |
* |
|
227 |
* @return The ISO-style encoding string, or null if failure. |
|
228 |
*/ |
|
229 |
static String getMimeEncoding(String encoding) |
|
230 |
{ |
|
231 |
||
232 |
if (null == encoding) |
|
233 |
{ |
|
234 |
try |
|
235 |
{ |
|
236 |
||
237 |
// Get the default system character encoding. This may be |
|
238 |
// incorrect if they passed in a writer, but right now there |
|
239 |
// seems to be no way to get the encoding from a writer. |
|
16953 | 240 |
encoding = SecuritySupport.getSystemProperty("file.encoding", "UTF8"); |
12005 | 241 |
|
242 |
if (null != encoding) |
|
243 |
{ |
|
244 |
||
245 |
/* |
|
246 |
* See if the mime type is equal to UTF8. If you don't |
|
247 |
* do that, then convertJava2MimeEncoding will convert |
|
248 |
* 8859_1 to "ISO-8859-1", which is not what we want, |
|
249 |
* I think, and I don't think I want to alter the tables |
|
250 |
* to convert everything to UTF-8. |
|
251 |
*/ |
|
252 |
String jencoding = |
|
253 |
(encoding.equalsIgnoreCase("Cp1252") |
|
254 |
|| encoding.equalsIgnoreCase("ISO8859_1") |
|
255 |
|| encoding.equalsIgnoreCase("8859_1") |
|
256 |
|| encoding.equalsIgnoreCase("UTF8")) |
|
257 |
? DEFAULT_MIME_ENCODING |
|
258 |
: convertJava2MimeEncoding(encoding); |
|
259 |
||
260 |
encoding = |
|
261 |
(null != jencoding) ? jencoding : DEFAULT_MIME_ENCODING; |
|
262 |
} |
|
263 |
else |
|
264 |
{ |
|
265 |
encoding = DEFAULT_MIME_ENCODING; |
|
266 |
} |
|
267 |
} |
|
268 |
catch (SecurityException se) |
|
269 |
{ |
|
270 |
encoding = DEFAULT_MIME_ENCODING; |
|
271 |
} |
|
272 |
} |
|
273 |
else |
|
274 |
{ |
|
275 |
encoding = convertJava2MimeEncoding(encoding); |
|
276 |
} |
|
277 |
||
278 |
return encoding; |
|
279 |
} |
|
280 |
||
281 |
/** |
|
282 |
* Try the best we can to convert a Java encoding to a XML-style encoding. |
|
283 |
* |
|
284 |
* @param encoding non-null reference to encoding string, java style. |
|
285 |
* |
|
286 |
* @return ISO-style encoding string. |
|
287 |
*/ |
|
288 |
private static String convertJava2MimeEncoding(String encoding) |
|
289 |
{ |
|
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
|
290 |
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
|
291 |
_encodingInfos.getEncodingFromJavaKey(toUpperCaseFast(encoding)); |
12005 | 292 |
if (null != enc) |
293 |
return enc.name; |
|
294 |
return encoding; |
|
295 |
} |
|
296 |
||
297 |
/** |
|
298 |
* Try the best we can to convert a Java encoding to a XML-style encoding. |
|
299 |
* |
|
300 |
* @param encoding non-null reference to encoding string, java style. |
|
301 |
* |
|
302 |
* @return ISO-style encoding string. |
|
303 |
*/ |
|
304 |
public static String convertMime2JavaEncoding(String encoding) |
|
305 |
{ |
|
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
|
306 |
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
|
307 |
return info != null ? info.javaName : encoding; |
12005 | 308 |
} |
309 |
||
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
|
310 |
// 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
|
311 |
// 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
|
312 |
// |
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 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
|
314 |
// 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
|
315 |
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
|
316 |
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
|
317 |
// 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
|
318 |
// 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
|
319 |
// 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
|
320 |
// 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
|
321 |
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
|
322 |
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
|
323 |
|
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 |
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
|
325 |
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
|
326 |
} |
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 |
|
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 |
// 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
|
329 |
// 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
|
330 |
private InputStream openEncodingsFileStream() throws MalformedURLException, IOException { |
12005 | 331 |
String urlString = null; |
332 |
InputStream is = null; |
|
333 |
||
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 |
try { |
16953 | 335 |
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
|
336 |
} catch (SecurityException e) { |
12005 | 337 |
} |
338 |
||
339 |
if (urlString != null && urlString.length() > 0) { |
|
340 |
URL url = new URL(urlString); |
|
341 |
is = url.openStream(); |
|
342 |
} |
|
343 |
||
344 |
if (is == null) { |
|
12458 | 345 |
is = SecuritySupport.getResourceAsStream(ENCODINGS_FILE); |
12005 | 346 |
} |
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
|
347 |
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
|
348 |
} |
12005 | 349 |
|
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
|
350 |
// 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
|
351 |
// 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
|
352 |
// 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
|
353 |
private Properties loadProperties() throws MalformedURLException, IOException { |
12005 | 354 |
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
|
355 |
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
|
356 |
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
|
357 |
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
|
358 |
} 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
|
359 |
// 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
|
360 |
// 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
|
361 |
// 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
|
362 |
// 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
|
363 |
// 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
|
364 |
// 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
|
365 |
} |
12005 | 366 |
} |
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
|
367 |
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
|
368 |
} |
12005 | 369 |
|
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
|
370 |
// 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
|
371 |
// 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
|
372 |
// 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
|
373 |
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
|
374 |
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
|
375 |
//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
|
376 |
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
|
377 |
// 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
|
378 |
// "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
|
379 |
// 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
|
380 |
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
|
381 |
//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
|
382 |
} |
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 |
//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
|
384 |
// 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
|
385 |
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
|
386 |
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
|
387 |
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
|
388 |
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
|
389 |
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
|
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 |
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
|
392 |
} |
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 |
|
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 |
// 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
|
395 |
// 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
|
396 |
// 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 |
// 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
|
398 |
// 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
|
399 |
// 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
|
400 |
// 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
|
401 |
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
|
402 |
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
|
403 |
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
|
404 |
} 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
|
405 |
return null; |
12005 | 406 |
} |
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
|
407 |
} |
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 |
|
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 |
// 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
|
410 |
// 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
|
411 |
// 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
|
412 |
// 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
|
413 |
// 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
|
414 |
// 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
|
415 |
// 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
|
416 |
// 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
|
417 |
// 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
|
418 |
// 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
|
419 |
// 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
|
420 |
// |
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 |
// 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
|
422 |
// 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
|
423 |
// 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
|
424 |
// 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
|
425 |
// 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
|
426 |
// 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
|
427 |
// 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
|
428 |
// |
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 |
// 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
|
430 |
// 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
|
431 |
// 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
|
432 |
// |
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 |
// 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
|
434 |
// 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
|
435 |
// 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
|
436 |
// 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
|
437 |
// |
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 |
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
|
439 |
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
|
440 |
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
|
441 |
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
|
442 |
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
|
443 |
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
|
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 |
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
|
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 |
|
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 |
* 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
|
450 |
* |
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 |
* 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
|
452 |
* 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
|
453 |
* 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
|
454 |
*/ |
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 |
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
|
456 |
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
|
457 |
// 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
|
458 |
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
|
459 |
|
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 |
// 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
|
461 |
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
|
462 |
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
|
463 |
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
|
464 |
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
|
465 |
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
|
466 |
|
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 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
|
468 |
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
|
469 |
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
|
470 |
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
|
471 |
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
|
472 |
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
|
473 |
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
|
474 |
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
|
475 |
_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
|
476 |
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
|
477 |
// 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
|
478 |
// 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
|
479 |
// (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
|
480 |
// 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
|
481 |
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
|
482 |
_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
|
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 |
_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
|
485 |
} |
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 |
} 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
|
487 |
// 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
|
488 |
// recognized => this charset is not supported? |
12005 | 489 |
} |
490 |
} |
|
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
|
491 |
|
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 |
// 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
|
493 |
// 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
|
494 |
// (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
|
495 |
// 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
|
496 |
// 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
|
497 |
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
|
498 |
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
|
499 |
} |
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 |
|
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.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
|
502 |
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
|
503 |
} 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
|
504 |
throw new com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException(ioe); |
12005 | 505 |
} |
506 |
} |
|
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
|
507 |
|
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 |
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
|
509 |
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
|
510 |
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
|
511 |
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
|
512 |
} |
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 |
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
|
514 |
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
|
515 |
} |
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 |
return info; |
12005 | 517 |
} |
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
|
518 |
|
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 |
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
|
520 |
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
|
521 |
} |
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 |
|
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 |
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
|
524 |
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
|
525 |
} |
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 |
|
93a2cadbbd33
8008738: Issue in com.sun.org.apache.xml.internal.serializer.Encodings causes some JCK tests to fail intermittently
dfuchs
parents:
16953
diff
changeset
|
527 |
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
|
528 |
_encodingDynamicTable.put(key, info); |
12005 | 529 |
} |
530 |
} |
|
531 |
||
532 |
/** |
|
533 |
* Return true if the character is the high member of a surrogate pair. |
|
534 |
* <p> |
|
535 |
* This is not a public API. |
|
536 |
* @param ch the character to test |
|
537 |
* @xsl.usage internal |
|
538 |
*/ |
|
539 |
static boolean isHighUTF16Surrogate(char ch) { |
|
540 |
return ('\uD800' <= ch && ch <= '\uDBFF'); |
|
541 |
} |
|
542 |
/** |
|
543 |
* Return true if the character is the low member of a surrogate pair. |
|
544 |
* <p> |
|
545 |
* This is not a public API. |
|
546 |
* @param ch the character to test |
|
547 |
* @xsl.usage internal |
|
548 |
*/ |
|
549 |
static boolean isLowUTF16Surrogate(char ch) { |
|
550 |
return ('\uDC00' <= ch && ch <= '\uDFFF'); |
|
551 |
} |
|
552 |
/** |
|
553 |
* Return the unicode code point represented by the high/low surrogate pair. |
|
554 |
* <p> |
|
555 |
* This is not a public API. |
|
556 |
* @param highSurrogate the high char of the high/low pair |
|
557 |
* @param lowSurrogate the low char of the high/low pair |
|
558 |
* @xsl.usage internal |
|
559 |
*/ |
|
560 |
static int toCodePoint(char highSurrogate, char lowSurrogate) { |
|
561 |
int codePoint = |
|
562 |
((highSurrogate - 0xd800) << 10) |
|
563 |
+ (lowSurrogate - 0xdc00) |
|
564 |
+ 0x10000; |
|
565 |
return codePoint; |
|
566 |
} |
|
567 |
/** |
|
568 |
* Return the unicode code point represented by the char. |
|
569 |
* A bit of a dummy method, since all it does is return the char, |
|
570 |
* but as an int value. |
|
571 |
* <p> |
|
572 |
* This is not a public API. |
|
573 |
* @param ch the char. |
|
574 |
* @xsl.usage internal |
|
575 |
*/ |
|
576 |
static int toCodePoint(char ch) { |
|
577 |
int codePoint = ch; |
|
578 |
return codePoint; |
|
579 |
} |
|
580 |
||
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
|
581 |
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
|
582 |
|
12005 | 583 |
} |