From 06ab2c2ea16ccdd59d77b21dbebd556b60a1bcbc Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 4 Feb 2009 10:26:28 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=38197 Take account of jsp:attribute elements when naming tag pools git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@740675 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/jasper/compiler/Generator.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 8804f5e22..7594a2cc2 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -43,6 +43,7 @@ import javax.servlet.jsp.tagext.VariableInfo; import org.apache.jasper.Constants; import org.apache.jasper.JasperException; import org.apache.jasper.JspCompilationContext; +import org.apache.jasper.compiler.Node.NamedAttribute; import org.apache.jasper.runtime.JspRuntimeLibrary; import org.xml.sax.Attributes; @@ -267,8 +268,8 @@ class Generator { if (!n.implementsSimpleTag()) { String name = createTagHandlerPoolName(n.getPrefix(), n - .getLocalName(), n.getAttributes(), n - .hasEmptyBody()); + .getLocalName(), n.getAttributes(), + n.getNamedAttributeNodes(), n.hasEmptyBody()); n.setTagHandlerPoolName(name); if (!names.contains(name)) { names.add(name); @@ -284,15 +285,21 @@ class Generator { * @return The name of the tag handler pool */ private String createTagHandlerPoolName(String prefix, - String shortName, Attributes attrs, boolean hasEmptyBody) { + String shortName, Attributes attrs, Node.Nodes namedAttrs, + boolean hasEmptyBody) { String poolName = null; poolName = "_jspx_tagPool_" + prefix + "_" + shortName; if (attrs != null) { - String[] attrNames = new String[attrs.getLength()]; + String[] attrNames = + new String[attrs.getLength() + namedAttrs.size()]; for (int i = 0; i < attrNames.length; i++) { attrNames[i] = attrs.getQName(i); } + for (int i = 0; i < namedAttrs.size(); i++) { + attrNames[attrs.getLength() + i] = + ((NamedAttribute) namedAttrs.getNode(i)).getQName(); + } Arrays.sort(attrNames, Collections.reverseOrder()); if (attrNames.length > 0) { poolName = poolName + "&"; -- 2.11.0