You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/04/17 00:49:38 UTC

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler TagFileProcessor.java

luehe       2003/04/16 15:49:38

  Modified:    jasper2/src/share/org/apache/jasper/resources
                        messages.properties
               jasper2/src/share/org/apache/jasper/compiler
                        TagFileProcessor.java
  Log:
  Report a translation error if there is a tag directive with a
  'dynamic-attributes' attribute equal to the value of a 'name-given'
  attribute of a variable directive or equal to the value of a 'name'
  attribute of an attribute directive in this translation unit.
  
  Revision  Changes    Path
  1.115     +4 -2      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- messages.properties	15 Apr 2003 19:55:51 -0000	1.114
  +++ messages.properties	16 Apr 2003 22:49:37 -0000	1.115
  @@ -315,7 +315,9 @@
   jsp.error.attribute.standard.non_rt_with_expr=The {0} attribute of the {1} standard action does not accept any expressions
   jsp.error.scripting.variable.missing_name=Unable to determine scripting variable name from attribute {0}
   jasper.error.emptybodycontent.nonempty=According to TLD, tag {0} must be empty, but is not
  -jsp.error.tagfile.var_name_given_equals_attr_name=In tag file {0}, the name-given attribute or the alias attribute ({1}) of a variable directive equals the name attribute of an attribute directive
  +jsp.error.tagfile.var_name_given_equals_attr_name=In tag file {0}, the name-given attribute or the alias attribute of a variable directive equals the name attribute of an attribute directive: {1}
  +jsp.error.tagfile.tag_dynamic_attrs_equals_var_name_given=In tag file {0}, the dynamic-attributes attribute of a tag directive equals the name-given attribute of a variable directive: {1}
  +jsp.error.tagfile.tag_dynamic_attrs_equals_attr_name=In tag file {0}, the dynamic-attributes attribute of a tag directive equals the name attribute of an attribute directive: {1}
   jsp.error.page.noSession=Cannot access session scope in page that does not participate in any session
   jsp.error.useBean.noSession=Illegal for useBean to use session scope when JSP page declares (via page directive) that it does not participate in sessions
   jsp.error.xml.encodingByteOrderUnsupported = Given byte order for encoding \"{0}\" is not supported.
  
  
  
  1.49      +54 -6     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java
  
  Index: TagFileProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- TagFileProcessor.java	31 Mar 2003 21:44:04 -0000	1.48
  +++ TagFileProcessor.java	16 Apr 2003 22:49:38 -0000	1.49
  @@ -134,7 +134,7 @@
           private String displayName = null;
           private String smallIcon = null;
           private String largeIcon = null;
  -        private String dynamicAttrs;
  +        private String dynamicAttrsMapName;
           
           private Vector attributeVector;
           private Vector variableVector;
  @@ -164,7 +164,7 @@
                   err.jspError(n, "jsp.error.tagdirective.badbodycontent",
                                bodycontent);
               }
  -            dynamicAttrs = n.getAttributeValue("dynamic-attributes");
  +            dynamicAttrsMapName = n.getAttributeValue("dynamic-attributes");
               smallIcon = n.getAttributeValue("small-icon");
               largeIcon = n.getAttributeValue("large-icon");
               description = n.getAttributeValue("description");
  @@ -285,6 +285,14 @@
               return variableVector;
           }
   
  +	/*
  +	 * Returns the value of the dynamic-attributes tag directive
  +	 * attribute.
  +	 */
  +	public String getDynamicAttributesMapName() {
  +	    return dynamicAttrsMapName;
  +	}
  +
           public TagInfo getTagInfo() throws JasperException {
   
               if (name == null) {
  @@ -316,7 +324,7 @@
   			       smallIcon,
   			       largeIcon,
   			       tagVariableInfos,
  -			       dynamicAttrs);
  +			       dynamicAttrsMapName);
           }
       }
   
  @@ -376,9 +384,10 @@
                   }
               }
           }
  +
           /*
            * It is illegal to have a variable.name-given equal another
  -         * variable.alias the same tag file translation unit.
  +         * variable.alias in the same tag file translation unit.
            */
           Iterator varsIter = tagFileVisitor.getVariablesVector().iterator();
           while (varsIter.hasNext()) {
  @@ -403,7 +412,46 @@
               }
           }
   
  +	checkDynamicAttributesUniqueness(tagFileVisitor, path, err);
  +
           return tagFileVisitor.getTagInfo();
  +    }
  +
  +    /*
  +     * Reports a translation error if there is a tag directive with
  +     * a 'dynamic-attributes' attribute equal to the value of a
  +     * 'name-given' attribute of a variable directive or equal to the
  +     * value of a 'name' attribute of an attribute directive in this
  +     * translation unit.
  +     */
  +    private static void checkDynamicAttributesUniqueness(
  +                                            TagFileDirectiveVisitor tfv,
  +					    String path,
  +					    ErrorDispatcher err)
  +	        throws JasperException {
  +
  +	String dynamicAttrsMapName = tfv.getDynamicAttributesMapName();
  +	if (dynamicAttrsMapName == null) {
  +	    return;
  +	}
  +
  +	Iterator attrs = tfv.getAttributesVector().iterator();
  +	while (attrs.hasNext()) {
  +	    TagAttributeInfo attrInfo = (TagAttributeInfo) attrs.next();
  +	    if (dynamicAttrsMapName.equals(attrInfo.getName())) {
  +		err.jspError("jsp.error.tagfile.tag_dynamic_attrs_equals_attr_name",
  +			     path, dynamicAttrsMapName);
  +	    }
  +	}
  +
  +	Iterator vars = tfv.getVariablesVector().iterator();
  +	while (vars.hasNext()) {
  +	    TagVariableInfo varInfo = (TagVariableInfo) vars.next();
  +	    if (dynamicAttrsMapName.equals(varInfo.getNameGiven())) {
  +		err.jspError("jsp.error.tagfile.tag_dynamic_attrs_equals_var_name_given",
  +			     path, dynamicAttrsMapName);
  +	    }
  +	}
       }
   
       /**
  
  
  

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