kinman 2003/12/09 16:24:23 Modified: jasper2/src/share/org/apache/jasper/compiler TagFileProcessor.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: - The spec allows an attribute to be specified in multple tag directives, if they have the same value. It is an error if not. Revision Changes Path 1.55 +27 -8 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.54 retrieving revision 1.55 diff -u -r1.54 -r1.55 --- TagFileProcessor.java 5 Dec 2003 18:33:19 -0000 1.54 +++ TagFileProcessor.java 10 Dec 2003 00:24:23 -0000 1.55 @@ -142,6 +142,7 @@ private String smallIcon = null; private String largeIcon = null; private String dynamicAttrsMapName; + private String example = null; private Vector attributeVector; private Vector variableVector; @@ -176,7 +177,7 @@ JspUtil.checkAttributes("Tag directive", n, tagDirectiveAttrs, err); - bodycontent = n.getAttributeValue("body-content"); + bodycontent = checkConflict(n, bodycontent, "body-content"); if (bodycontent != null && !bodycontent.equalsIgnoreCase(TagInfo.BODY_CONTENT_EMPTY) && !bodycontent.equalsIgnoreCase(TagInfo.BODY_CONTENT_TAG_DEPENDENT) && @@ -184,15 +185,33 @@ err.jspError(n, "jsp.error.tagdirective.badbodycontent", bodycontent); } - dynamicAttrsMapName = n.getAttributeValue("dynamic-attributes"); + dynamicAttrsMapName = checkConflict(n, dynamicAttrsMapName, + "dynamic-attributes"); if (dynamicAttrsMapName != null) { checkUniqueName(dynamicAttrsMapName, TAG_DYNAMIC, n); } - smallIcon = n.getAttributeValue("small-icon"); - largeIcon = n.getAttributeValue("large-icon"); - description = n.getAttributeValue("description"); - displayName = n.getAttributeValue("display-name"); + smallIcon = checkConflict(n, smallIcon, "small-icon"); + largeIcon = checkConflict(n, largeIcon, "large-icon"); + description = checkConflict(n, description, "description"); + displayName = checkConflict(n, displayName, "display-name"); + example = checkConflict(n, example, "example"); } + + private String checkConflict(Node n, String oldAttrValue, String attr) + throws JasperException { + + String result = oldAttrValue; + String attrValue = n.getAttributeValue(attr); + if (attrValue != null) { + if (oldAttrValue != null && !oldAttrValue.equals(attrValue)) { + err.jspError(n, "jsp.error.tag.conflict.attr", attr, + oldAttrValue, attrValue); + } + result = attrValue; + } + return result; + } + public void visit(Node.AttributeDirective n) throws JasperException { 1.136 +2 -1 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.135 retrieving revision 1.136 diff -u -r1.135 -r1.136 --- messages.properties 4 Dec 2003 19:37:58 -0000 1.135 +++ messages.properties 10 Dec 2003 00:24:23 -0000 1.136 @@ -67,6 +67,7 @@ jsp.error.page.invalid.iselignored=Page directive: invalid value for isELIgnored jsp.error.tag.invalid.iselignored=Tag directive: invalid value for isELIgnored jsp.error.page.multi.pageencoding=Page directive must not have multiple occurrences of pageencoding +jsp.error.tag.conflict.attr=Tag directive: illegal to have multiple occurrences of the attribute \"{0}\" with different values (old: {1}, new: {2}) jsp.error.tag.multi.pageencoding=Tag directive must not have multiple occurrences of pageencoding jsp.error.page.bad_b_and_a_combo=Page directive: Illegal combination of buffer=\"none\" && autoFlush=\"false\" jsp.error.not.impl.taglib=Internal error: Tag extensions not implemented
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]