You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2014/03/21 13:16:34 UTC

svn commit: r1579931 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/descriptor/LocalResolver.java webapps/docs/changelog.xml

Author: kkolinko
Date: Fri Mar 21 12:16:34 2014
New Revision: 1579931

URL: http://svn.apache.org/r1579931
Log:
Merged r1576288 from tomcat/trunk:
Add a work-around for XML documents (often TLDs) that only refer to JavaEE schemas by file name
Backport of markt's patch.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1576288

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java?rev=1579931&r1=1579930&r2=1579931&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/descriptor/LocalResolver.java Fri Mar 21 12:16:34 2014
@@ -37,6 +37,11 @@ public class LocalResolver implements En
     private static final StringManager sm =
             StringManager.getManager(Constants.PACKAGE_NAME);
 
+    private static final String[] JAVA_EE_NAMESPACES = {
+        XmlIdentifiers.JAVAEE_1_4_NS,
+        XmlIdentifiers.JAVAEE_5_NS };
+
+
     private final Map<String,String> publicIds;
     private final Map<String,String> systemIds;
     private final boolean blockExternal;
@@ -94,6 +99,18 @@ public class LocalResolver implements En
             return is;
         }
 
+        // Work-around for XML documents that use just the file name for the
+        // location to refer to a JavaEE schema
+        for (String javaEENamespace : JAVA_EE_NAMESPACES) {
+            String javaEESystemId = javaEENamespace + '/' + systemId;
+            resolved = systemIds.get(javaEESystemId);
+            if (resolved != null) {
+                InputSource is = new InputSource(resolved);
+                is.setPublicId(publicId);
+                return is;
+            }
+        }
+
         // Resolve the supplied systemId against the base
         URI systemUri;
         try {
@@ -133,6 +150,7 @@ public class LocalResolver implements En
                 return is;
             }
         }
+
         throw new FileNotFoundException(sm.getString("localResolver.unresolvedEntity",
                 name, publicId, systemId, base));
     }

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1579931&r1=1579930&r2=1579931&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Mar 21 12:16:34 2014
@@ -102,6 +102,11 @@
         Prevent user supplied XSLTs used by the DefaultServlet from defining
         external entities. (markt)
       </fix>
+      <add>
+        Add a work around for validating XML documents (often TLDs) that use
+        just the file name to refer to refer to the JavaEE schema on which they
+        are based. (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org