geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r531367 - in /geronimo/server/trunk/modules/geronimo-jasper-builder/src: main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java
Date Mon, 23 Apr 2007 07:54:15 GMT
Author: djencks
Date: Mon Apr 23 00:54:14 2007
New Revision: 531367

URL: http://svn.apache.org/viewvc?view=rev&rev=531367
Log:
GERONIMO-3109 handle dtd to schema conversion related to body-content element

Modified:
    geronimo/server/trunk/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
    geronimo/server/trunk/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java

Modified: geronimo/server/trunk/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java?view=diff&rev=531367&r1=531366&r2=531367
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
Mon Apr 23 00:54:14 2007
@@ -596,6 +596,7 @@
                         cursor.push();
                         cursor.toFirstChild();
                         SchemaConversionUtils.convertToDescriptionGroup(SchemaConversionUtils.JAVAEE_NAMESPACE,
cursor, moveable);
+                        boolean bodyContentFound = false;
                         do {
                             name = cursor.getName().getLocalPart();
                             if ("tagclass".equals(name)) {
@@ -606,6 +607,10 @@
                             }
                             if ("bodycontent".equals(name)) {
                                 cursor.setName(BODY_CONTENT);
+                                bodyContentFound = true;
+                            }
+                            if ("body-content".equals(name)) {
+                                bodyContentFound = true;
                             }
                             if ("attribute".equals(name)) {
                                 cursor.push();
@@ -625,8 +630,23 @@
                             }
                         } while (cursor.toNextSibling());
                         cursor.pop();
+                        if (!bodyContentFound) {
+                            //--------------------------------------------------------------
+                            // Handle the case where the <body-content> tag is missing.
We
+                            // are currently positioned directly after the <tag> attribute
+                            // (via the pop) so just insert the <body-content> tag
with the
+                            // default value. The tags will be properly ordered below.
+                            //--------------------------------------------------------------
+                            cursor.push();
+                            cursor.toFirstChild();
+                            cursor.insertElementWithText("body-content", SchemaConversionUtils.JAVAEE_NAMESPACE,
"scriptless");
+                            cursor.pop();
+                        }
                         // Do this conversion last after the other tags have been converted
+                        cursor.push();
+                        cursor.toFirstChild();
                         SchemaConversionUtils.convertToTldTag(SchemaConversionUtils.JAVAEE_NAMESPACE,
cursor, moveable);
+                        cursor.pop();
                     }
                     if ("validator".equals(name)) {
                         cursor.push();

Modified: geronimo/server/trunk/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java?view=diff&rev=531367&r1=531366&r2=531367
==============================================================================
--- geronimo/server/trunk/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java
(original)
+++ geronimo/server/trunk/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java
Mon Apr 23 00:54:14 2007
@@ -128,6 +128,21 @@
 
 
     /**
+     * Tests for missing TLD tags
+    */
+    public void testTLD11Missing() throws Exception {
+        URL srcXML = classLoader.getResource("1_1_dtd/taglib-missing-src.tld");
+        URL expectedXML = classLoader.getResource("1_1_dtd/taglib-missing-expected.tld");
+        parseAndCompare(srcXML, expectedXML);
+    }
+    public void testTLD12Missing() throws Exception {
+        URL srcXML = classLoader.getResource("1_2_dtd/taglib-missing-src.tld");
+        URL expectedXML = classLoader.getResource("1_1_dtd/taglib-missing-expected.tld");
+        parseAndCompare(srcXML, expectedXML);
+    }
+
+
+    /**
      * Common logic
      */
     private void parseAndCompare(URL srcXML, URL expectedXML) throws Exception {



Mime
View raw message