You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/01/25 18:11:48 UTC

svn commit: r615271 - in /geronimo/server/trunk/plugins: j2ee/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/ j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/ jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasp...

Author: gawor
Date: Fri Jan 25 09:11:47 2008
New Revision: 615271

URL: http://svn.apache.org/viewvc?rev=615271&view=rev
Log:
sometimes some elements were skipped during dtd->xsd translation causing validation errors (GERONIMO-3782)

Added:
    geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld   (with props)
    geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld   (with props)
Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml
    geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
    geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java?rev=615271&r1=615270&r2=615271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java Fri Jan 25 09:11:47 2008
@@ -22,11 +22,6 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.geronimo.xbeans.javaee.ApplicationClientDocument;
-import org.apache.geronimo.xbeans.javaee.ApplicationDocument;
-//import org.apache.geronimo.xbeans.javaee.ConnectorDocument;
-import org.apache.geronimo.xbeans.javaee.EjbJarDocument;
-import org.apache.geronimo.xbeans.javaee.WebAppDocument;
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.xmlbeans.SchemaType;
 import org.apache.xmlbeans.XmlCursor;
@@ -296,6 +291,18 @@
         moveElements("description", namespace, moveable, cursor);
         moveElements("validator-class", namespace, moveable, cursor);
         moveElements("init-param", namespace, moveable, cursor);
