tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject svn commit: r331177 - /tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java
Date Mon, 07 Nov 2005 02:08:33 GMT
Author: billbarker
Date: Sun Nov  6 18:08:30 2005
New Revision: 331177

URL: http://svn.apache.org/viewcvs?rev=331177&view=rev
Log:
Allow xerces to know where the web.xml file is so that relative entities can be resolved.

Fix for Bug #37261

Modified:
    tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java

Modified: tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java
URL: http://svn.apache.org/viewcvs/tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java?rev=331177&r1=331176&r2=331177&view=diff
==============================================================================
--- tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java
(original)
+++ tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java
Sun Nov  6 18:08:30 2005
@@ -17,9 +17,9 @@
 package org.apache.jasper.compiler;
 
 import java.io.InputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.net.JarURLConnection;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.URLConnection;
@@ -31,6 +31,7 @@
 import java.util.StringTokenizer;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
+import org.xml.sax.InputSource;
 
 import javax.servlet.ServletContext;
 
@@ -265,10 +266,11 @@
             // Acquire input stream to web application deployment descriptor
             String altDDName = (String)ctxt.getAttribute(
                                                     Constants.ALT_DD_ATTR);
+            URL uri = null;
             if (altDDName != null) {
                 try {
-                    is = new FileInputStream(altDDName);
-                } catch (FileNotFoundException e) {
+                    uri = new URL(FILE_PROTOCOL+altDDName.replace('\\', '/'));
+                } catch (MalformedURLException e) {
                     if (log.isWarnEnabled()) {
                         log.warn(Localizer.getMessage(
                                             "jsp.error.internal.filenotfound",
@@ -276,25 +278,28 @@
                     }
                 }
             } else {
-                is = ctxt.getResourceAsStream(WEB_XML);
-                if (is == null && log.isWarnEnabled()) {
+                uri = ctxt.getResource(WEB_XML);
+                if (uri == null && log.isWarnEnabled()) {
                     log.warn(Localizer.getMessage(
                                             "jsp.error.internal.filenotfound",
                                             WEB_XML));
                 }
             }
 
-            if (is == null) {
+            if (uri == null) {
                 return;
             }
+	    is = uri.openStream();
+            InputSource ip = new InputSource(is);
+            ip.setSystemId(uri.toExternalForm()); 
 
             // Parse the web application deployment descriptor
             TreeNode webtld = null;
             // altDDName is the absolute path of the DD
             if (altDDName != null) {
-                webtld = new ParserUtils().parseXMLDocument(altDDName, is);
+                webtld = new ParserUtils().parseXMLDocument(altDDName, ip);
             } else {
-                webtld = new ParserUtils().parseXMLDocument(WEB_XML, is);
+                webtld = new ParserUtils().parseXMLDocument(WEB_XML, ip);
             }
 
             // Allow taglib to be an element of the root or jsp-config (JSP2.0)



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


Mime
View raw message