Author: remm
Date: Tue Feb 21 02:57:35 2006
New Revision: 379417

URL: http://svn.apache.org/viewcvs?rev=379417&view=rev
Log:
- Wire the new EL inside Jasper.
- Remove dependency on commons-el.
- Temporary problem: this now requires a JSP 2.1 API binary to build.
- Small fixes in the EL.
- Submitted by Jacob Hookom.

Added:
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/el/
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/el/ELContextImpl.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/el/ELResolverImpl.java
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/el/ExpressionEvaluatorImpl.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/el/ExpressionImpl.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/el/FunctionMapperImpl.java
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/el/VariableResolverImpl.java
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/runtime/JspApplicationContextImpl.java
Modified:
    tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/Node.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/NodeVisitor.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/SimpleNode.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/el/util/MessageFactory.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/ELParser.java
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspUtil.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/Node.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/PageInfo.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/Parser.java
    tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/Validator.java
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/resources/LocalStrings.properties
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/runtime/JspContextWrapper.java
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/runtime/JspFactoryImpl.java
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/runtime/PageContextImpl.java
    
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/runtime/ProtectedFunctionMapper.java

Modified: 
tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java?rev=379417&r1=379416&r2=379417&view=diff
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java 
(original)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/lang/ExpressionBuilder.java 
Tue Feb 21 02:57:35 2006
@@ -133,7 +133,11 @@
        }
 
        private void prepare(Node node) throws ELException {
-               node.accept(this);
+        try {
+            node.accept(this);
+        } catch (Exception e) {
+            throw (ELException) e;
+        }
                if (this.fnMapper instanceof FunctionMapperFactory) {
                        this.fnMapper = ((FunctionMapperFactory) 
this.fnMapper).create();
                }

Modified: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/Node.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/Node.java?rev=379417&r1=379416&r2=379417&view=diff
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/Node.java (original)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/Node.java Tue Feb 21 
02:57:35 2006
@@ -64,7 +64,7 @@
   public void setValue(EvaluationContext ctx, Object value) throws ELException;
   public Class getType(EvaluationContext ctx) throws ELException;
   public boolean isReadOnly(EvaluationContext ctx) throws ELException;
-  public void accept(NodeVisitor visitor) throws ELException;
+  public void accept(NodeVisitor visitor) throws Exception;
   public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes) 
throws ELException;
   public Object invoke(EvaluationContext ctx, Class[] paramTypes, Object[] 
paramValues) throws ELException;
 }

Modified: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/NodeVisitor.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/NodeVisitor.java?rev=379417&r1=379416&r2=379417&view=diff
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/NodeVisitor.java 
(original)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/NodeVisitor.java Tue 
Feb 21 02:57:35 2006
@@ -15,12 +15,10 @@
  */
 package org.apache.el.parser;
 
-import javax.el.ELException;
-
 /**
  * @author Jacob Hookom [EMAIL PROTECTED]
  * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: dpatil $
  */
 public interface NodeVisitor {
-    public void visit(Node node) throws ELException;
+    public void visit(Node node) throws Exception;
 }

Modified: tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/SimpleNode.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/SimpleNode.java?rev=379417&r1=379416&r2=379417&view=diff
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/SimpleNode.java 
(original)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/parser/SimpleNode.java Tue 
Feb 21 02:57:35 2006
@@ -125,7 +125,7 @@
         throw new 
PropertyNotWritableException(MessageFactory.get("error.syntax.set"));
     }
 