+        
+        cursor.toParent();
+        cursor.toFirstChild();
+        do {
+            String name = cursor.getName().getLocalPart();
+            if ("init-param".equals(name)) {
+                cursor.push();
+                cursor.toFirstChild();
+                convertToTldInitParam(namespace, cursor, moveable);
+                cursor.pop();
+            }
+        } while (cursor.toNextSibling());        
     }
 
     public static void convertToTldVariable(String namespace, XmlCursor cursor, XmlCursor moveable) {
@@ -315,18 +322,19 @@
         moveElements("resource-ref", namespace, moveable, cursor);
         moveElements("resource-env-ref", namespace, moveable, cursor);
         moveElements("message-destination-ref", namespace, moveable, cursor);
-        if (cursor.toPrevSibling()) {
-            do {
-                String name = cursor.getName().getLocalPart();
-                if ("env-entry".equals(name)) {
-                    cursor.push();
-                    cursor.toFirstChild();
-                    convertToDescriptionGroup(namespace, cursor, moveable);
-                    convertToEnvEntryGroup(namespace, cursor, moveable);
-                    cursor.pop();
-                }
-            } while (cursor.toPrevSibling());
-        }
+        
+        cursor.toParent();
+        cursor.toFirstChild();
+        do {
+            String name = cursor.getName().getLocalPart();            
+            if ("env-entry".equals(name)) {                
+                cursor.push();
+                cursor.toFirstChild();
+                convertToDescriptionGroup(namespace, cursor, moveable);
+                convertToEnvEntryGroup(namespace, cursor, moveable);
+                cursor.pop();
+            }
+        } while (cursor.toNextSibling());        
     }
 
     public static void convertToEnvEntryGroup(String namespace, XmlCursor cursor, XmlCursor moveable) {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml?rev=615271&r1=615270&r2=615271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml Fri Jan 25 09:11:47 2008
@@ -73,5 +73,22 @@
         <security-role-ref>securityroleref2</security-role-ref>
         <security-identity>me</security-identity>
     </session-bean>
+    
+    <session-bean>
+        <something>something</something>
+        <transaction-type>transactiontype</transaction-type>
+        <env-entry>
+            <description>description1</description>
+            <env-entry-name>env-entry-name1</env-entry-name>
+            <env-entry-type>env-entry-type1</env-entry-type>
+            <env-entry-value>env-entry-value1</env-entry-value>
+        </env-entry>
+        <env-entry>
+            <description>description2</description>
+            <env-entry-name>env-entry-name2</env-entry-name>
+            <env-entry-type>env-entry-type2</env-entry-type>
+            <env-entry-value>env-entry-value2</env-entry-value>
+        </env-entry>
+    </session-bean>
 
 </xml-fragment>

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml?rev=615271&r1=615270&r2=615271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml (original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml Fri Jan 25 09:11:47 2008
@@ -73,5 +73,22 @@
         <resource-env-ref>resourceenvref1</resource-env-ref>
         <resource-env-ref>resourceenvref2</resource-env-ref>
     </session-bean>
+    
+    <session-bean>
+        <something>something</something>
+        <transaction-type>transactiontype</transaction-type>
+        <env-entry>
+            <env-entry-type>env-entry-type1</env-entry-type>
+            <env-entry-name>env-entry-name1</env-entry-name>
+            <env-entry-value>env-entry-value1</env-entry-value>
+            <description>description1</description>
+        </env-entry>
+        <env-entry>
+            <env-entry-value>env-entry-value2</env-entry-value>
+            <env-entry-type>env-entry-type2</env-entry-type>
+            <env-entry-name>env-entry-name2</env-entry-name>
+            <description>description2</description>
+        </env-entry>
+    </session-bean>
 
 </xml-fragment>

Modified: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java?rev=615271&r1=615270&r2=615271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java (original)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java Fri Jan 25 09:11:47 2008
@@ -200,7 +200,9 @@
      * @throws DeploymentException if there's a problem finding a tld file
      */
     private List<URL> getTldFiles(WebAppType webApp, WebModule webModule) throws DeploymentException {
-        log.debug("getTldFiles( " + webApp.toString() + "," + webModule.getName() + " ): Entry");
+        if (log.isDebugEnabled()) {
+            log.debug("getTldFiles( " + webApp.toString() + "," + webModule.getName() + " ): Entry");
+        }
 
         List<URL> tldURLs = new ArrayList<URL>();
 
@@ -409,8 +411,10 @@
 
 
     private List<Class> getListenerClasses(WebAppType webApp, WebModule webModule, List<URL> urls, Set<String> listenerNames) throws DeploymentException {
-        log.debug("getListenerClasses( " + webApp.toString() + "," + '\n' +
-                webModule.getName() + " ): Entry");
+        if (log.isDebugEnabled()) {
+            log.debug("getListenerClasses( " + webApp.toString() + "," + '\n' +
+                      webModule.getName() + " ): Entry");
+        }
 
         // Get the classloader from the module's EARContext
         ClassLoader classLoader = webModule.getEarContext().getClassLoader();
@@ -420,7 +424,9 @@
             parseTldFile(url, classLoader, classes, listenerNames);
         }
 
-        log.debug("getListenerClasses() Exit: Classes[" + classes.size() + "]: " + classes.toString());
+        if (log.isDebugEnabled()) {
+            log.debug("getListenerClasses() Exit: Classes[" + classes.size() + "]: " + classes.toString());
+        }
         return classes;
     }
 
@@ -494,7 +500,9 @@
      * @throws XmlException if something goes horribly wrong
      */
     protected static TaglibDocument convertToTaglibSchema(XmlObject xmlObject) throws XmlException {
-        log.debug("convertToTaglibSchema( " + xmlObject.toString() + " ): Entry");
+        if (log.isDebugEnabled()) {
+            log.debug("convertToTaglibSchema( " + xmlObject.toString() + " ): Entry");
+        }
 
         XmlCursor cursor = xmlObject.newCursor();
         XmlCursor moveable = xmlObject.newCursor();
@@ -651,15 +659,6 @@
                         cursor.push();
                         cursor.toFirstChild();
                         SchemaConversionUtils.convertToTldValidator(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                        do {
-                            name = cursor.getName().getLocalPart();
-                            if ("init-param".equals(name)) {
-                                cursor.push();
-                                cursor.toFirstChild();
-                                SchemaConversionUtils.convertToTldInitParam(SchemaConversionUtils.JAVAEE_NAMESPACE, cursor, moveable);
-                                cursor.pop();
-                            }
-                        } while (cursor.toNextSibling());
                         cursor.pop();
                     }
                 } while (cursor.toNextSibling());
@@ -676,7 +675,9 @@
             } catch (XmlException e) {
                 log.warn("Invalid transformed taglib", e);
             }
-            log.debug("convertToTaglibSchema( " + result.toString() + " ): Exit 1");
+            if (log.isDebugEnabled()) { 
+                log.debug("convertToTaglibSchema( " + result.toString() + " ): Exit 1");
+            }
             return (TaglibDocument) result;
         }
         try {
@@ -684,7 +685,9 @@
         } catch (XmlException e) {
             log.warn("Invalid transformed taglib", e);
         }
