geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1142573 - in /geronimo/server/trunk/plugins: j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/ tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/
Date Mon, 04 Jul 2011 07:20:49 GMT
Author: rwonly
Date: Mon Jul  4 07:20:49 2011
New Revision: 1142573

URL: http://svn.apache.org/viewvc?rev=1142573&view=rev
Log:
GERONIMO-6024 use the identifySpecDDSchemaVersion to replace the new added method isSchemaDefined.

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java?rev=1142573&r1=1142572&r2=1142573&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-web-2.5-builder/src/main/java/org/apache/geronimo/web25/deployment/AbstractWebModuleBuilder.java
Mon Jul  4 07:20:49 2011
@@ -512,7 +512,7 @@ public abstract class AbstractWebModuleB
      * @param originalSpecDD text of original spec dd
      * @return spec dd version
      */
-    private float identifySpecDDSchemaVersion(String originalSpecDD) {
+    protected float identifySpecDDSchemaVersion(String originalSpecDD) {
         float schemaVersion = 0f;
         XmlCursor cursor = null;
         try {
@@ -548,7 +548,7 @@ public abstract class AbstractWebModuleB
         }
         return schemaVersion;
     }
-
+    
     protected ComponentPermissions buildSpecSecurityConfig(EARContext earContext, WebApp
webApp, Bundle bundle) {
         SpecSecurityBuilder builder = new SpecSecurityBuilder(new WebAppInfo());
         return builder.buildSpecSecurityConfig();

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=1142573&r1=1142572&r2=1142573&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
Mon Jul  4 07:20:49 2011
@@ -68,6 +68,7 @@ import org.apache.geronimo.kernel.Kernel
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.kernel.util.FileUtils;
+import org.apache.geronimo.kernel.util.IOUtils;
 import org.apache.geronimo.kernel.util.JarUtils;
 import org.apache.geronimo.naming.deployment.ENCConfigBuilder;
 import org.apache.geronimo.naming.deployment.GBeanResourceEnvironmentBuilder;
@@ -271,18 +272,6 @@ public class TomcatModuleBuilder extends
         }
         return module;
     }
-
-    private boolean isSchemaDefined(String xmlFile, String definedTag){
-        // we need remove the comments first
-        Pattern commentsPattern = Pattern.compile("<!--(.*)-->", Pattern.DOTALL);
-        Matcher commentsMatcher = commentsPattern.matcher(xmlFile);
-        
-        Pattern schemaPattern = Pattern.compile("<(\\w*:)?" + definedTag + "(.*)schemaLocation(.*)>",
Pattern.DOTALL);
-        Matcher schemaMatcher = schemaPattern.matcher(commentsMatcher.replaceAll(""));
-        
-        return schemaMatcher.find();
-
-    }
     
     protected Module createModule(Object plan, JarFile moduleFile, String targetPath, URL
specDDUrl, Environment earEnvironment, String contextRoot, Module parentModule, Naming naming,
ModuleIDBuilder idBuilder) throws DeploymentException {
         assert moduleFile != null : "moduleFile is null";
@@ -304,7 +293,7 @@ public class TomcatModuleBuilder extends
             InputStream in = null;
             
             // firstly validate the DD xml file, if it is defined by a schema.
-            if (isSchemaDefined(specDD, "web-app")){
+            if (identifySpecDDSchemaVersion(specDD) >= 2.4f){
                 in = specDDUrl.openStream();
                 try {
                     JaxbJavaee.validateJavaee(JavaeeSchema.WEB_APP_3_0, in);
@@ -312,7 +301,7 @@ public class TomcatModuleBuilder extends
                     throw new DeploymentException("Error validate web.xml for " + targetPath,
e);
                 } finally {
                     if (in != null)
-                        in.close();
+                        IOUtils.close(in);
                 }
             }
 
@@ -327,7 +316,7 @@ public class TomcatModuleBuilder extends
                 throw new DeploymentException("Error unmarshal web.xml for " + targetPath,
e);
             } finally {
                 if (in != null)
-                    in.close();
+                    IOUtils.close(in);
             }
 
         } catch (Exception e) {



Mime
View raw message