- Some deferred expressions handling fixes.
authorremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 26 Oct 2006 23:19:13 +0000 (23:19 +0000)
committerremm <remm@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 26 Oct 2006 23:19:13 +0000 (23:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@468186 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/Generator.java
java/org/apache/jasper/compiler/JspConfig.java
java/org/apache/jasper/compiler/Validator.java

index 10fccf1..2bb370e 100644 (file)
@@ -892,9 +892,9 @@ class Generator {
 
         public void visit(Node.ELExpression n) throws JasperException {
             n.setBeginJavaLine(out.getJavaLine());
-            if (!pageInfo.isELIgnored()) {
+            if (!pageInfo.isELIgnored() && (n.getEL() != null)) {
                 out.printil("out.write("
-                        + JspUtil.interpreterCall(this.isTagFile, "${"
+                        + JspUtil.interpreterCall(this.isTagFile, n.getType() + "{"
                                 + new String(n.getText()) + "}", String.class,
                                 n.getEL().getMapName(), false) + ");");
             } else {
index 36ca2b6..7a9542f 100644 (file)
@@ -114,7 +114,7 @@ public class JspConfig {
                 String isXml = null;
                 Vector includePrelude = new Vector();
                 Vector includeCoda = new Vector();
-                String deferedSyntaxAllowedAsLiteral = null;
+                String deferredSyntaxAllowedAsLiteral = null;
                 String trimDirectiveWhitespaces = null;
 
                 while (list.hasNext()) {
@@ -137,7 +137,7 @@ public class JspConfig {
                     else if ("include-coda".equals(tname))
                         includeCoda.addElement(element.getBody());
                     else if ("deferred-syntax-allowed-as-literal".equals(tname))
-                        deferedSyntaxAllowedAsLiteral = element.getBody();
+                        deferredSyntaxAllowedAsLiteral = element.getBody();
                     else if ("trim-directive-whitespaces".equals(tname))
                         trimDirectiveWhitespaces = element.getBody();
                 }
@@ -195,7 +195,7 @@ public class JspConfig {
                             pageEncoding,
                             includePrelude,
                             includeCoda,
-                            deferedSyntaxAllowedAsLiteral,
+                            deferredSyntaxAllowedAsLiteral,
                             trimDirectiveWhitespaces);
                     JspPropertyGroup propertyGroup =
                         new JspPropertyGroup(path, extension, property);
index 15f3b35..696b206 100644 (file)
@@ -664,9 +664,11 @@ class Validator {
 
             // JSP.2.2 - '#{' not allowed in template text
             if (n.getType() == '#') {
-                if (pageInfo.isDeferredSyntaxAllowedAsLiteral())
+                if (!pageInfo.isDeferredSyntaxAllowedAsLiteral()) {
+                    err.jspError(n, "jsp.error.el.template.deferred");
+                } else {
                     return;
-                err.jspError(n, "jsp.error.el.template.deferred");
+                }
             }
 
             // build expression
@@ -1007,10 +1009,7 @@ class Validator {
                             // Attribute does not accept any expressions.
                             // Make sure its value does not contain any.
                             if (isExpression(n, attrs.getValue(i))) {
-                                err
-                                        .jspError(
-                                                n,
-                                                "jsp.error.attribute.custom.non_rt_with_expr",
+                                err .jspError(n, "jsp.error.attribute.custom.non_rt_with_expr",
                                                 tldAttrs[j].getName());
                             }
                             jspAttrs[i] = new Node.JspAttribute(tldAttrs[j],
@@ -1197,7 +1196,9 @@ class Validator {
         private boolean isExpression(Node n, String value) {
             if ((n.getRoot().isXmlSyntax() && value.startsWith("%="))
                     || (!n.getRoot().isXmlSyntax() && value.startsWith("<%="))
-                    || (value.indexOf("${") != -1 && !pageInfo.isELIgnored()))
+                    || (value.indexOf("${") != -1 && !pageInfo.isELIgnored())
+                    || (value.indexOf("#{") != -1 && !pageInfo.isELIgnored()
+                            && !pageInfo.isDeferredSyntaxAllowedAsLiteral()))
                 return true;
             else
                 return false;