You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/01/19 20:04:56 UTC

svn commit: r1559553 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/jasper/compiler/ELParser.java

Author: markt
Date: Sun Jan 19 19:04:55 2014
New Revision: 1559553

URL: http://svn.apache.org/r1559553
Log:
Revert changes in r1559401 for this file.
The first attempt at a fix introduced a different regression

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1559549

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java?rev=1559553&r1=1559552&r2=1559553&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java Sun Jan 19 19:04:55 2014
@@ -103,7 +103,7 @@ public class ELParser {
 
         StringBuilder buf = new StringBuilder();
         ELexpr = new ELNode.Nodes();
-        while (hasNextChar()) {
+        while (hasNext()) {
             curToken = nextToken();
             if (curToken instanceof Char) {
                 if (curToken.toChar() == '}') {
@@ -140,16 +140,16 @@ public class ELParser {
         }
         String s1 = null; // Function prefix
         String s2 = curToken.toString(); // Function name
-        if (hasNextChar()) {
+        if (hasNext()) {
             int mark = getIndex();
             curToken = nextToken();
             if (curToken.toChar() == ':') {
-                if (hasNextChar()) {
+                if (hasNext()) {
                     Token t2 = nextToken();
                     if (t2 instanceof Id) {
                         s1 = s2;
                         s2 = t2.toString();
-                        if (hasNextChar()) {
+                        if (hasNext()) {
                             curToken = nextToken();
                         }
                     }
@@ -169,12 +169,11 @@ public class ELParser {
      * Test if an id is a reserved word in EL
      */
     private boolean isELReserved(String id) {
-        String trimmed = id.trim();
         int i = 0;
         int j = reservedWords.length;
         while (i < j) {
             int k = (i + j) / 2;
-            int result = reservedWords[k].compareTo(trimmed);
+            int result = reservedWords[k].compareTo(id);
             if (result == 0) {
                 return true;
             }
@@ -233,10 +232,20 @@ public class ELParser {
     }
 
     /*
+     * @return true if there is something left in EL expression buffer other
+     * than white spaces.
+     */
+    private boolean hasNext() {
+        skipSpaces();
+        return hasNextChar();
+    }
+
+    /*
      * @return The next token in the EL expression buffer.
      */
     private Token nextToken() {
         prevToken = curToken;
+        skipSpaces();
         if (hasNextChar()) {
             char ch = nextChar();
             if (Character.isJavaIdentifierStart(ch)) {
@@ -290,6 +299,14 @@ public class ELParser {
      * expression buffer.
      */
 
+    private void skipSpaces() {
+        while (hasNextChar()) {
+            if (expression.charAt(index) > ' ')
+                break;
+            index++;
+        }
+    }
+
     private boolean hasNextChar() {
         return index < expression.length();
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org