Fix for JELLY-214 broke attribute behaviour of define:tag
---------------------------------------------------------

         Key: JELLY-219
         URL: http://issues.apache.org/jira/browse/JELLY-219
     Project: jelly
        Type: Bug
  Components: core / taglib.core, taglib.define  
    Versions: 1.0-beta-4, 1.1-beta-1, 1.0-beta-5    
 Environment: Window XP, JDK1.5, Ant 1.6.5
    Reporter: Tony Robertson


When using the "tag" tag of the jelly:define taglib, the resulting tag is 
supposed to support attributes getting exposed as context variables. eg:

        <d:taglib uri="myjelly:testlib">
                <d:tag name="test">
                        <j:whitespace>message attribute is ${msg}
                        tag body is <d:invokeBody/>
                        </j:whitespace>
                </d:tag>
        </d:taglib>
...
        <test xmlns="myjelly:testlib" msg="one">other stuff</test>

This was broken by change to "org.apache.commons.jelly.impl.StaticTagScript" 
that was introduced at revision 219726 as a fix for "JELLY-214" 
Now, if any attributes are set on the tag, you get a class-cast exception 
thrown when line 103 tries to cast the dynamic tag to a static tag.
In fact, the condition on line 102 really doesn't make sense. Clearly the "tag 
instanceof StaticTag" should be always required. I think the || condition 
should probably be an &&.
The following patch fixes this problem, but paul should probably check what the 
intention of that line originally was.
- Tony

Index: StaticTagScript.java
===================================================================
--- StaticTagScript.java        (revision 233399)
+++ StaticTagScript.java        (working copy)
@@ -99,7 +99,7 @@
                     value = expression.evaluate(context);
                 }
 
-                if(expat.prefix!=null || expat.prefix.length()>0 && tag 
instanceof StaticTag)
+                if (expat.prefix!=null && expat.prefix.length()>0 && tag 
instanceof StaticTag)
                     ((StaticTag) dynaTag).setAttribute(name,expat.prefix, 
expat.nsURI,value);
                 else
                     dynaTag.setAttribute(name, value);


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to