Repository: tomee
Updated Branches:
  refs/heads/master a331811ec -> c9e7fcf5f


TOMEE-1899 ignore deny-uncovered-http-methods since we don't need it internally


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/c9e7fcf5
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/c9e7fcf5
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/c9e7fcf5

Branch: refs/heads/master
Commit: c9e7fcf5fb55dbc7106121454deba28bc856a6f6
Parents: a331811
Author: Romain manni-Bucau <rmannibu...@gmail.com>
Authored: Thu Aug 11 09:21:32 2016 +0200
Committer: Romain manni-Bucau <rmannibu...@gmail.com>
Committed: Thu Aug 11 09:21:32 2016 +0200

----------------------------------------------------------------------
 .../apache/openejb/config/ReadDescriptors.java  |  2 +-
 .../jee/servlet31/DontFailOnUnusedTagTest.java  | 36 ++++++++++++++++++++
 .../src/test/resources/webxml31.xml             | 32 +++++++++++++++++
 .../org/apache/openejb/jee/TldTaglib$JAXB.java  |  4 +--
 .../org/apache/openejb/jee/WebApp$JAXB.java     |  6 ++--
 5 files changed, 74 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/c9e7fcf5/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
index e3c9b55..6bc52a8 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
@@ -825,7 +825,7 @@ public class ReadDescriptors implements DynamicDeployer {
     public static WebApp readWebApp(final URL url) throws OpenEJBException {
         final WebApp webApp;
         try {
-            webApp = (WebApp) WebXml.unmarshal(url);
+            webApp = WebXml.unmarshal(url);
         } catch (final SAXException e) {
             throw new OpenEJBException("Cannot parse the web.xml file: " + 
url.toExternalForm(), e);
         } catch (final JAXBException e) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/c9e7fcf5/container/openejb-core/src/test/java/org/apache/openejb/jee/servlet31/DontFailOnUnusedTagTest.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-core/src/test/java/org/apache/openejb/jee/servlet31/DontFailOnUnusedTagTest.java
 
b/container/openejb-core/src/test/java/org/apache/openejb/jee/servlet31/DontFailOnUnusedTagTest.java
new file mode 100644
index 0000000..85cf3a9
--- /dev/null
+++ 
b/container/openejb-core/src/test/java/org/apache/openejb/jee/servlet31/DontFailOnUnusedTagTest.java
@@ -0,0 +1,36 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.openejb.jee.servlet31;
+
+import org.apache.openejb.jee.WebApp;
+import org.apache.openejb.jee.WebApp$JAXB;
+import org.apache.openejb.sxc.Sxc;
+import org.junit.Test;
+
+import java.io.InputStream;
+
+import static org.junit.Assert.assertNotNull;
+
+public class DontFailOnUnusedTagTest {
+    @Test
+    public void run() throws Exception { // this test just validates we 
passthrough on unknown elements (tomcat will fail/warn)
+        try (final InputStream is = 
Thread.currentThread().getContextClassLoader().getResourceAsStream("webxml31.xml"))
 {
+            final WebApp web = Sxc.unmarshalJavaee(new WebApp$JAXB(), is);
+            assertNotNull(web.getAbsoluteOrdering());
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/c9e7fcf5/container/openejb-core/src/test/resources/webxml31.xml
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/resources/webxml31.xml 
b/container/openejb-core/src/test/resources/webxml31.xml
new file mode 100644
index 0000000..ff00301
--- /dev/null
+++ b/container/openejb-core/src/test/resources/webxml31.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+
+    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.
+-->
+<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
+                http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd";
+         version="3.1">
+  <!-- servicelet 3.0 -->
+  <absolute-ordering>
+    <name>a</name>
+    <others />
+    <name>b</name>
+  </absolute-ordering>
+  <!-- servilet 3.1 -->
+  <deny-uncovered-http-methods />
+</web-app>

http://git-wip-us.apache.org/repos/asf/tomee/blob/c9e7fcf5/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java
 
b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java
index 2db9b59..2ebead5 100644
--- 
a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java
+++ 
b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/TldTaglib$JAXB.java
@@ -263,9 +263,9 @@ public class TldTaglib$JAXB
                     }
                 }
                 taglibExtension.add(taglibExtensionItem);
-            } else {
+            }/* else { // we are not the one responsible of the failure so 
don't fail
                 context.unexpectedElement(elementReader, new 
QName("http://java.sun.com/xml/ns/javaee";, "description"), new 
QName("http://java.sun.com/xml/ns/javaee";, "display-name"), new 
QName("http://java.sun.com/xml/ns/javaee";, "icon"), new 
QName("http://java.sun.com/xml/ns/javaee";, "tlib-version"), new 
QName("http://java.sun.com/xml/ns/javaee";, "jsp-version"), new 
QName("http://java.sun.com/xml/ns/javaee";, "short-name"), new 
QName("http://java.sun.com/xml/ns/javaee";, "uri"), new 
QName("http://java.sun.com/xml/ns/javaee";, "validator"), new 
QName("http://java.sun.com/xml/ns/javaee";, "listener"), new 
QName("http://java.sun.com/xml/ns/javaee";, "tag"), new 
QName("http://java.sun.com/xml/ns/javaee";, "tag-file"), new 
QName("http://java.sun.com/xml/ns/javaee";, "function"), new 
QName("http://java.sun.com/xml/ns/javaee";, "taglib-extension"));
-            }
+            }*/
         }
         if (descriptions != null) {
             try {

http://git-wip-us.apache.org/repos/asf/tomee/blob/c9e7fcf5/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java
----------------------------------------------------------------------
diff --git 
a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java
 
b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java
index dc02d93..f8781e3 100644
--- 
a/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java
+++ 
b/container/openejb-jee-accessors/src/main/java/org/apache/openejb/jee/WebApp$JAXB.java
@@ -609,9 +609,9 @@ public class WebApp$JAXB
                 }
 
                 webApp.moduleName = moduleName;
-            } else {
-                context.unexpectedElement(elementReader, new 
QName("http://java.sun.com/xml/ns/javaee";, "description"), new 
QName("http://java.sun.com/xml/ns/javaee";, "display-name"), new 
QName("http://java.sun.com/xml/ns/javaee";, "icon"), new 
QName("http://java.sun.com/xml/ns/javaee";, "distributable"), new 
QName("http://java.sun.com/xml/ns/javaee";, "context-param"), new 
QName("http://java.sun.com/xml/ns/javaee";, "filter"), new 
QName("http://java.sun.com/xml/ns/javaee";, "filter-mapping"), new 
QName("http://java.sun.com/xml/ns/javaee";, "listener"), new 
QName("http://java.sun.com/xml/ns/javaee";, "servlet"), new 
QName("http://java.sun.com/xml/ns/javaee";, "servlet-mapping"), new 
QName("http://java.sun.com/xml/ns/javaee";, "session-config"), new 
QName("http://java.sun.com/xml/ns/javaee";, "mime-mapping"), new 
QName("http://java.sun.com/xml/ns/javaee";, "welcome-file-list"), new 
QName("http://java.sun.com/xml/ns/javaee";, "error-page"), new 
QName("http://java.sun.com/xml/ns/javaee";, "taglib")
 , new QName("http://java.sun.com/xml/ns/javaee";, "jsp-config"), new 
QName("http://java.sun.com/xml/ns/javaee";, "security-constraint"), new 
QName("http://java.sun.com/xml/ns/javaee";, "login-config"), new 
QName("http://java.sun.com/xml/ns/javaee";, "security-role"), new 
QName("http://java.sun.com/xml/ns/javaee";, "locale-encoding-mapping-list"), new 
QName("http://java.sun.com/xml/ns/javaee";, "env-entry"), new 
QName("http://java.sun.com/xml/ns/javaee";, "ejb-ref"), new 
QName("http://java.sun.com/xml/ns/javaee";, "ejb-local-ref"), new 
QName("http://java.sun.com/xml/ns/javaee";, "service-ref"), new 
QName("http://java.sun.com/xml/ns/javaee";, "resource-ref"), new 
QName("http://java.sun.com/xml/ns/javaee";, "resource-env-ref"), new 
QName("http://java.sun.com/xml/ns/javaee";, "message-destination-ref"), new 
QName("http://java.sun.com/xml/ns/javaee";, "persistence-context-ref"), new 
QName("http://java.sun.com/xml/ns/javaee";, "persistence-unit-ref"), new 
QName("http://java.sun.com/xml/ns/javaee";, "pos
 t-construct"), new QName("http://java.sun.com/xml/ns/javaee";, "pre-destroy"), 
new QName("http://java.sun.com/xml/ns/javaee";, "message-destination"), new 
QName("http://java.sun.com/xml/ns/javaee";, "absolute-ordering"), new 
QName("http://java.sun.com/xml/ns/javaee";, "data-source"), new 
QName("http://java.sun.com/xml/ns/javaee";, "module-name"));
-            }
+            } /*
+            else not yet used so ignored, here will come servlet 3.1 elements 
we don't parse cause don't need yet
+            */
         }
         if (descriptions != null) {
             try {

Reply via email to