|
38 | 38 | */
|
39 | 39 | class ContextFinder {
|
40 | 40 |
|
41 |
| - /** |
42 |
| - * When JAXB is in J2SE, rt.jar has to have a JAXB implementation. |
43 |
| - * However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext |
44 |
| - * because if it has, it will take precedence over any file that applications have |
45 |
| - * in their jar files. |
46 |
| - * |
47 |
| - * <p> |
48 |
| - * When the user bundles his own JAXB implementation, we'd like to use it, and we |
49 |
| - * want the platform default to be used only when there's no other JAXB provider. |
50 |
| - * |
51 |
| - * <p> |
52 |
| - * For this reason, we have to hard-code the class name into the API. |
53 |
| - */ |
54 |
| - private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory"; |
55 |
| - |
56 | 41 | // previous value of JAXBContext.JAXB_CONTEXT_FACTORY, using also this to ensure backwards compatibility
|
57 | 42 | private static final String JAXB_CONTEXT_FACTORY_DEPRECATED = "javax.xml.bind.context.factory";
|
58 | 43 |
|
@@ -140,7 +125,7 @@ static JAXBContext newInstance(String contextPath,
|
140 | 125 | Map properties) throws JAXBException {
|
141 | 126 |
|
142 | 127 | try {
|
143 |
| - Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader); |
| 128 | + Class spFactory = ServiceLoaderUtil.safeLoadClass(className, ModuleUtil.DEFAULT_FACTORY_CLASS, classLoader); |
144 | 129 | return newInstance(contextPath, contextPathClasses, spFactory, classLoader, properties);
|
145 | 130 | } catch (ClassNotFoundException x) {
|
146 | 131 | throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), x);
|
@@ -242,7 +227,7 @@ static JAXBContext newInstance(Class[] classes, Map properties, String className
|
242 | 227 |
|
243 | 228 | Class spi;
|
244 | 229 | try {
|
245 |
| - spi = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, getContextClassLoader()); |
| 230 | + spi = ServiceLoaderUtil.safeLoadClass(className, ModuleUtil.DEFAULT_FACTORY_CLASS, getContextClassLoader()); |
246 | 231 | } catch (ClassNotFoundException e) {
|
247 | 232 | throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), e);
|
248 | 233 | }
|
@@ -330,7 +315,7 @@ static JAXBContext find(String factoryId,
|
330 | 315 |
|
331 | 316 | // else no provider found
|
332 | 317 | logger.fine("Trying to create the platform default provider");
|
333 |
| - return newInstance(contextPath, contextPathClasses, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties); |
| 318 | + return newInstance(contextPath, contextPathClasses, ModuleUtil.DEFAULT_FACTORY_CLASS, classLoader, properties); |
334 | 319 | }
|
335 | 320 |
|
336 | 321 | static JAXBContext find(Class<?>[] classes, Map<String, ?> properties) throws JAXBException {
|
@@ -387,7 +372,7 @@ static JAXBContext find(Class<?>[] classes, Map<String, ?> properties) throws JA
|
387 | 372 |
|
388 | 373 | // else no provider found
|
389 | 374 | logger.fine("Trying to create the platform default provider");
|
390 |
| - return newInstance(classes, properties, PLATFORM_DEFAULT_FACTORY_CLASS); |
| 375 | + return newInstance(classes, properties, ModuleUtil.DEFAULT_FACTORY_CLASS); |
391 | 376 | }
|
392 | 377 |
|
393 | 378 |
|
|
0 commit comments