ASF Bugzilla – Attachment 14546 Details for
Bug 34034
Jasper didn't respect external entities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Allow jasper to resolve external entities
jasper3.patch (text/plain), 4.16 KB, created by
Henri Gomez
on 2005-03-23 15:36:00 UTC
(
hide
)
Description:
Allow jasper to resolve external entities
Filename:
MIME Type:
Creator:
Henri Gomez
Created:
2005-03-23 15:36:00 UTC
Size:
4.16 KB
patch
obsolete
>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 >retrieving revision 1.17 >diff -u -r1.17 JspConfig.java >--- 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 >retrieving revision 1.12 >diff -u -r1.12 ParserUtils.java >--- 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 <code>TreeNode</code> >+ * 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 > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 34034
:
14517
| 14546