geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r539369 - /geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java
Date Fri, 18 May 2007 10:28:11 GMT
Author: dblevins
Date: Fri May 18 03:28:10 2007
New Revision: 539369

URL: http://svn.apache.org/viewvc?view=rev&rev=539369
Log:
In case a descriptor cannot be unmarshalled, write it to the temp directory for debugging
purposes.

Modified:
    geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java

Modified: geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java?view=diff&rev=539369&r1=539368&r2=539369
==============================================================================
--- geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java
(original)
+++ geronimo/server/trunk/modules/geronimo-openejb-builder/src/main/java/org/apache/geronimo/openejb/deployment/XmlUtil.java
Fri May 18 03:28:10 2007
@@ -37,6 +37,7 @@
 import org.apache.openejb.jee.oejb2.EnvironmentType;
 import org.apache.openejb.jee.oejb2.GeronimoEjbJarType;
 import org.apache.openejb.jee.oejb2.ImportType;
+import org.apache.openejb.jee.oejb2.JaxbOpenejbJar2;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlDocumentProperties;
 import org.apache.xmlbeans.XmlException;
@@ -49,6 +50,10 @@
 import javax.xml.bind.ValidationEvent;
 import javax.xml.namespace.QName;
 import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
 
 public final class XmlUtil {
     public static final QName OPENEJBJAR_QNAME = OpenejbEjbJarDocument.type.getDocumentElementName();
@@ -123,8 +128,21 @@
 
             OpenejbGeronimoEjbJarType geronimoOpenejb = (OpenejbGeronimoEjbJarType) SchemaConversionUtils.fixGeronimoSchema(xmlObject,
OPENEJBJAR_QNAME, OpenejbGeronimoEjbJarType.type);
             return geronimoOpenejb;
-        } catch (XmlException e) {
-            throw new DeploymentException("Error parsing geronimo-openejb.xml", e);
+        } catch (Throwable e) {
+            String filePath = "<error: could not be written>";
+            try {
+                File tempFile = File.createTempFile("openejb-jar-", ".xml");
+                try {
+                    FileOutputStream out = new FileOutputStream(tempFile);
+                    out.write(xml.getBytes());
+                    out.close();
+                } catch (Exception weTried) {
+                }
+                filePath = tempFile.getAbsolutePath();
+            } catch (IOException notImportant) {
+            }
+
+            throw new DeploymentException("Error parsing geronimo-openejb.xml with xmlbeans.
 For debug purposes, XML content written to: "+filePath, e);
         }
     }
 



Mime
View raw message