Author: dblevins
Date: Thu Jun 19 12:12:05 2008
New Revision: 669660

URL: http://svn.apache.org/viewvc?rev=669660&view=rev
Log:
Squelch any NoClassDefFoundErrors on 
com.envoisolutions.sxc.jaxb.JAXBContextImpl.

Modified:
    
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JAXBContextFactory.java

Modified: 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JAXBContextFactory.java
URL: 
http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JAXBContextFactory.java?rev=669660&r1=669659&r2=669660&view=diff
==============================================================================
--- 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JAXBContextFactory.java
 (original)
+++ 
openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/JAXBContextFactory.java
 Thu Jun 19 12:12:05 2008
@@ -29,9 +29,7 @@
     public static JAXBContext newInstance(String s) throws JAXBException {
         if (useSXC) {
             try {
-                ClassLoader classLoader = 
Thread.currentThread().getContextClassLoader();
-                if (classLoader == null) classLoader = 
JAXBContextFactory.class.getClassLoader();
-                return 
com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(s, classLoader, 
Collections.singletonMap("com.envoisolutions.sxc.generate", "false"));
+                Sxc.newInstance(s);
             } catch (NoClassDefFoundError e) {
             }
         }
@@ -42,7 +40,7 @@
     public static JAXBContext newInstance(String s, ClassLoader classLoader) 
throws JAXBException {
         if (useSXC) {
             try {
-                return 
com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(s, classLoader, 
Collections.singletonMap("com.envoisolutions.sxc.generate", "false"));
+                return Sxc.newInstance(s, classLoader);
             } catch (NoClassDefFoundError e) {
             }
         }
@@ -53,10 +51,7 @@
     public static JAXBContext newInstance(String s, ClassLoader classLoader, 
Map<String, ?> properties) throws JAXBException {
         if (useSXC) {
             try {
-                if (properties == null) properties = new TreeMap<String, 
Object>();
-                // hack because intellij is being stupid
-                ((Map<String, Object>) 
properties).put("com.envoisolutions.sxc.generate", "false");
-                return 
com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(s, classLoader, 
properties);
+                return Sxc.newInstance(s, classLoader, properties);
             } catch (NoClassDefFoundError e) {
             }
         }
@@ -67,9 +62,7 @@
     public static JAXBContext newInstance(Class... classes) throws 
JAXBException {
         if (useSXC) {
             try {
-                JAXBContext jaxbContext = null;
-                jaxbContext = 
com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(classes, 
Collections.singletonMap("com.envoisolutions.sxc.generate", "false"));
-                return jaxbContext;
+                return Sxc.newInstance(classes);
             } catch (NoClassDefFoundError e) {
             }
         }
@@ -79,14 +72,44 @@
     public static JAXBContext newInstance(Class[] classes, Map<String, ?> 
properties) throws JAXBException {
         if (useSXC) {
             try {
-                if (properties == null) properties = new TreeMap<String, 
Object>();
-                // hack because intellij is being stupid
-                ((Map<String, Object>) 
properties).put("com.envoisolutions.sxc.generate", "false");
-                return 
com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(classes, properties);
+                return Sxc.newInstance(classes, properties);
             } catch (NoClassDefFoundError e) {
             }
         }
 
         return JAXBContext.newInstance(classes, properties);
     }
+
+    public static class Sxc {
+        public static JAXBContext newInstance(String s) throws JAXBException {
+            ClassLoader classLoader = 
Thread.currentThread().getContextClassLoader();
+            if (classLoader == null) classLoader = 
JAXBContextFactory.class.getClassLoader();
+            return com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(s, 
classLoader, Collections.singletonMap("com.envoisolutions.sxc.generate", 
"false"));
+        }
+
+        public static JAXBContext newInstance(String s, ClassLoader 
classLoader) throws JAXBException {
+            return com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(s, 
classLoader, Collections.singletonMap("com.envoisolutions.sxc.generate", 
"false"));
+        }
+
+        public static JAXBContext newInstance(String s, ClassLoader 
classLoader, Map<String, ?> properties) throws JAXBException {
+            if (properties == null) properties = new TreeMap<String, Object>();
+            // hack because intellij is being stupid
+            ((Map<String, Object>) 
properties).put("com.envoisolutions.sxc.generate", "false");
+            return com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(s, 
classLoader, properties);
+        }
+
+        public static JAXBContext newInstance(Class... classes) throws 
JAXBException {
+            JAXBContext jaxbContext = null;
+            jaxbContext = 
com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(classes, 
Collections.singletonMap("com.envoisolutions.sxc.generate", "false"));
+            return jaxbContext;
+        }
+
+        public static JAXBContext newInstance(Class[] classes, Map<String, ?> 
properties) throws JAXBException {
+            if (properties == null) properties = new TreeMap<String, Object>();
+            // hack because intellij is being stupid
+            ((Map<String, Object>) 
properties).put("com.envoisolutions.sxc.generate", "false");
+            return 
com.envoisolutions.sxc.jaxb.JAXBContextImpl.newInstance(classes, properties);
+        }
+    }
+
 }


Reply via email to