Author: markt Date: Thu May 15 13:58:54 2008 New Revision: 656833 URL: http://svn.apache.org/viewvc?rev=656833&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/tc6.0.x/trunk/STATUS.txt tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc6.0.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=656833&r1=656832&r2=656833&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/STATUS.txt (original) +++ tomcat/tc6.0.x/trunk/STATUS.txt Thu May 15 13:58:54 2008 @@ -57,13 +57,6 @@ +1: markt -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, remm, fhanik - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44988 Use new Java 5 syntax for debugger options Patch provided by Cedrik Lime Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=656833&r1=656832&r2=656833&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Thu May 15 13:58:54 2008 @@ -278,8 +278,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); @@ -1175,11 +1178,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) { @@ -1366,9 +1365,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); @@ -1376,6 +1374,14 @@ } } + private String getPrefix(String qName) { + int index = qName.indexOf(':'); + if (index != -1) { + return qName.substring(0, index); + } + return ""; + } + /* * Gets SAXParser. * Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=656833&r1=656832&r2=656833&view=diff ============================================================================== --- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Thu May 15 13:58:54 2008 @@ -220,6 +220,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>43617</bug>: Correctly escape attribute values in tag files. Based on a patch by Lucas Galfaso. (markt) </fix> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]