< prev index next >
src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java
Print this page
*** 180,189 ****
--- 180,192 ----
Class spFactory,
ClassLoader classLoader,
Map properties) throws JAXBException {
try {
+
+ ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, spFactory);
+
/*
* javax.xml.bind.context.factory points to a class which has a
* static method called 'createContext' that
* returns a javax.xml.JAXBContext.
*/
*** 213,224 ****
if (!(context instanceof JAXBContext)) {
// the cast would fail, so generate an exception with a nice message
throw handleClassCastException(context.getClass(), JAXBContext.class);
}
- ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, spFactory);
-
return (JAXBContext) context;
} catch (InvocationTargetException x) {
// throw if it is exception not to be wrapped
// otherwise, wrap with a JAXBException
Throwable e = handleInvocationTargetException(x);
--- 216,225 ----
*** 272,290 ****
static JAXBContext newInstance(Class[] classes,
Map properties,
Class spFactory) throws JAXBException {
try {
Method m = spFactory.getMethod("createContext", Class[].class, Map.class);
Object obj = instantiateProviderIfNecessary(spFactory);
Object context = m.invoke(obj, classes, properties);
if (!(context instanceof JAXBContext)) {
// the cast would fail, so generate an exception with a nice message
throw handleClassCastException(context.getClass(), JAXBContext.class);
}
- ModuleUtil.delegateAddOpensToImplModule(classes, spFactory);
return (JAXBContext) context;
} catch (NoSuchMethodException | IllegalAccessException e) {
throw new JAXBException(e);
} catch (InvocationTargetException e) {
--- 273,291 ----
static JAXBContext newInstance(Class[] classes,
Map properties,
Class spFactory) throws JAXBException {
try {
+ ModuleUtil.delegateAddOpensToImplModule(classes, spFactory);
Method m = spFactory.getMethod("createContext", Class[].class, Map.class);
Object obj = instantiateProviderIfNecessary(spFactory);
Object context = m.invoke(obj, classes, properties);
if (!(context instanceof JAXBContext)) {
// the cast would fail, so generate an exception with a nice message
throw handleClassCastException(context.getClass(), JAXBContext.class);
}
return (JAXBContext) context;
} catch (NoSuchMethodException | IllegalAccessException e) {
throw new JAXBException(e);
} catch (InvocationTargetException e) {
*** 326,338 ****
JAXBContextFactory obj = ServiceLoaderUtil.firstByServiceLoader(
JAXBContextFactory.class, logger, EXCEPTION_HANDLER);
if (obj != null) {
- JAXBContext context = obj.createContext(contextPath, classLoader, properties);
ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, obj.getClass());
! return context;
}
// to ensure backwards compatibility
factoryName = firstByServiceLoaderDeprecated(JAXBContext.class, classLoader);
if (factoryName != null) return newInstance(contextPath, contextPathClasses, factoryName, classLoader, properties);
--- 327,338 ----
JAXBContextFactory obj = ServiceLoaderUtil.firstByServiceLoader(
JAXBContextFactory.class, logger, EXCEPTION_HANDLER);
if (obj != null) {
ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, obj.getClass());
! return obj.createContext(contextPath, classLoader, properties);
}
// to ensure backwards compatibility
factoryName = firstByServiceLoaderDeprecated(JAXBContext.class, classLoader);
if (factoryName != null) return newInstance(contextPath, contextPathClasses, factoryName, classLoader, properties);
*** 383,395 ****
JAXBContextFactory factory =
ServiceLoaderUtil.firstByServiceLoader(JAXBContextFactory.class, logger, EXCEPTION_HANDLER);
if (factory != null) {
- JAXBContext context = factory.createContext(classes, properties);
ModuleUtil.delegateAddOpensToImplModule(classes, factory.getClass());
! return context;
}
// to ensure backwards compatibility
String className = firstByServiceLoaderDeprecated(JAXBContext.class, getContextClassLoader());
if (className != null) return newInstance(classes, properties, className);
--- 383,394 ----
JAXBContextFactory factory =
ServiceLoaderUtil.firstByServiceLoader(JAXBContextFactory.class, logger, EXCEPTION_HANDLER);
if (factory != null) {
ModuleUtil.delegateAddOpensToImplModule(classes, factory.getClass());
! return factory.createContext(classes, properties);
}
// to ensure backwards compatibility
String className = firstByServiceLoaderDeprecated(JAXBContext.class, getContextClassLoader());
if (className != null) return newInstance(classes, properties, className);
< prev index next >