Author: markt Date: Wed Jul 30 13:46:32 2008 New Revision: 681199 URL: http://svn.apache.org/viewvc?rev=681199&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42943 Make sure nested element is inside <jsp:text> element before throwing exception.
Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml tomcat/current/tc5.5.x/STATUS.txt tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=681199&r1=681198&r2=681199&view=diff ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Wed Jul 30 13:46:32 2008 @@ -109,6 +109,10 @@ <bug>31257</bug>: Quote endorsed dirs if they contain a space. (markt) </fix> <fix> + <bug>42943</bug>: Make sure nested element is inside <jsp:text> + element before throwing exception. (markt) + </fix> + <fix> <bug>44877</bug>: Prevent collisions in tag pool names. (markt) </fix> </changelog> Modified: tomcat/current/tc5.5.x/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=681199&r1=681198&r2=681199&view=diff ============================================================================== --- tomcat/current/tc5.5.x/STATUS.txt (original) +++ tomcat/current/tc5.5.x/STATUS.txt Wed Jul 30 13:46:32 2008 @@ -94,13 +94,6 @@ +1: markt, yoavs -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42943 - Make sure nested element is inside <jsp:text> element before throwing - exception. - http://svn.apache.org/viewvc?rev=654640&view=rev - +1: markt, fhanik, yoavs - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=42899 When saving config from admin app, correctly handle case where old config file does not exist. Modified: tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java URL: http://svn.apache.org/viewvc/tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java?rev=681199&r1=681198&r2=681199&view=diff ============================================================================== --- tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java (original) +++ tomcat/jasper/tc5.5.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java Wed Jul 30 13:46:32 2008 @@ -276,8 +276,11 @@ return; } + String currentPrefix = getPrefix(current.getQName()); + // jsp:text must not have any subelements - if (JSP_URI.equals(uri) && TEXT_ACTION.equals(current.getLocalName())) { + if (JSP_URI.equals(uri) && TEXT_ACTION.equals(current.getLocalName()) + && "jsp".equals(currentPrefix)) { throw new SAXParseException( Localizer.getMessage("jsp.error.text.has_subelement"), locator); @@ -1172,11 +1175,7 @@ } } - String prefix = ""; - int colon = qName.indexOf(':'); - if (colon != -1) { - prefix = qName.substring(0, colon); - } + String prefix = getPrefix(qName); Node.CustomTag ret = null; if (tagInfo != null) { @@ -1361,9 +1360,8 @@ */ private void checkPrefix(String uri, String qName) { - int index = qName.indexOf(':'); - if (index != -1) { - String prefix = qName.substring(0, index); + String prefix = getPrefix(qName); + if (prefix.length() > 0) { pageInfo.addPrefix(prefix); if ("jsp".equals(prefix) && !JSP_URI.equals(uri)) { pageInfo.setIsJspPrefixHijacked(true); @@ -1371,6 +1369,14 @@ } } + private String getPrefix(String qName) { + int index = qName.indexOf(':'); + if (index != -1) { + return qName.substring(0, index); + } + return ""; + } + /* * Gets SAXParser. * --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]