Uploaded image for project: 'Commons Jelly'
  1. Commons Jelly
  2. JELLY-219

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-beta-4, 1.0-beta-5, 1.1-beta-1
    • Fix Version/s: 1.1-beta-1
    • Labels:
      None
    • Environment:

      Window XP, JDK1.5, Ant 1.6.5

      Description

      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);

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tony_robertson Tony Robertson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: