Author: kkolinko Date: Fri May 16 18:31:33 2014 New Revision: 1595289 URL: http://svn.apache.org/r1595289 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56529 Review of r1595174: 1. Call iterator() once. It creates an object, so it is better do not waste such calls. 2. Style issues: - "" does not make sense as 'generic' default for textAttributeValue. It makes sense for this specific case only. - 3 spaces indent -> 4 spaces
Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Validator.java?rev=1595289&r1=1595288&r2=1595289&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/compiler/Validator.java (original) +++ tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Fri May 16 18:31:33 2014 @@ -1124,12 +1124,16 @@ class Validator { // When attribute is not an expression, // contains its textual value with \$ and \# escaping removed. - String textAttributeValue = ""; + String textAttributeValue; if (!elExpression && el != null) { // Should be a single Text node - if(el.iterator().hasNext()) { - textAttributeValue = ((ELNode.Text) el.iterator().next()).getText(); - } + Iterator<ELNode> it = el.iterator(); + if (it.hasNext()) { + textAttributeValue = ((ELNode.Text) it.next()) + .getText(); + } else { + textAttributeValue = ""; + } } else { textAttributeValue = xmlAttributeValue; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org