commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neeme Praks <>
Subject [jelly] [ant taglib] [patch] [bugfix] ant taglib converts any non-string task attribute to string (and as a result, ignores the attribute)
Date Sat, 01 Mar 2003 10:17:16 GMT
I now went into the ant taglib sourcecode, to track down the problem of 
"[jelly] problem: setting Map property on bean?"

I found out that there are two bugs in there:

1. any non-string attribute is converted to string:
setAttribute(String name, Object value) is converting all values to 
strings by calling value.toString().
I also removed the check for Expression (seemed redundant), as all the 
expressions seem to be resolved before they are passed to this method.
All the test cases still pass, so I assume that this is ok.
If this is not the case then ignore this removal.

2. even if the value is not converted to string and is passed through 
as-is, there is a bug in finding the appropriate setter method.
The code seems to assume that storeElement() method in 
IntrospectionHelper (in ant) throws an exception, if the element is not 
supported by the task. However, this is not the case: if the element is 
not supported, storeElement() silently returns without any errors. I 
think this is a bug in Ant, and I will report it there as well. As a 
workaround for now, I added a call to getElementType() that throws an 
exception if the element is not supported.

Also, I added testcase for this + some more logging info and comments 

Patches and files are attached.


View raw message