geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r966928 - /geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Date Fri, 23 Jul 2010 01:35:32 GMT
Author: gawor
Date: Fri Jul 23 01:35:31 2010
New Revision: 966928

URL: http://svn.apache.org/viewvc?rev=966928&view=rev
Log:
regression - return null if web.xml is not found and it's not a war file

Modified:
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=966928&r1=966927&r2=966928&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Fri Jul 23 01:35:31 2010
@@ -31,6 +31,8 @@ import java.util.Map;
 import java.util.jar.JarFile;
 
 import javax.servlet.Servlet;
+import javax.xml.bind.JAXBException;
+
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.Deployable;
 import org.apache.geronimo.deployment.DeployableBundle;
@@ -175,8 +177,7 @@ public class TomcatModuleBuilder extends
         } else {
             try {
                 specDD = JarUtils.readAll(specDDUrl);
-//                XmlObject parsed = XmlBeansUtil.parse(specDD);
-//                WebAppDocument webAppDoc = SchemaConversionUtils.convertToServletSchema(parsed);
+
                 InputStream in = specDDUrl.openStream();
                 try {
                     webApp = (WebApp) JaxbJavaee.unmarshalJavaee(WebApp.class, in);
@@ -238,27 +239,34 @@ public class TomcatModuleBuilder extends
             if (specDDUrl == null) {
                 specDDUrl = JarUtils.createJarURL(moduleFile, "WEB-INF/web.xml");
             }
-            if (specDDUrl == null) {
-                if (!moduleFile.getName().endsWith(".war")) {
-                    //not for us
-                    return null;
-                }
-                webApp = new WebApp();
-            } else {
-                // read in the entire specDD as a string, we need this for getDeploymentDescriptor
-                // on the J2ee management object
-                specDD = JarUtils.readAll(specDDUrl);
-                InputStream in = specDDUrl.openStream();
-                try {
-                    webApp = (WebApp) JaxbJavaee.unmarshalJavaee(WebApp.class, in);
-                } finally {
-                    in.close();
-                }
-            }
 
+            // read in the entire specDD as a string, we need this for getDeploymentDescriptor
+            // on the J2ee management object
+            specDD = JarUtils.readAll(specDDUrl);
+
+            // we found web.xml, if it won't parse that's an error.
+            InputStream in = specDDUrl.openStream();
+            try {
+                webApp = (WebApp) JaxbJavaee.unmarshalJavaee(WebApp.class, in);
+            } finally {
+                in.close();
+            }
 //            WebDeploymentValidationUtils.validateWebApp(webApp);
-        } catch (Exception e) {
+        } catch (JAXBException e) {
+            // Output the target path in the error to make it clearer to the user which webapp
+            // has the problem.  The targetPath is used, as moduleFile may have an unhelpful
+            // value such as C:\geronimo-1.1\var\temp\geronimo-deploymentUtil22826.tmpdir
             throw new DeploymentException("Error parsing web.xml for " + targetPath, e);
+        } catch (Exception e) {
+            if (!moduleFile.getName().endsWith(".war")) {
+                //not for us
+                return null;
+            }
+            //else ignore as jee5 allows optional spec dd for .war's
+        }
+        
+        if (webApp == null) {
+            webApp = new WebApp();
         }
 
         Deployable deployable = new DeployableJarFile(moduleFile);



Mime
View raw message