geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r712595 - in /geronimo/specs/trunk/geronimo-jaxb_2.1_spec: pom.xml src/main/java/javax/xml/bind/ContextFinder.java src/main/java/javax/xml/bind/JAXBException.java src/main/java/javax/xml/bind/TypeConstraintException.java
Date Mon, 10 Nov 2008 01:50:31 GMT
Author: gawor
Date: Sun Nov  9 17:50:31 2008
New Revision: 712595

URL: http://svn.apache.org/viewvc?rev=712595&view=rev
Log:
support jaxb 1.0 createContext() method and fix TypeConstraintException issues

Modified:
    geronimo/specs/trunk/geronimo-jaxb_2.1_spec/pom.xml
    geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/ContextFinder.java
    geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/JAXBException.java
    geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/TypeConstraintException.java

Modified: geronimo/specs/trunk/geronimo-jaxb_2.1_spec/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxb_2.1_spec/pom.xml?rev=712595&r1=712594&r2=712595&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxb_2.1_spec/pom.xml (original)
+++ geronimo/specs/trunk/geronimo-jaxb_2.1_spec/pom.xml Sun Nov  9 17:50:31 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.1</version>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 
     <scm>

Modified: geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/ContextFinder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/ContextFinder.java?rev=712595&r1=712594&r2=712595&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/ContextFinder.java
(original)
+++ geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/ContextFinder.java
Sun Nov  9 17:50:31 2008
@@ -57,6 +57,16 @@
         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);
         }

Modified: geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/JAXBException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/JAXBException.java?rev=712595&r1=712594&r2=712595&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/JAXBException.java
(original)
+++ geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/JAXBException.java
Sun Nov  9 17:50:31 2008
@@ -72,16 +72,4 @@
         return linkedException;
     }
 
-    public void printStackTrace() {
-        super.printStackTrace();
-    }
-
-    public void printStackTrace(PrintStream ps) {
-        super.printStackTrace(ps);
-    }
-
-    public void printStackTrace(PrintWriter pw) {
-        super.printStackTrace(pw);
-    }
-
 }

Modified: geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/TypeConstraintException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/TypeConstraintException.java?rev=712595&r1=712594&r2=712595&view=diff
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/TypeConstraintException.java
(original)
+++ geronimo/specs/trunk/geronimo-jaxb_2.1_spec/src/main/java/javax/xml/bind/TypeConstraintException.java
Sun Nov  9 17:50:31 2008
@@ -17,6 +17,7 @@
 package javax.xml.bind;
 
 import java.io.PrintStream;
+import java.io.PrintWriter;
 
 public class TypeConstraintException extends RuntimeException {
 
@@ -63,12 +64,39 @@
                 super.toString();
     }
 
-    public void printStackTrace() {
-        super.printStackTrace();
+    @Override
+    public Throwable getCause() {
+        return linkedException;
+    }
+
+    @Override
+    public void printStackTrace(PrintStream s) {
+        synchronized (s) {
+            s.println(this);
+            StackTraceElement[] trace = getStackTrace();
+            for (int i=0; i < trace.length; i++) {
+                s.println("\tat " + trace[i]);
+            }
+            Throwable ourCause = getCause();
+            if (ourCause != null) {
+                ourCause.printStackTrace(s);
+            }
+        }
+    }
+
+    @Override
+    public void printStackTrace(PrintWriter s) {
+        synchronized (s) {
+            s.println(this);
+            StackTraceElement[] trace = getStackTrace();
+            for (int i=0; i < trace.length; i++) {
+                s.println("\tat " + trace[i]);
+            }
+            Throwable ourCause = getCause();
+            if (ourCause != null) {
+                ourCause.printStackTrace(s);
+            }
+        }
     }
 
-    public void printStackTrace(PrintStream ps) {
-        super.printStackTrace(ps);
-    }
-
-}
\ No newline at end of file
+}



Mime
View raw message