-        log.debug("convertToTaglibSchema( " + xmlObject.toString() + " ): Exit 2");
+        if (log.isDebugEnabled()) { 
+            log.debug("convertToTaglibSchema( " + xmlObject.toString() + " ): Exit 2");
+        }
         return (TaglibDocument) xmlObject;
     }
 

Modified: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java?rev=615271&r1=615270&r2=615271&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java (original)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java Fri Jan 25 09:11:47 2008
@@ -115,6 +115,11 @@
         URL expectedXML = classLoader.getResource("1_2_dtd/taglib-reorder-expected-2.tld");
         parseAndCompare(srcXML, expectedXML);
     }
+    public void testTLD12Reorder_3() throws Exception {
+        URL srcXML = classLoader.getResource("1_2_dtd/taglib-reorder-src-3.tld");
+        URL expectedXML = classLoader.getResource("2_0_xsd/taglib-reorder-expected-3.tld");
+        parseAndCompare(srcXML, expectedXML);
+    }
     public void testTLD20Reorder_1() throws Exception {
         URL srcXML = classLoader.getResource("2_0_xsd/taglib-reorder-src-1.tld");
         URL expectedXML = classLoader.getResource("2_0_xsd/taglib-reorder-expected-1.tld");
@@ -125,7 +130,7 @@
         URL expectedXML = classLoader.getResource("2_0_xsd/taglib-reorder-expected-2.tld");
         parseAndCompare(srcXML, expectedXML);
     }
-
+    
 
     /**
      * Tests for missing TLD tags

Added: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld?rev=615271&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld (added)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld Fri Jan 25 09:11:47 2008
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE taglib
+  PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
+<taglib>
+ <description>Foo TagLib Description</description>
+ <tlib-version>1.0</tlib-version>
+ <short-name>Foo</short-name>
+ <uri>http://geronimo.apache.org</uri>
+
+ <validator>
+   <description>Validated description</description>
+   <validator-class>javax.servlet.FooClass</validator-class>
+
+   <init-param>
+     <param-name>param1</param-name>
+     <param-value>value1</param-value>
+     <description>param1-value-1 descrption</description>
+   </init-param>
+
+   <init-param>
+     <param-name>param2</param-name>
+     <param-value>value2</param-value>
+     <description>param2-value-2 descrption</description>
+   </init-param>
+
+ </validator>
+
+ <tag>
+   <description>Bar Description</description>
+   <name>Bar</name>
+   <tag-class>javax.servlet.BarTag</tag-class>
+   <body-content>empty</body-content>
+ </tag>
+
+</taglib>

Propchange: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld?rev=615271&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld (added)
+++ geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld Fri Jan 25 09:11:47 2008
@@ -0,0 +1,31 @@
+<taglib xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee">
+  <description>Foo TagLib Description</description>
+  <tlib-version>1.0</tlib-version>
+  <short-name>Foo</short-name>
+  <uri>http://geronimo.apache.org</uri>
+
+  <validator>
+    <description>Validated description</description>
+    <validator-class>javax.servlet.FooClass</validator-class>
+
+    <init-param>
+      <description>param1-value-1 descrption</description>
+      <param-name>param1</param-name>
+      <param-value>value1</param-value>
+    </init-param>
+
+    <init-param>
+      <description>param2-value-2 descrption</description>
+      <param-name>param2</param-name>
+      <param-value>value2</param-value>
+    </init-param>
+  </validator>
+
+  <tag>
+    <description>Bar Description</description>
+    <name>Bar</name>
+    <tag-class>javax.servlet.BarTag</tag-class>
+    <body-content>empty</body-content>
+  </tag>
+
+</taglib>

Propchange: geronimo/server/trunk/plugins/jasper/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld
------------------------------------------------------------------------------
    svn:eol-style = native