Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-JSR-2
-
None
-
None
-
OSX 10.4, JDK 1.4.2, BeanUtils. 1.6.1 & 1.7.0
Description
In JSR 1, it was possible to use the Jakarta Commons BeanUtils framework to "describe" groovy beans that included "get" methods that were not proper bean accessors. In JSR 2, this is no longer possible as the "get" methods are being executed. I don't believe this is a bug in BeanUtils, since the behavior changed with JSR 2.
The Groovy class below illustrates this. I executed this class using the GroovyJ plugin in IDEA. The only additional dependency is the BeanUtils library (core in this case).
Comment out method "getUnsafe()" to see the test case execute properly.
==========
import org.apache.commons.beanutils.PropertyUtils;
public class GroovyBean {
@Property String test = "hi";
@Property String there = "yo";
public String getUnsafe(Object arg)
{ if (arg == null) throw new IllegalArgumentException("Null: arg"); return arg.toString(); } public static void main(String[] args) {
try {
GroovyBean bean = new GroovyBean();
Map properties = PropertyUtils.describe(bean);
properties.keySet().each()
} catch (Throwable t)
{ t.printStackTrace(); } }
}