tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Collector.java ELFunctionMapper.java Generator.java Validator.java
Date Thu, 01 May 2003 02:35:21 GMT
luehe       2003/04/30 19:35:21

  Modified:    jasper2/src/share/org/apache/jasper/compiler Collector.java
                        ELFunctionMapper.java Generator.java Validator.java
  Log:
  Check for (attrs!=null) when enumerating tag attributes
  
  Revision  Changes    Path
  1.10      +3 -3      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Collector.java
  
  Index: Collector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Collector.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Collector.java	14 Feb 2003 20:29:37 -0000	1.9
  +++ Collector.java	1 May 2003 02:35:20 -0000	1.10
  @@ -176,7 +176,7 @@
               if( n instanceof Node.CustomTag ) {
                   Node.CustomTag ct = (Node.CustomTag)n;
                   Node.JspAttribute[] attrs = ct.getJspAttributes();
  -                for (int i = 0; i < attrs.length; i++) {
  +                for (int i = 0; attrs != null && i < attrs.length; i++) {
                       if (attrs[i].isExpression()) {
                           scriptingElementSeen = true;
                           break;
  
  
  
  1.11      +1 -1      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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ELFunctionMapper.java	9 Apr 2003 00:47:15 -0000	1.10
  +++ ELFunctionMapper.java	1 May 2003 02:35:20 -0000	1.11
  @@ -154,7 +154,7 @@
   
           public void visit(Node.CustomTag n) throws JasperException {
   	    Node.JspAttribute[] attrs = n.getJspAttributes();
  -	    for (int i = 0; i < attrs.length; i++) {
  +	    for (int i = 0; attrs != null && i < attrs.length; i++) {
   		doMap(attrs[i]);
   	    }
   	    visitBody(n);
  
  
  
  1.184     +4 -4      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.183
  retrieving revision 1.184
  diff -u -r1.183 -r1.184
  --- Generator.java	25 Apr 2003 20:10:06 -0000	1.183
  +++ Generator.java	1 May 2003 02:35:20 -0000	1.184
  @@ -2531,7 +2531,7 @@
   	    }
   
   	    Node.JspAttribute[] attrs = n.getJspAttributes();
  -	    for (int i=0; i<attrs.length; i++) {
  +	    for (int i=0; attrs != null && i<attrs.length; i++) {
   		String attrValue = evaluateAttribute(handlerInfo, attrs[i],
   						n, tagHandlerVar);
   		
  
  
  
  1.104     +46 -27    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.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- Validator.java	29 Apr 2003 19:54:06 -0000	1.103
  +++ Validator.java	1 May 2003 02:35:20 -0000	1.104
  @@ -150,7 +150,7 @@
   
   	    // JSP.2.10.1
   	    Attributes attrs = n.getAttributes();
  -	    for (int i = 0; i < attrs.getLength(); i++) {
  +	    for (int i = 0; attrs != null && i < attrs.getLength(); i++) {
   		String attr = attrs.getQName(i);
   		String value = attrs.getValue(i);
   
  @@ -287,7 +287,7 @@
               // This method does additional processing to collect page info
               
   	    Attributes attrs = n.getAttributes();
  -	    for (int i = 0; i < attrs.getLength(); i++) {
  +	    for (int i = 0; attrs != null && i < attrs.getLength(); i++) {
   		String attr = attrs.getQName(i);
   		String value = attrs.getValue(i);
   
  @@ -683,18 +683,20 @@
               }
   
   	    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);
  +	    if (attrs != null) {
  +		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);
   	    }
  -	    n.setJspAttributes(jspAttrs);
   
   	    visitBody(n);
           }
  @@ -727,10 +729,13 @@
   	    String customActionUri = n.getURI();
   	    Attributes attrs = n.getAttributes();
   	    for (int i=0; i<tldAttrs.length; i++) {
  -		String attr = attrs.getValue(tldAttrs[i].getName());
  -		if (attr == null) {
  -		    attr = attrs.getValue(customActionUri,
  -					  tldAttrs[i].getName());
  +		String attr = null;
  +		if (attrs != null) {
  +		    attr = attrs.getValue(tldAttrs[i].getName());
  +		    if (attr == null) {
  +			attr = attrs.getValue(customActionUri,
  +					      tldAttrs[i].getName());
  +		    }
   		}
   		Node.NamedAttribute na =
   			n.getNamedAttributeNode(tldAttrs[i].getName());
  @@ -746,12 +751,25 @@
   	    }
   
               Node.Nodes naNodes = n.getNamedAttributeNodes();
  -	    Node.JspAttribute[] jspAttrs
  -		= new Node.JspAttribute[attrs.getLength() + naNodes.size()];
  -	    Hashtable tagDataAttrs = new Hashtable(attrs.getLength());
  +	    int jspAttrsSize = naNodes.size();
  +	    if (attrs != null) {
  +		jspAttrsSize += attrs.getLength();
  +	    }
  +	    Node.JspAttribute[] jspAttrs = null;
  +	    if (jspAttrsSize > 0) {
  +		jspAttrs = new Node.JspAttribute[jspAttrsSize];
  +	    }
  +	    Hashtable tagDataAttrs = null;
  +	    if (attrs != null) {
  +		tagDataAttrs = new Hashtable(attrs.getLength());
  +	    } else {
  +		tagDataAttrs = new Hashtable(0);
  +	    }
   
   	    checkXmlAttributes(n, jspAttrs, tagDataAttrs);
  -            checkNamedAttributes(n, jspAttrs, attrs.getLength(), tagDataAttrs);
  +            checkNamedAttributes(n, jspAttrs,
  +				 (attrs!=null) ? attrs.getLength():0,
  +				 tagDataAttrs);
   
   	    TagData tagData = new TagData(tagDataAttrs);
   
  @@ -776,10 +794,11 @@
   	public void visit(Node.JspElement n) throws JasperException {
   
   	    Attributes attrs = n.getAttributes();
  -	    int xmlAttrLen = attrs.getLength();
  -	    if (xmlAttrLen == 0) {
  +	    if (attrs == null) {
   		err.jspError(n, "jsp.error.jspelement.missing.name");
   	    }
  +	    int xmlAttrLen = attrs.getLength();
  +
               Node.Nodes namedAttrs = n.getNamedAttributeNodes();
   
   	    // XML-style 'name' attribute, which is mandatory, must not be
  @@ -909,7 +928,7 @@
   	    TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
   	    Attributes attrs = n.getAttributes();
   
  -	    for (int i=0; i<attrs.getLength(); i++) {
  +	    for (int i=0; attrs != null && i<attrs.getLength(); i++) {
   		boolean found = false;
   		for (int j=0; tldAttrs != null && j<tldAttrs.length; j++) {
   		    if (attrs.getLocalName(i).equals(tldAttrs[j].getName())
  
  
  

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


Mime
View raw message