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 19:53:33 UTC
svn commit: r615305 - in /geronimo/server/branches/2.0/modules:
geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/
geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/
geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deploym...
Author: gawor
Date: Fri Jan 25 10:53:30 2008
New Revision: 615305
URL: http://svn.apache.org/viewvc?rev=615305&view=rev
Log:
sometimes some elements were skipped during dtd->xsd translation causing validation errors (GERONIMO-3782)
Added:
geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld (with props)
geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld (with props)
Modified:
geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java
geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml
geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml
geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java
Modified: geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java?rev=615305&r1=615304&r2=615305&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/main/java/org/apache/geronimo/schema/SchemaConversionUtils.java Fri Jan 25 10:53:30 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,16 @@
moveElements("description", namespace, moveable, cursor);
moveElements("validator-class", namespace, moveable, cursor);
moveElements("init-param", namespace, moveable, cursor);
+
+ do {
+ String name = cursor.getName().getLocalPart();
+ if ("init-param".equals(name)) {
+ cursor.push();
+ cursor.toFirstChild();
+ convertToTldInitParam(namespace, cursor, moveable);
+ cursor.pop();
+ }
+ } while (cursor.toPrevSibling());
}
public static void convertToTldVariable(String namespace, XmlCursor cursor, XmlCursor moveable) {
@@ -308,25 +313,24 @@
moveElements("scope", namespace, moveable, cursor);
}
- public static void convertToJNDIEnvironmentRefsGroup(String namespace, XmlCursor cursor, XmlCursor moveable) {
+ public static void convertToJNDIEnvironmentRefsGroup(String namespace, XmlCursor cursor, XmlCursor moveable) {
moveElements("env-entry", namespace, moveable, cursor);
moveElements("ejb-ref", namespace, moveable, cursor);
moveElements("ejb-local-ref", namespace, moveable, cursor);
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());
- }
+
+ 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());
}
public static void convertToEnvEntryGroup(String namespace, XmlCursor cursor, XmlCursor moveable) {
Modified: geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml?rev=615305&r1=615304&r2=615305&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml (original)
+++ geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestExpected.xml Fri Jan 25 10:53:30 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/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml?rev=615305&r1=615304&r2=615305&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml (original)
+++ geronimo/server/branches/2.0/modules/geronimo-j2ee-schema/src/test/resources/j2ee_1_3dtd/JNDIEnvironmentRefsGroupTestSource.xml Fri Jan 25 10:53:30 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/branches/2.0/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java?rev=615305&r1=615304&r2=615305&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/main/java/org/apache/geronimo/jasper/deployment/JspModuleBuilderExtension.java Fri Jan 25 10:53:30 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/branches/2.0/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java?rev=615305&r1=615304&r2=615305&view=diff
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java (original)
+++ geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/java/org/apache/geronimo/jasper/deployment/SchemaConversionTest.java Fri Jan 25 10:53:30 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/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld?rev=615305&view=auto
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld (added)
+++ geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld Fri Jan 25 10:53:30 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!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/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/1_2_dtd/taglib-reorder-src-3.tld
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld?rev=615305&view=auto
==============================================================================
--- geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld (added)
+++ geronimo/server/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld Fri Jan 25 10:53:30 2008
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<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/branches/2.0/modules/geronimo-jasper-builder/src/test/resources/2_0_xsd/taglib-reorder-expected-3.tld
------------------------------------------------------------------------------
svn:eol-style = native