Author: markt
Date: Sun Jan 19 18:54:47 2014
New Revision: 1559549

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

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java?rev=1559549&r1=1559548&r2=1559549&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/ELParser.java Sun Jan 19 
18:54:47 2014
@@ -101,7 +101,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() == '}') {
@@ -138,16 +138,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();
                         }
                     }
@@ -167,12 +167,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;
             }
@@ -230,10 +229,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)) {
@@ -288,6 +297,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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to