kinman 2002/10/18 14:51:07 Modified: jsr152/src/share/javax/servlet/jsp/tagext SimpleTagSupport.java Log: - Patch by Jan Luehe Adjust the semantics of SimpleTagSupport.findAncestorWithClass() to use the return value of getAdaptee() when comparing class types, and for the final return value. Revision Changes Path 1.3 +23 -14 jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java Index: SimpleTagSupport.java =================================================================== RCS file: /home/cvs/jakarta-servletapi-5/jsr152/src/share/javax/servlet/jsp/tagext/SimpleTagSupport.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- SimpleTagSupport.java 19 Aug 2002 16:29:51 -0000 1.2 +++ SimpleTagSupport.java 18 Oct 2002 21:51:07 -0000 1.3 @@ -167,6 +167,12 @@ * interfaces. This method is used for coordination among * cooperating tags. * + * <p> For every instance of TagAdapter + * encountered while traversing the ancestors, the tag handler returned by + * <tt>TagAdapter.getAdaptee()</tt> - instead of the TagAdpater itself - + * is compared to <tt>klass</tt>. If the tag handler matches, it - and + * not its TagAdapter - is returned. + * * <p> * The current version of the specification only provides one formal * way of indicating the observable type of a tag handler: its @@ -198,31 +204,34 @@ { boolean isInterface = false; - if (from == null || - klass == null || - (!JspTag.class.isAssignableFrom(klass) && - !(isInterface = klass.isInterface()))) { + if (from == null || klass == null + || (!JspTag.class.isAssignableFrom(klass) + && !(isInterface = klass.isInterface()))) { return null; } for (;;) { - JspTag tag = null; + JspTag parent = null; if( from instanceof SimpleTag ) { - tag = ((SimpleTag)from).getParent(); + parent = ((SimpleTag)from).getParent(); } else if( from instanceof Tag ) { - tag = ((Tag)from).getParent(); + parent = ((Tag)from).getParent(); } - - if (tag == null) { + if (parent == null) { return null; } - if ((isInterface && klass.isInstance(tag)) || - klass.isAssignableFrom(tag.getClass())) - return tag; - else - from = tag; + if (parent instanceof TagAdapter) { + parent = ((TagAdapter) parent).getAdaptee(); + } + + if ((isInterface && klass.isInstance(parent)) + || klass.isAssignableFrom(parent.getClass())) { + return parent; + } + + from = parent; } } }
-- To unsubscribe, e-mail: <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>