author | lana |
Fri, 23 Aug 2013 14:09:04 -0700 | |
changeset 19482 | 7b65cee32a84 |
parent 17264 | 3aff554ad461 |
permissions | -rw-r--r-- |
12005 | 1 |
/* |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
2 |
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
12005 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package javax.xml.parsers; |
|
27 |
||
28 |
import java.io.File; |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
29 |
import java.security.AccessController; |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
30 |
import java.security.PrivilegedAction; |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
31 |
import java.util.Iterator; |
12458 | 32 |
import java.util.Properties; |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
33 |
import java.util.ServiceConfigurationError; |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
34 |
import java.util.ServiceLoader; |
12005 | 35 |
|
36 |
/** |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
37 |
* <p>Implements pluggable Parsers.</p> |
12005 | 38 |
* |
39 |
* <p>This class is duplicated for each JAXP subpackage so keep it in |
|
40 |
* sync. It is package private for secure class loading.</p> |
|
41 |
* |
|
42 |
* @author Santiago.PericasGeertsen@sun.com |
|
12458 | 43 |
* @author Huizhe.Wang@oracle.com |
12005 | 44 |
*/ |
45 |
class FactoryFinder { |
|
16953 | 46 |
private static final String DEFAULT_PACKAGE = "com.sun.org.apache.xerces.internal"; |
12005 | 47 |
/** |
48 |
* Internal debug flag. |
|
49 |
*/ |
|
50 |
private static boolean debug = false; |
|
51 |
||
52 |
/** |
|
53 |
* Cache for properties in java.home/lib/jaxp.properties |
|
54 |
*/ |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
55 |
private static final Properties cacheProps = new Properties(); |
12005 | 56 |
|
57 |
/** |
|
58 |
* Flag indicating if properties from java.home/lib/jaxp.properties |
|
59 |
* have been cached. |
|
60 |
*/ |
|
12458 | 61 |
static volatile boolean firstTime = true; |
12005 | 62 |
|
63 |
/** |
|
64 |
* Security support class use to check access control before |
|
65 |
* getting certain system resources. |
|
66 |
*/ |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
67 |
private static final SecuritySupport ss = new SecuritySupport(); |
12005 | 68 |
|
69 |
// Define system property "jaxp.debug" to get output |
|
70 |
static { |
|
71 |
// Use try/catch block to support applets, which throws |
|
72 |
// SecurityException out of this code. |
|
73 |
try { |
|
74 |
String val = ss.getSystemProperty("jaxp.debug"); |
|
75 |
// Allow simply setting the prop to turn on debug |
|
76 |
debug = val != null && !"false".equals(val); |
|
77 |
} |
|
78 |
catch (SecurityException se) { |
|
79 |
debug = false; |
|
80 |
} |
|
81 |
} |
|
82 |
||
83 |
private static void dPrint(String msg) { |
|
84 |
if (debug) { |
|
85 |
System.err.println("JAXP: " + msg); |
|
86 |
} |
|
87 |
} |
|
88 |
||
89 |
/** |
|
90 |
* Attempt to load a class using the class loader supplied. If that fails |
|
91 |
* and fall back is enabled, the current (i.e. bootstrap) class loader is |
|
92 |
* tried. |
|
93 |
* |
|
94 |
* If the class loader supplied is <code>null</code>, first try using the |
|
95 |
* context class loader followed by the current (i.e. bootstrap) class |
|
96 |
* loader. |
|
12458 | 97 |
* |
98 |
* Use bootstrap classLoader if cl = null and useBSClsLoader is true |
|
12005 | 99 |
*/ |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
100 |
static private Class<?> getProviderClass(String className, ClassLoader cl, |
12458 | 101 |
boolean doFallback, boolean useBSClsLoader) throws ClassNotFoundException |
12005 | 102 |
{ |
103 |
try { |
|
104 |
if (cl == null) { |
|
12458 | 105 |
if (useBSClsLoader) { |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
106 |
return Class.forName(className, false, FactoryFinder.class.getClassLoader()); |
12458 | 107 |
} else { |
108 |
cl = ss.getContextClassLoader(); |
|
109 |
if (cl == null) { |
|
110 |
throw new ClassNotFoundException(); |
|
111 |
} |
|
112 |
else { |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
113 |
return Class.forName(className, false, cl); |
12458 | 114 |
} |
12005 | 115 |
} |
116 |
} |
|
117 |
else { |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
118 |
return Class.forName(className, false, cl); |
12005 | 119 |
} |
120 |
} |
|
121 |
catch (ClassNotFoundException e1) { |
|
122 |
if (doFallback) { |
|
123 |
// Use current class loader - should always be bootstrap CL |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
124 |
return Class.forName(className, false, FactoryFinder.class.getClassLoader()); |
12005 | 125 |
} |
126 |
else { |
|
127 |
throw e1; |
|
128 |
} |
|
129 |
} |
|
130 |
} |
|
131 |
||
132 |
/** |
|
133 |
* Create an instance of a class. Delegates to method |
|
134 |
* <code>getProviderClass()</code> in order to load the class. |
|
135 |
* |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
136 |
* @param type Base class / Service interface of the factory to |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
137 |
* instantiate. |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
138 |
* |
12005 | 139 |
* @param className Name of the concrete class corresponding to the |
140 |
* service provider |
|
141 |
* |
|
12458 | 142 |
* @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code> |
143 |
* current <code>Thread</code>'s context classLoader is used to load the factory class. |
|
12005 | 144 |
* |
145 |
* @param doFallback True if the current ClassLoader should be tried as |
|
146 |
* a fallback if the class is not found using cl |
|
147 |
*/ |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
148 |
static <T> T newInstance(Class<T> type, String className, ClassLoader cl, |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
149 |
boolean doFallback) |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
150 |
throws FactoryConfigurationError |
12005 | 151 |
{ |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
152 |
return newInstance(type, className, cl, doFallback, false); |
12458 | 153 |
} |
154 |
||
155 |
/** |
|
156 |
* Create an instance of a class. Delegates to method |
|
157 |
* <code>getProviderClass()</code> in order to load the class. |
|
158 |
* |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
159 |
* @param type Base class / Service interface of the factory to |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
160 |
* instantiate. |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
161 |
* |
12458 | 162 |
* @param className Name of the concrete class corresponding to the |
163 |
* service provider |
|
164 |
* |
|
165 |
* @param cl <code>ClassLoader</code> used to load the factory class. If <code>null</code> |
|
166 |
* current <code>Thread</code>'s context classLoader is used to load the factory class. |
|
167 |
* |
|
168 |
* @param doFallback True if the current ClassLoader should be tried as |
|
169 |
* a fallback if the class is not found using cl |
|
170 |
* |
|
171 |
* @param useBSClsLoader True if cl=null actually meant bootstrap classLoader. This parameter |
|
172 |
* is needed since DocumentBuilderFactory/SAXParserFactory defined null as context classLoader. |
|
173 |
*/ |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
174 |
static <T> T newInstance(Class<T> type, String className, ClassLoader cl, |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
175 |
boolean doFallback, boolean useBSClsLoader) |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
176 |
throws FactoryConfigurationError |
12458 | 177 |
{ |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
178 |
assert type != null; |
16953 | 179 |
// make sure we have access to restricted packages |
180 |
if (System.getSecurityManager() != null) { |
|
181 |
if (className != null && className.startsWith(DEFAULT_PACKAGE)) { |
|
182 |
cl = null; |
|
183 |
useBSClsLoader = true; |
|
184 |
} |
|
185 |
} |
|
186 |
||
12005 | 187 |
try { |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
188 |
Class<?> providerClass = getProviderClass(className, cl, doFallback, useBSClsLoader); |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
189 |
if (!type.isAssignableFrom(providerClass)) { |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
190 |
throw new ClassCastException(className + " cannot be cast to " + type.getName()); |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
191 |
} |
12005 | 192 |
Object instance = providerClass.newInstance(); |
193 |
if (debug) { // Extra check to avoid computing cl strings |
|
194 |
dPrint("created new instance of " + providerClass + |
|
195 |
" using ClassLoader: " + cl); |
|
196 |
} |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
197 |
return type.cast(instance); |
12005 | 198 |
} |
199 |
catch (ClassNotFoundException x) { |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
200 |
throw new FactoryConfigurationError(x, |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
201 |
"Provider " + className + " not found"); |
12005 | 202 |
} |
203 |
catch (Exception x) { |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
204 |
throw new FactoryConfigurationError(x, |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
205 |
"Provider " + className + " could not be instantiated: " + x); |
12005 | 206 |
} |
207 |
} |
|
208 |
||
209 |
/** |
|
210 |
* Finds the implementation Class object in the specified order. Main |
|
211 |
* entry point. |
|
212 |
* @return Class object of factory, never null |
|
213 |
* |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
214 |
* @param type Base class / Service interface of the |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
215 |
* factory to find. |
12005 | 216 |
* @param fallbackClassName Implementation class name, if nothing else |
217 |
* is found. Use null to mean no fallback. |
|
218 |
* |
|
219 |
* Package private so this code can be shared. |
|
220 |
*/ |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
221 |
static <T> T find(Class<T> type, String fallbackClassName) |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
222 |
throws FactoryConfigurationError |
12005 | 223 |
{ |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
224 |
final String factoryId = type.getName(); |
12005 | 225 |
dPrint("find factoryId =" + factoryId); |
226 |
||
227 |
// Use the system property first |
|
228 |
try { |
|
229 |
String systemProp = ss.getSystemProperty(factoryId); |
|
230 |
if (systemProp != null) { |
|
231 |
dPrint("found system property, value=" + systemProp); |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
232 |
return newInstance(type, systemProp, null, true); |
12005 | 233 |
} |
234 |
} |
|
235 |
catch (SecurityException se) { |
|
236 |
if (debug) se.printStackTrace(); |
|
237 |
} |
|
238 |
||
239 |
// try to read from $java.home/lib/jaxp.properties |
|
240 |
try { |
|
241 |
if (firstTime) { |
|
242 |
synchronized (cacheProps) { |
|
243 |
if (firstTime) { |
|
244 |
String configFile = ss.getSystemProperty("java.home") + File.separator + |
|
245 |
"lib" + File.separator + "jaxp.properties"; |
|
246 |
File f = new File(configFile); |
|
247 |
firstTime = false; |
|
248 |
if (ss.doesFileExist(f)) { |
|
249 |
dPrint("Read properties file "+f); |
|
250 |
cacheProps.load(ss.getFileInputStream(f)); |
|
251 |
} |
|
252 |
} |
|
253 |
} |
|
254 |
} |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
255 |
final String factoryClassName = cacheProps.getProperty(factoryId); |
12005 | 256 |
|
257 |
if (factoryClassName != null) { |
|
258 |
dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName); |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
259 |
return newInstance(type, factoryClassName, null, true); |
12005 | 260 |
} |
261 |
} |
|
262 |
catch (Exception ex) { |
|
263 |
if (debug) ex.printStackTrace(); |
|
264 |
} |
|
265 |
||
266 |
// Try Jar Service Provider Mechanism |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
267 |
T provider = findServiceProvider(type); |
12005 | 268 |
if (provider != null) { |
269 |
return provider; |
|
270 |
} |
|
271 |
if (fallbackClassName == null) { |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
272 |
throw new FactoryConfigurationError( |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
273 |
"Provider for " + factoryId + " cannot be found"); |
12005 | 274 |
} |
275 |
||
276 |
dPrint("loaded from fallback value: " + fallbackClassName); |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
277 |
return newInstance(type, fallbackClassName, null, true); |
12005 | 278 |
} |
279 |
||
280 |
/* |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
281 |
* Try to find provider using the ServiceLoader API |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
282 |
* |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
283 |
* @param type Base class / Service interface of the factory to find. |
12005 | 284 |
* |
285 |
* @return instance of provider class if found or null |
|
286 |
*/ |
|
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
287 |
private static <T> T findServiceProvider(final Class<T> type) { |
12005 | 288 |
try { |
17264
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
289 |
return AccessController.doPrivileged(new PrivilegedAction<T>() { |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
290 |
public T run() { |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
291 |
final ServiceLoader<T> serviceLoader = ServiceLoader.load(type); |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
292 |
final Iterator<T> iterator = serviceLoader.iterator(); |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
293 |
if (iterator.hasNext()) { |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
294 |
return iterator.next(); |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
295 |
} else { |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
296 |
return null; |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
297 |
} |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
298 |
} |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
299 |
}); |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
300 |
} catch(ServiceConfigurationError e) { |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
301 |
// It is not possible to wrap an error directly in |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
302 |
// FactoryConfigurationError - so we need to wrap the |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
303 |
// ServiceConfigurationError in a RuntimeException. |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
304 |
// The alternative would be to modify the logic in |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
305 |
// FactoryConfigurationError to allow setting a |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
306 |
// Throwable as the cause, but that could cause |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
307 |
// compatibility issues down the road. |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
308 |
final RuntimeException x = new RuntimeException( |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
309 |
"Provider for " + type + " cannot be created", e); |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
310 |
final FactoryConfigurationError error = |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
311 |
new FactoryConfigurationError(x, x.getMessage()); |
3aff554ad461
8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents:
16953
diff
changeset
|
312 |
throw error; |
12005 | 313 |
} |
314 |
} |
|
315 |
||
316 |
} |