You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2003/04/09 02:47:15 UTC

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ELFunctionMapper.java Generator.java Node.java Validator.java

kinman      2003/04/08 17:47:15

  Modified:    jasper2/src/share/org/apache/jasper/compiler
                        ELFunctionMapper.java Generator.java Node.java
                        Validator.java
  Log:
  - Fix 17929: EL expressions not evaluated in XML element attributes in
    JSP documents.
  
  Revision  Changes    Path
  1.10      +9 -0      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ELFunctionMapper.java
  
  Index: ELFunctionMapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ELFunctionMapper.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ELFunctionMapper.java	3 Apr 2003 22:22:12 -0000	1.9
  +++ ELFunctionMapper.java	9 Apr 2003 00:47:15 -0000	1.10
  @@ -143,6 +143,15 @@
   	    visitBody(n);
   	}
   
  +        public void visit(Node.UninterpretedTag n) throws JasperException {
  +
  +	    Node.JspAttribute[] attrs = n.getJspAttributes();
  +	    for (int i = 0; i < attrs.length; i++) {
  +		doMap(attrs[i]);
  +	    }
  +	    visitBody(n);
  +	}
  +
           public void visit(Node.CustomTag n) throws JasperException {
   	    Node.JspAttribute[] attrs = n.getJspAttributes();
   	    for (int i = 0; i < attrs.length; i++) {
  
  
  
  1.182     +18 -11    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java
  
  Index: Generator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
  retrieving revision 1.181
  retrieving revision 1.182
  diff -u -r1.181 -r1.182
  --- Generator.java	7 Apr 2003 20:56:49 -0000	1.181
  +++ Generator.java	9 Apr 2003 00:47:15 -0000	1.182
  @@ -1573,20 +1573,27 @@
   	    out.printin("out.write(\"<");
   	    out.print(n.getQName());
   	    Attributes attrs = n.getAttributes();
  +	    Node.JspAttribute[] jspAttrs = n.getJspAttributes();
   	    if (attrs != null) {
   		int attrsLength = attrs.getLength();
   		for (int i=0; i<attrsLength; i++) {
  -		    String quote = DOUBLE_QUOTE;
  -		    String value = attrs.getValue(i);
  -		    if (value.indexOf('"') != -1) {
  -			quote = SINGLE_QUOTE;
  -		    }
   		    out.print(" ");
   		    out.print(attrs.getQName(i));
   		    out.print("=");
  -		    out.print(quote);
  -		    out.print(value);
  -		    out.print(quote);
  +		    if (jspAttrs[i].isELInterpreterInput()) {
  +			out.print("\" + ");
  +			out.print(attributeValue(jspAttrs[i], false, Object.class));
  +			out.print(" + \"");
  +		    } else {
  +			String quote = DOUBLE_QUOTE;
  +			String value = attrs.getValue(i);
  +			if (value.indexOf('"') != -1) {
  +			    quote = SINGLE_QUOTE;
  +			}
  +			out.print(quote);
  +			out.print(value);
  +			out.print(quote);
  +		    }
   		}
   	    }
   
  
  
  
  1.71      +13 -3     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java
  
  Index: Node.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- Node.java	31 Mar 2003 21:14:05 -0000	1.70
  +++ Node.java	9 Apr 2003 00:47:15 -0000	1.71
  @@ -1076,6 +1076,8 @@
        */
       public static class UninterpretedTag extends Node {
   
  +	private JspAttribute[] jspAttrs;
  +
   	public UninterpretedTag(String qName, String localName,
   				Attributes attrs, Attributes xmlnsAttrs,
   				Mark start, Node parent) {
  @@ -1084,6 +1086,14 @@
   
   	public void accept(Visitor v) throws JasperException {
   	    v.visit(this);
  +	}
  +
  +	public void setJspAttributes(JspAttribute[] jspAttrs) {
  +	    this.jspAttrs = jspAttrs;
  +	}
  +
  +	public JspAttribute[] getJspAttributes() {
  +	    return jspAttrs;
   	}
       }
       
  
  
  
  1.102     +18 -5     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java
  
  Index: Validator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- Validator.java	31 Mar 2003 19:15:34 -0000	1.101
  +++ Validator.java	9 Apr 2003 00:47:15 -0000	1.102
  @@ -682,6 +682,20 @@
   		err.jspError(n, "jsp.error.namedAttribute.invalidUse");
               }
   
  +	    Attributes attrs = n.getAttributes();
  +	    int attrSize = attrs.getLength();
  +	    Node.JspAttribute[] jspAttrs = new Node.JspAttribute[attrSize];
  +	    for (int i=0; i < attrSize; i++) {
  +		jspAttrs[i] = getJspAttribute(attrs.getQName(i),
  +					      attrs.getURI(i),
  +					      attrs.getLocalName(i),
  +					      attrs.getValue(i),
  +					      java.lang.Object.class,
  +					      n,
  +					      false);
  +	    }
  +	    n.setJspAttributes(jspAttrs);
  +
   	    visitBody(n);
           }
   
  @@ -1081,8 +1095,7 @@
                   else {
                       // The attribute can contain expressions but is not a
                       // scriptlet expression; thus, we want to run it through 
  -                    // the expression interpreter (final argument "true" in
  -                    // Node.JspAttribute constructor).
  +                    // the expression interpreter
   
                       // validate expression syntax if string contains
                       // expression(s)
  
  
  

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