Author: violetagg Date: Mon May 26 10:00:25 2014 New Revision: 1597545 URL: http://svn.apache.org/r1597545 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56561 Merged revisions 1597532, 1597541 from tomcat/trunk: Fixed NoSuchElementException when an attribute has empty string as value.
Added: tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334and56561.jspx - copied, changed from r1597541, tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334.jspx Removed: tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334.jspx Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestParser.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Merged /tomcat/trunk:r1597532,1597541 Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java?rev=1597545&r1=1597544&r2=1597545&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/Validator.java Mon May 26 10:00:25 2014 @@ -1382,8 +1382,12 @@ class Validator { } else { // Get text with \$ and \# escaping removed. // Should be a single Text node - value = ((ELNode.Text) el.iterator().next()) - .getText(); + Iterator<ELNode> it = el.iterator(); + if (it.hasNext()) { + value = ((ELNode.Text) it.next()).getText(); + } else { + value = ""; + } el = null; } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestParser.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestParser.java?rev=1597545&r1=1597544&r2=1597545&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestParser.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/jasper/compiler/TestParser.java Mon May 26 10:00:25 2014 @@ -376,7 +376,7 @@ public class TestParser extends TomcatBa } @Test - public void testBug56334() throws Exception { + public void testBug56334And56561() throws Exception { Tomcat tomcat = getTomcatInstance(); File appDir = new File("test/webapp-3.0"); @@ -391,7 +391,7 @@ public class TestParser extends TomcatBa tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/bug5nnnn/bug56334.jspx"); + "/test/bug5nnnn/bug56334and56561.jspx"); String result = res.toString(); Copied: tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334and56561.jspx (from r1597541, tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334.jspx) URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334and56561.jspx?p2=tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334and56561.jspx&p1=tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334.jspx&r1=1597541&r2=1597545&rev=1597545&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334.jspx (original) +++ tomcat/tc7.0.x/trunk/test/webapp-3.0/bug5nnnn/bug56334and56561.jspx Mon May 26 10:00:25 2014 @@ -33,8 +33,9 @@ <set data-value="05a\$\${&" /> <set data-value="05b\$\${&${1+1}" /> <set data-value="05c\#\#{>${'hello'}<" /> + <set data-value="" /> <!-- Test 6: nonTaglibXmlnsAttributes on a Node.UninterpretedTag --> <set xmlns:foo="urn:06a\bar\baz" /> -</jsp:root> \ No newline at end of file +</jsp:root> Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1597545&r1=1597544&r2=1597545&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon May 26 10:00:25 2014 @@ -81,6 +81,14 @@ </fix> </changelog> </subsection> + <subsection name="Jasper"> + <changelog> + <fix> + <bug>56561</bug>: Avoid <code>NoSuchElementException</code> while handling + attributes with empty string value. (violetagg) + </fix> + </changelog> + </subsection> </section> <section name="Tomcat 7.0.54 (violetagg)" rtext="released 2014-05-22"> <subsection name="Catalina"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org