commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Briccetti <da...@davebsoft.com>
Subject WrapDynaBean misleading error message: Property has no read method
Date Wed, 08 Dec 2004 04:32:56 GMT
Thanks for DynaBean and all the other great Commons code.

WrapDynaBean gives a misleading error message: "Property foo has no read 
method" when actually there is a getFoo() method, but it throws an 
exception.

WrapDynaBean:

    public Object get(String name) {
        Object value = null;
        try {
            value = PropertyUtils.getSimpleProperty(instance, name);
        } catch (Throwable t) {
            throw new IllegalArgumentException
                    ("Property '" + name + "' has no read method");
        }

Here's an example of the "getFoo()" throwing an exception. I'm using 
XmlBeans to get a data value which is invalid:


org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException
    at 
org.apache.xmlbeans.impl.values.JavaIntHolder.set_text(JavaIntHolder.java:42)
    at 
org.apache.xmlbeans.impl.values.XmlObjectBase.update_from_wscanon_text(XmlObjectBase.java:1068)
    at 
org.apache.xmlbeans.impl.values.XmlObjectBase.check_dated(XmlObjectBase.java:1206)
    at 
org.apache.xmlbeans.impl.values.JavaIntHolder.intValue(JavaIntHolder.java:52)
    at 
org.apache.xmlbeans.impl.values.XmlObjectBase.getIntValue(XmlObjectBase.java:1424)

But as you can see, get() completely masks the real error.

Thanks.

Dave Briccetti
Lafayette, California


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message