You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/11/07 18:59:04 UTC
svn commit: r712211 - in /geronimo/specs/trunk/geronimo-jaxb_2.0_spec:
pom.xml src/main/java/javax/xml/bind/ContextFinder.java
Author: gawor
Date: Fri Nov 7 09:58:54 2008
New Revision: 712211
URL: http://svn.apache.org/viewvc?rev=712211&view=rev
Log:
support JAXB 1.0 createContext() method
Modified:
geronimo/specs/trunk/geronimo-jaxb_2.0_spec/pom.xml
geronimo/specs/trunk/geronimo-jaxb_2.0_spec/src/main/java/javax/xml/bind/ContextFinder.java
Modified: geronimo/specs/trunk/geronimo-jaxb_2.0_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxb_2.0_spec/pom.xml?rev=712211&r1=712210&r2=712211&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxb_2.0_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-jaxb_2.0_spec/pom.xml Fri Nov 7 09:58:54 2008
@@ -59,12 +59,6 @@
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.0</version>
- <scope>test</scope>
- </dependency>
</dependencies>
<scm>
Modified: geronimo/specs/trunk/geronimo-jaxb_2.0_spec/src/main/java/javax/xml/bind/ContextFinder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxb_2.0_spec/src/main/java/javax/xml/bind/ContextFinder.java?rev=712211&r1=712210&r2=712211&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxb_2.0_spec/src/main/java/javax/xml/bind/ContextFinder.java (original)
+++ geronimo/specs/trunk/geronimo-jaxb_2.0_spec/src/main/java/javax/xml/bind/ContextFinder.java Fri Nov 7 09:58:54 2008
@@ -54,9 +54,20 @@
className = PLATFORM_DEFAULT_FACTORY_CLASS;
}
Class spi = loadSpi(className, classLoader);
+
try {
Method m = spi.getMethod("createContext", new Class[] { String.class, ClassLoader.class, Map.class });
return (JAXBContext) m.invoke(null, new Object[] { contextPath, classLoader, properties });
+ } catch (NoSuchMethodException e) {
+ // will try JAXB 1.0 compatible createContext() method
+ } catch (Throwable t) {
+ throw new JAXBException("Unable to create context", t);
+ }
+
+ // try old JAXB 1.0 compatible createContext() method
+ try {
+ Method m = spi.getMethod("createContext", new Class[] { String.class, ClassLoader.class });
+ return (JAXBContext) m.invoke(null, new Object[] { contextPath, classLoader });
} catch (Throwable t) {
throw new JAXBException("Unable to create context", t);
}