While tracking down a bug in Jelly Ant tag library[1], I also found a related bug in Ant:
(Not sure if this can be called a bug, rather it is an inconsistency)


createElement() method throws an BuildException, if the tag does not support the specified element.

getElementType() method throws an BuildException, if the tag does not support the specified element.

storeElement() method silently returns, if the tag does not support the specified element.

See the inconsistency? Right now I sent a patch to Jelly Ant taglib that works around this bug by first calling getElementType() and only if that succeeds, it calls storeElement(). However, I hope this can be fixed in Ant and we can remove that hack...?

Anyway, I fixed this issue and you can find the patch attached (code&javadoc).

I also fixed the supportsNestedElement() check as it did not check for nestedStorers, only for nestedCreators.

Rgds,
Neeme

[1] http://article.gmane.org/gmane.comp.jakarta.commons.devel/20405
Index: IntrospectionHelper.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v
retrieving revision 1.48
diff -r1.48 IntrospectionHelper.java
575c575,576
<         return nestedCreators.containsKey(elementName);
---
>         return nestedCreators.containsKey(elementName) 
>             || nestedStorers.containsKey(elementName);
596c597,599
<      * @exception BuildException if the storage method fails.
---
>      * @exception BuildException if no method is available to store the
>      *                           element instance, or if the storage method
>      *                           fails.
605c608,610
<             return;
---
>             String msg = project.getElementName(parent) +
>                 " doesn't support the nested \"" + elementName + "\" 
> element.";
>             throw new BuildException(msg);

Reply via email to