You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2006/11/04 03:11:18 UTC
svn commit: r471096 - in
/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler: ELNode.java
ELParser.java Validator.java
Author: remm
Date: Fri Nov 3 18:11:17 2006
New Revision: 471096
URL: http://svn.apache.org/viewvc?view=rev&rev=471096
Log:
- Expose the EL type through the Root node to be able to determine the EL type for JspAttribute.
Modified:
tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELNode.java
tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java
tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java
Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELNode.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELNode.java?view=diff&rev=471096&r1=471095&r2=471096
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELNode.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELNode.java Fri Nov 3 18:11:17 2006
@@ -45,9 +45,11 @@
public static class Root extends ELNode {
private ELNode.Nodes expr;
+ private char type;
- Root(ELNode.Nodes expr) {
+ Root(ELNode.Nodes expr, char type) {
this.expr = expr;
+ this.type = type;
}
public void accept(Visitor v) throws JasperException {
@@ -57,6 +59,10 @@
public ELNode.Nodes getExpression() {
return expr;
}
+
+ public char getType() {
+ return type;
+ }
}
/**
@@ -195,7 +201,7 @@
}
}
- public Iterator iterator() {
+ public Iterator<ELNode> iterator() {
return list.iterator();
}
@@ -224,6 +230,7 @@
public String getMapName() {
return mapName;
}
+
}
/*
Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java?view=diff&rev=471096&r1=471095&r2=471096
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/ELParser.java Fri Nov 3 18:11:17 2006
@@ -71,7 +71,7 @@
}
ELNode.Nodes elexpr = parser.parseEL();
if (!elexpr.isEmpty()) {
- parser.expr.add(new ELNode.Root(elexpr));
+ parser.expr.add(new ELNode.Root(elexpr, parser.type));
}
}
return parser.expr;
Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java?view=diff&rev=471096&r1=471095&r2=471096
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java Fri Nov 3 18:11:17 2006
@@ -39,7 +39,6 @@
import org.apache.el.lang.ELSupport;
import org.apache.jasper.Constants;
import org.apache.jasper.JasperException;
-import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.el.ELContextImpl;
import org.xml.sax.Attributes;
@@ -91,7 +90,6 @@
DirectiveVisitor(Compiler compiler) throws JasperException {
this.pageInfo = compiler.getPageInfo();
this.err = compiler.getErrorDispatcher();
- JspCompilationContext ctxt = compiler.getCompilationContext();
}
public void visit(Node.IncludeDirective n) throws JasperException {
@@ -582,7 +580,6 @@
public void visit(Node.SetProperty n) throws JasperException {
JspUtil.checkAttributes("SetProperty", n, setPropertyAttrs, err);
- String name = n.getTextAttribute("name");
String property = n.getTextAttribute("property");
String param = n.getTextAttribute("param");
String value = n.getAttributeValue("value");
@@ -816,7 +813,7 @@
if (jspAttrsSize > 0) {
jspAttrs = new Node.JspAttribute[jspAttrsSize];
}
- Hashtable tagDataAttrs = new Hashtable(attrsSize);
+ Hashtable<String, Object> tagDataAttrs = new Hashtable<String, Object>(attrsSize);
checkXmlAttributes(n, jspAttrs, tagDataAttrs);
checkNamedAttributes(n, jspAttrs, attrsSize, tagDataAttrs);
@@ -1010,7 +1007,7 @@
* considered a dynamic attribute.
*/
private void checkXmlAttributes(Node.CustomTag n,
- Node.JspAttribute[] jspAttrs, Hashtable tagDataAttrs)
+ Node.JspAttribute[] jspAttrs, Hashtable<String, Object> tagDataAttrs)
throws JasperException {
TagInfo tagInfo = n.getTagInfo();
@@ -1166,7 +1163,8 @@
* attributes
*/
private void checkNamedAttributes(Node.CustomTag n,
- Node.JspAttribute[] jspAttrs, int start, Hashtable tagDataAttrs)
+ Node.JspAttribute[] jspAttrs, int start,
+ Hashtable<String, Object> tagDataAttrs)
throws JasperException {
TagInfo tagInfo = n.getTagInfo();
@@ -1259,10 +1257,21 @@
// validate expression syntax if string contains
// expression(s)
ELNode.Nodes el = ELParser.parse(value);
+
+ boolean deferred = false;
+ Iterator<ELNode> nodes = el.iterator();
+ while (nodes.hasNext()) {
+ ELNode node = nodes.next();
+ if (node instanceof ELNode.Root) {
+ if (((ELNode.Root) node).getType() == '#') {
+ deferred = true;
+ }
+ }
+ }
if (el.containsEL() && !pageInfo.isELIgnored()
- && ((!pageInfo.isDeferredSyntaxAllowedAsLiteral() && value.startsWith("#{"))
- || value.startsWith("${"))) {
+ && ((!pageInfo.isDeferredSyntaxAllowedAsLiteral() && deferred)
+ || !deferred)) {
validateFunctions(el, n);
@@ -1487,7 +1496,7 @@
throws JasperException {
FunctionInfo funcInfo = func.getFunctionInfo();
String signature = funcInfo.getFunctionSignature();
- ArrayList params = new ArrayList();
+ ArrayList<String> params = new ArrayList<String>();
// Signature is of the form
// <return-type> S <method-name S? '('
// < <arg-type> ( ',' <arg-type> )* )? ')'
@@ -1520,14 +1529,14 @@
class ValidateFunctionMapper extends FunctionMapper {
- private HashMap fnmap = new java.util.HashMap();
+ private HashMap<String, Method> fnmap = new HashMap<String, Method>();
public void mapFunction(String fnQName, Method method) {
fnmap.put(fnQName, method);
}
public Method resolveFunction(String prefix, String localName) {
- return (Method) this.fnmap.get(prefix + ":" + localName);
+ return this.fnmap.get(prefix + ":" + localName);
}
}
@@ -1584,15 +1593,12 @@
*/
static class TagExtraInfoVisitor extends Node.Visitor {
- private PageInfo pageInfo;
-
private ErrorDispatcher err;
/*
* Constructor
*/
TagExtraInfoVisitor(Compiler compiler) {
- this.pageInfo = compiler.getPageInfo();
this.err = compiler.getErrorDispatcher();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org