-    public void accept(NodeVisitor visitor) throws ELException {
+    public void accept(NodeVisitor visitor) throws Exception {
         visitor.visit(this);
         if (this.children != null && this.children.length > 0) {
             for (int i = 0; i < this.children.length; i++) {

Modified: tomcat/jasper/tc6.0.x/src/share/org/apache/el/util/MessageFactory.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/el/util/MessageFactory.java?rev=379417&r1=379416&r2=379417&view=diff
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/el/util/MessageFactory.java 
(original)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/el/util/MessageFactory.java Tue 
Feb 21 02:57:35 2006
@@ -25,7 +25,7 @@
 public final class MessageFactory {
 
     protected final static ResourceBundle bundle = ResourceBundle
-            .getBundle("com.sun.el.Messages");
+            .getBundle("org.apache.el.Messages");
     /**
      * 
      */

Modified: 
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/ELParser.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/ELParser.java?rev=379417&r1=379416&r2=379417&view=diff
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/ELParser.java 
(original)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/ELParser.java 
Tue Feb 21 02:57:35 2006
@@ -18,124 +18,132 @@
 
 /**
  * This class implements a parser for EL expressions.
- *
- * It takes strings of the form xxx${..}yyy${..}zzz etc, and turn it into
- * a ELNode.Nodes.
- *
+ * 
+ * It takes strings of the form xxx${..}yyy${..}zzz etc, and turn it into a
+ * ELNode.Nodes.
+ * 
  * Currently, it only handles text outside ${..} and functions in ${ ..}.
- *
+ * 
  * @author Kin-man Chung
  */
 
 public class ELParser {
 
-    private Token curToken;    // current token
+    private Token curToken; // current token
+
     private ELNode.Nodes expr;
+
     private ELNode.Nodes ELexpr;
-    private int index;         // Current index of the expression
-    private String expression; // The EL expression
-    private boolean escapeBS;  // is '\' an escape char in text outside EL?
-
-    private static final String reservedWords[] = {
-        "and", "div", "empty", "eq", "false",
-        "ge", "gt", "instanceof", "le", "lt", "mod",
-        "ne", "not", "null", "or", "true"};
+
+    private int index; // Current index of the expression
+
+    private String expression; // The EL expression
+    
+    private char type;
+
+    private boolean escapeBS; // is '\' an escape char in text outside EL?
+
+    private static final String reservedWords[] = { "and", "div", "empty",
+            "eq", "false", "ge", "gt", "instanceof", "le", "lt", "mod", "ne",
+            "not", "null", "or", "true" };
 
     public ELParser(String expression) {
-       index = 0;
-       this.expression = expression;
-       expr = new ELNode.Nodes();
+        index = 0;
+        this.expression = expression;
+        expr = new ELNode.Nodes();
     }
 
     /**
      * Parse an EL expression
-     * @param expression The input expression string of the form
-     *                   Char* ('${' Char* '}')* Char*
+     * 
+     * @param expression
+     *            The input expression string of the form Char* ('${' Char*
+     *            '}')* Char*
      * @return Parsed EL expression in ELNode.Nodes
      */
     public static ELNode.Nodes parse(String expression) {
-       ELParser parser = new ELParser(expression);
-       while (parser.hasNextChar()) {
-           String text = parser.skipUntilEL();
-           if (text.length() > 0) {
-               parser.expr.add(new ELNode.Text(text));
-           }
-           ELNode.Nodes elexpr = parser.parseEL();
-           if (! elexpr.isEmpty()) {
-               parser.expr.add(new ELNode.Root(elexpr));
-           }
-       }
-       return parser.expr;
+        ELParser parser = new ELParser(expression);
+        while (parser.hasNextChar()) {
+            String text = parser.skipUntilEL();
+            if (text.length() > 0) {
+                parser.expr.add(new ELNode.Text(text));
+            }
+            ELNode.Nodes elexpr = parser.parseEL();
+            if (!elexpr.isEmpty()) {
+                parser.expr.add(new ELNode.Root(elexpr));
+            }
+        }
+        return parser.expr;
     }
 
     /**
      * Parse an EL expression string '${...}'
-     [EMAIL PROTECTED] An ELNode.Nodes representing the EL expression
-     * TODO: Currently only parsed into functions and text strings.  This
-     *       should be rewritten for a full parser.
+     * 
+     * @return An ELNode.Nodes representing the EL expression TODO: Currently
+     *         only parsed into functions and text strings. This should be
+     *         rewritten for a full parser.
      */
     private ELNode.Nodes parseEL() {
 
-       StringBuffer buf = new StringBuffer();
-       ELexpr = new ELNode.Nodes();
-       while (hasNext()) {
-           curToken = nextToken();
-           if (curToken instanceof Char) {
-               if (curToken.toChar() == '}') {
-                   break;
-               }
-               buf.append(curToken.toChar());
-           } else {
-               // Output whatever is in buffer
-               if (buf.length() > 0) {
-                   ELexpr.add(new ELNode.ELText(buf.toString()));
-               }
-               if (!parseFunction()) {
-                   ELexpr.add(new ELNode.ELText(curToken.toString()));
-               }
-           }
-       }
-       if (buf.length() > 0) {
-           ELexpr.add(new ELNode.ELText(buf.toString()));
-       }
+        StringBuffer buf = new StringBuffer();
+        ELexpr = new ELNode.Nodes();
+        while (hasNext()) {
+            curToken = nextToken();
+            if (curToken instanceof Char) {
+                if (curToken.toChar() == '}') {
+                    break;
+                }
+                buf.append(curToken.toChar());
+            } else {
+                // Output whatever is in buffer
+                if (buf.length() > 0) {
+                    ELexpr.add(new ELNode.ELText(buf.toString()));
+                }
+                if (!parseFunction()) {
+                    ELexpr.add(new ELNode.ELText(curToken.toString()));
+                }
+            }
+        }
+        if (buf.length() > 0) {
+            ELexpr.add(new ELNode.ELText(buf.toString()));
+        }
 
-       return ELexpr;
+        return ELexpr;
     }
 
     /**
-     * Parse for a function
-     * FunctionInvokation ::= (identifier ':')? identifier '('
-     *                       (Expression (,Expression)*)? ')'
-     * Note: currently we don't parse arguments
+     * Parse for a function FunctionInvokation ::= (identifier ':')? identifier
+     * '(' (Expression (,Expression)*)? ')' Note: currently we don't parse
+     * arguments
      */
     private boolean parseFunction() {
-       if (! (curToken instanceof Id) || isELReserved(curToken.toString())) {
-           return false;
-       }
-       String s1 = null;                 // Function prefix
-       String s2 = curToken.toString();  // Function name
-       int mark = getIndex();
-       if (hasNext()) {
-           Token t = nextToken();
-           if (t.toChar() == ':') {
-               if (hasNext()) {
-                   Token t2 = nextToken();
-                   if (t2 instanceof Id) {
-                       s1 = s2;
-                       s2 = t2.toString();
-                       if (hasNext()) {
-                           t = nextToken();
-                       }
-                   }
-               }
-           }
-           if (t.toChar() == '(') {
-               ELexpr.add(new ELNode.Function(s1, s2));
-               return true;
-           }
-       }
-       setIndex(mark);
-       return false;
+        if (!(curToken instanceof Id) || isELReserved(curToken.toString())) {
+            return false;
+        }
+        String s1 = null; // Function prefix
+        String s2 = curToken.toString(); // Function name
+        int mark = getIndex();
+        if (hasNext()) {
+            Token t = nextToken();
+            if (t.toChar() == ':') {
+                if (hasNext()) {
+                    Token t2 = nextToken();
+                    if (t2 instanceof Id) {
+                        s1 = s2;
+                        s2 = t2.toString();
+                        if (hasNext()) {
+                            t = nextToken();
+                        }
+                    }
+                }
+            }
+            if (t.toChar() == '(') {
+                ELexpr.add(new ELNode.Function(s1, s2));
+                return true;
+            }
+        }
+        setIndex(mark);
+        return false;
     }
 
     /**
@@ -145,13 +153,13 @@
         int i = 0;
         int j = reservedWords.length;
         while (i < j) {
-            int k = (i+j)/2;
+            int k = (i + j) / 2;
             int result = reservedWords[k].compareTo(id);
             if (result == 0) {
                 return true;
             }
             if (result < 0) {
-                i = k+1;
+                i = k + 1;
             } else {
                 j = k;
             }
@@ -160,79 +168,81 @@
     }
 
     /**
-     * Skip until an EL expression ('${') is reached, allowing escape sequences
-     * '\\' and '\$'.
+     * Skip until an EL expression ('${' || '#{') is reached, allowing escape
+     * sequences '\\' and '\$' and '\#'.
+     * 
      * @return The text string up to the EL expression
      */
     private String skipUntilEL() {
-       char prev = 0;
-       StringBuffer buf = new StringBuffer();
-       while (hasNextChar()) {
-           char ch = nextChar();
-           if (prev == '\\') {
-               prev = 0;
-               if (ch == '\\') {
-                   buf.append('\\');
-                   if (!escapeBS)
-                       prev = '\\';
-               } else if (ch == '$') {
-                   buf.append('$');
-               }
-               // else error!
-           } else if (prev == '$') {
-               if (ch == '{') {
-                   prev = 0;
-                   break;
-               } 
-               buf.append('$');
-               buf.append(ch);
-           } else if (ch == '\\' || ch == '$') {
-               prev = ch;
-           } else {
-               buf.append(ch);
-           }
-       }
-       if (prev != 0) {
-           buf.append(prev);
-       }
-       return buf.toString();
+        char prev = 0;
+        StringBuffer buf = new StringBuffer();
+        while (hasNextChar()) {
+            char ch = nextChar();
+            if (prev == '\\') {
+                prev = 0;
+                if (ch == '\\') {
+                    buf.append('\\');
+                    if (!escapeBS)
+                        prev = '\\';
+                } else if (ch == '$' || ch == '#') {
+                    buf.append(ch);
+                }
+                // else error!
+            } else if (prev == '$' || prev == '#') {
+                if (ch == '{') {
+                    this.type = prev;
+                    prev = 0;
+                    break;
+                }
+                buf.append(prev);
+            }
+            if (ch == '\\' || ch == '$' || ch == '#') {
+                prev = ch;
+            } else {
+                buf.append(ch);
+            }
+        }
+        if (prev != 0) {
+            buf.append(prev);
+        }
+        return buf.toString();
     }
 
     /*
      * @return true if there is something left in EL expression buffer other
-     *         than white spaces.
+     * than white spaces.
      */
     private boolean hasNext() {
-       skipSpaces();
-       return hasNextChar();
+        skipSpaces();
+        return hasNextChar();
     }
 
     /*
      * @return The next token in the EL expression buffer.
      */
     private Token nextToken() {
-       skipSpaces();
-       if (hasNextChar()) {
-           char ch = nextChar();
-           if (Character.isJavaIdentifierStart(ch)) {
-               StringBuffer buf = new StringBuffer();
-               buf.append(ch);
-               while ((ch = peekChar()) != -1 &&
-                               Character.isJavaIdentifierPart(ch)) {
-                   buf.append(ch);
-                   nextChar();
-               }
-               return new Id(buf.toString());
-           }
-
-           if (ch == '\'' || ch == '"') {
-               return parseQuotedChars(ch);
-           } else {
-               // For now...
-               return new Char(ch);
-           }
-       }
-       return null;
+        skipSpaces();
+        if (hasNextChar()) {
+            char ch = nextChar();
+            if (Character.isJavaIdentifierStart(ch)) {
+                StringBuffer buf = new StringBuffer();
+                buf.append(ch);
+                while ((ch = peekChar()) != -1
+                        && Character.isJavaIdentifierPart(ch)) {
+                    buf.append(ch);
+                    nextChar();
+                }
+                return new Id(buf.toString());
+            }
+
+            if (ch == '\'' || ch == '"') {
+                return parseQuotedChars(ch);
+            } else {
+                // For now...
+                return new Char(ch);
+            }
+        }
+        return null;
     }
 
     /*
@@ -240,63 +250,63 @@
      * '\\', and ('\"', or "\'")
      */
     private Token parseQuotedChars(char quote) {
-       StringBuffer buf = new StringBuffer();
-       buf.append(quote);
-       while (hasNextChar()) {
-           char ch = nextChar();
-           if (ch == '\\') {
-               ch = nextChar();
-               if (ch == '\\' || ch == quote) {
-                   buf.append(ch);
-               }
-               // else error!
-           } else if (ch == quote) {
-               buf.append(ch);
-               break;
-           } else {
-               buf.append(ch);
-           }
-       }
-       return new QuotedString(buf.toString());
+        StringBuffer buf = new StringBuffer();
+        buf.append(quote);
+        while (hasNextChar()) {
+            char ch = nextChar();
+            if (ch == '\\') {
+                ch = nextChar();
+                if (ch == '\\' || ch == quote) {
+                    buf.append(ch);
+                }
+                // else error!
+            } else if (ch == quote) {
+                buf.append(ch);
+                break;
+            } else {
+                buf.append(ch);
+            }
+        }
+        return new QuotedString(buf.toString());
     }
 
     /*
-     * A collection of low level parse methods dealing with character in
-     * the EL expression buffer.
+     * A collection of low level parse methods dealing with character in the EL
+     * expression buffer.
      */
 
     private void skipSpaces() {
-       while (hasNextChar()) {
-           if (expression.charAt(index) > ' ')
-               break;
-           index++;
-       }
+        while (hasNextChar()) {
+            if (expression.charAt(index) > ' ')
+                break;
+            index++;
+        }
     }
 
     private boolean hasNextChar() {
-       return index < expression.length();
+        return index < expression.length();
     }
 
     private char nextChar() {
-       if (index >= expression.length()) {
-           return (char)-1;
-       }
-       return expression.charAt(index++);
+        if (index >= expression.length()) {
+            return (char) -1;
+        }
+        return expression.charAt(index++);
     }
 
     private char peekChar() {
-       if (index >= expression.length()) {
-           return (char)-1;
-       }
-       return expression.charAt(index);
+        if (index >= expression.length()) {
+            return (char) -1;
+        }
+        return expression.charAt(index);
     }
 
     private int getIndex() {
-       return index;
+        return index;
     }
 
     private void setIndex(int i) {
-       index = i;
+        index = i;
     }
 
     /*
@@ -304,28 +314,28 @@
      */
     private static class Token {
 
-       char toChar() {
-           return 0;
-       }
-
-       public String toString() {
-           return "";
-       }
+        char toChar() {
+            return 0;
+        }
+
+        public String toString() {
+            return "";
+        }
     }
 
     /*
      * Represents an ID token in EL
      */
     private static class Id extends Token {
-       String id;
+        String id;
+
+        Id(String id) {
+            this.id = id;
+        }
 
-       Id(String id) {
-           this.id = id;
-       }
-
-       public String toString() {
-           return id;
-       }
+        public String toString() {
+            return id;
+        }
     }
 
     /*
@@ -333,19 +343,19 @@
      */
     private static class Char extends Token {
 
-       private char ch;
+        private char ch;
+
+        Char(char ch) {
+            this.ch = ch;
+        }
 
-       Char(char ch) {
-           this.ch = ch;
-       }
-
-       char toChar() {
-           return ch;
-       }
-
-       public String toString() {
-           return (new Character(ch)).toString();
-       }
+        char toChar() {
+            return ch;
+        }
+
+        public String toString() {
+            return (new Character(ch)).toString();
+        }
     }
 
     /*
@@ -353,15 +363,18 @@
      */
     private static class QuotedString extends Token {
 
-       private String value;
+        private String value;
 
-       QuotedString(String v) {
-           this.value = v;
-       }
-
-       public String toString() {
-           return value;
-       }
+        QuotedString(String v) {
+            this.value = v;
+        }
+
+        public String toString() {
+            return value;
+        }
     }
-}
 
+    public char getType() {
+        return type;
+    }
+}

Modified: 
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java?rev=379417&r1=379416&r2=379417&view=diff
==============================================================================
--- 
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java
 (original)
+++ 
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspDocumentParser.java
 Tue Feb 21 02:57:35 2006
@@ -508,7 +508,7 @@
             int column = startMark.getColumnNumber();
 
             CharArrayWriter ttext = new CharArrayWriter();
-            int lastCh = 0;
+            int lastCh = 0, elType = 0;
             for (int i = 0; i < charBuffer.length(); i++) {
 
                 int ch = charBuffer.charAt(i);
@@ -518,7 +518,8 @@
                 } else {
                     column++;
                 }
-                if (lastCh == '$' && ch == '{') {
+                if ((lastCh == '$' || lastCh == '#') && ch == '{') {
+                    elType = lastCh;
                     if (ttext.size() > 0) {
                         new Node.TemplateText(
                             ttext.toString(),
@@ -526,10 +527,10 @@
                             current);
                         ttext = new CharArrayWriter();
                         //We subtract two from the column number to
-                        //account for the '${' that we've already parsed
+                        //account for the '[$,#]{' that we've already parsed
                         startMark = new Mark(ctxt, path, line, column - 2);
                     }
-                    // following "${" to first unquoted "}"
+                    // following "${" || "#{" to first unquoted "}"
                     i++;
                     boolean singleQ = false;
                     boolean doubleQ = false;
@@ -539,7 +540,7 @@
                             throw new SAXParseException(
                                 Localizer.getMessage(
                                     "jsp.error.unterminated",
-                                    "${"),
+                                    (char) elType + "{"),
                                 locator);
 
                         }
@@ -556,7 +557,7 @@
                             continue;
                         }
                         if (ch == '}') {
-                            new Node.ELExpression(
+                            new Node.ELExpression((char) elType,
                                 ttext.toString(),
                                 startMark,
                                 current);
@@ -572,20 +573,20 @@
                         ttext.write(ch);
                         lastCh = ch;
                     }
-                } else if (lastCh == '\\' && ch == '$') {
-                    ttext.write('$');
+                } else if (lastCh == '\\' && (ch == '$' || ch == '#')) {
+                    ttext.write(ch);
                     ch = 0;  // Not start of EL anymore
                 } else {
-                    if (lastCh == '$' || lastCh == '\\') {
+                    if (lastCh == '$' || lastCh == '#' || lastCh == '\\') {
                         ttext.write(lastCh);
                     }
-                    if (ch != '$' && ch != '\\') {
+                    if (ch != '$' && ch != '#' && ch != '\\') {
                         ttext.write(ch);
                     }
                 }
                 lastCh = ch;
             }
-            if (lastCh == '$' || lastCh == '\\') {
+            if (lastCh == '$' || lastCh == '#' || lastCh == '\\') {
                 ttext.write(lastCh);
             }
             if (ttext.size() > 0) {

Modified: 
tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspUtil.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspUtil.java?rev=379417&r1=379416&r2=379417&view=diff
==============================================================================
--- tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspUtil.java 
(original)
+++ tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/JspUtil.java Tue 
Feb 21 02:57:35 2006
@@ -25,14 +25,17 @@
 import java.util.jar.JarFile;
 import java.util.zip.ZipEntry;
 
+import javax.el.FunctionMapper;
 import javax.servlet.jsp.el.ELException;
 import javax.servlet.jsp.el.ELParseException;
-import javax.servlet.jsp.el.FunctionMapper;
+import javax.servlet.jsp.el.ExpressionEvaluator;
 
-import org.apache.commons.el.ExpressionEvaluatorImpl;
+
+import org.apache.el.ExpressionFactoryImpl;
 import org.apache.jasper.Constants;
 import org.apache.jasper.JasperException;
 import org.apache.jasper.JspCompilationContext;
+import org.apache.jasper.el.ExpressionEvaluatorImpl;
 import org.xml.sax.Attributes;
 
 /** 
@@ -58,8 +61,13 @@
     private static final String CLOSE_EXPR_XML = "%";
 
     private static int tempSequenceNumber = 0;
-    private static ExpressionEvaluatorImpl expressionEvaluator
-       = new ExpressionEvaluatorImpl();
+    
+    //private static ExpressionEvaluatorImpl expressionEvaluator
+       //= new ExpressionEvaluatorImpl();
+    
+    //tc6
+    private final static ExpressionEvaluator expressionEvaluator =
+        new ExpressionEvaluatorImpl(new ExpressionFactoryImpl());
 
     private static final String javaKeywords[] = {
         "abstract", "assert", "boolean", "break", "byte", "case",
@@ -576,6 +584,7 @@
      * @param where the approximate location of the expressions in the JSP page
      * @param expressions a string containing zero or more "${}" expressions
      * @param err an error dispatcher to use
+     * @deprecated now delegated to the org.apache.el Package
      */
     public static void validateExpressions(Mark where,
                                            String expressions,
@@ -584,18 +593,19 @@
                                            ErrorDispatcher err)
             throws JasperException {
 
-        try {
-            JspUtil.expressionEvaluator.parseExpression( expressions, 
-                expectedType, null );
-        }
-        catch( ELParseException e ) {
-            err.jspError(where, "jsp.error.invalid.expression", expressions,
-                e.toString() );
-        }
-        catch( ELException e ) {
-            err.jspError(where, "jsp.error.invalid.expression", expressions,
-                e.toString() );
-        }
+//        try {
+//            
+//            JspUtil.expressionEvaluator.parseExpression( expressions, 
+//                expectedType, functionMapper );
+//        }
+//        catch( ELParseException e ) {
+//            err.jspError(where, "jsp.error.invalid.expression", expressions,
+//                e.toString() );
+//        }
+//        catch( ELException e ) {
+//            err.jspError(where, "jsp.error.invalid.expression", expressions,
+//                e.toString() );
+//        }
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to