Index: jasper2/src/share/org/apache/jasper/compiler/JspConfig.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspConfig.java,v --- jasper2/src/share/org/apache/jasper/compiler/JspConfig.java 21 Mar 2005 15:38:12 -0000 1.17 +++ jasper2/src/share/org/apache/jasper/compiler/JspConfig.java 23 Mar 2005 14:33:16 -0000 @@ -19,8 +19,10 @@ import java.io.InputStream; import java.util.Iterator; import java.util.Vector; +import java.net.URL; import javax.servlet.ServletContext; +import org.xml.sax.InputSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -60,14 +62,19 @@ InputStream is = null; try { - is = ctxt.getResourceAsStream(WEB_XML); - if (is == null) { + URL uri = ctxt.getResource(WEB_XML); + if (uri == null) { // no web.xml return; } - ParserUtils pu = new ParserUtils(); - TreeNode webApp = pu.parseXMLDocument(WEB_XML, is); + is = uri.openStream(); + InputSource ip = new InputSource(is); + ip.setSystemId(uri.toExternalForm()); + + ParserUtils pu = new ParserUtils(); + TreeNode webApp = pu.parseXMLDocument(WEB_XML, ip); + if (webApp == null || !"2.4".equals(webApp.findAttribute("version"))) { defaultIsELIgnored = "true"; @@ -173,7 +180,8 @@ jspProperties.addElement(propertyGroup); } } - } finally { + } catch (Exception ex) { + throw new JasperException(ex); } finally { if (is != null) { try { is.close(); Index: jasper2/src/share/org/apache/jasper/xmlparser/ParserUtils.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/xmlparser/ParserUtils.java,v --- jasper2/src/share/org/apache/jasper/xmlparser/ParserUtils.java 21 Mar 2005 15:38:12 -0000 1.12 +++ jasper2/src/share/org/apache/jasper/xmlparser/ParserUtils.java 23 Mar 2005 14:33:16 -0000 @@ -73,12 +73,12 @@ * that corresponds to the root node of the document tree. * * @param uri URI of the XML document being parsed - * @param is Input stream containing the deployment descriptor + * @param ip Input source containing the deployment descriptor * * @exception JasperException if an input/output error occurs * @exception JasperException if a parsing error occurs */ - public TreeNode parseXMLDocument(String uri, InputStream is) + public TreeNode parseXMLDocument(String uri, InputSource ip) throws JasperException { Document document = null; @@ -92,7 +92,7 @@ DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(entityResolver); builder.setErrorHandler(errorHandler); - document = builder.parse(is); + document = builder.parse(ip); } catch (ParserConfigurationException ex) { throw new JasperException (Localizer.getMessage("jsp.error.parse.xml", uri), ex); @@ -116,6 +116,20 @@ } + /** + * Parse the specified XML document, and return a TreeNode + * that corresponds to the root node of the document tree. + * + * @param uri URI of the XML document being parsed + * @param is Input stream containing the deployment descriptor + * + * @exception JasperException if an input/output error occurs + * @exception JasperException if a parsing error occurs + */ + public TreeNode parseXMLDocument(String uri, InputStream is) + throws JasperException { + return (parseXMLDocument(uri, new InputSource(is))); + } // ------------------------------------------------------ Protected Methods