Uploaded image for project: 'Commons BeanUtils'
  1. Commons BeanUtils
  2. BEANUTILS-52

[beanutils] WrapDynaBean misleading error message: Property has no read method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 32590

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            davebsoft Dave Briccetti
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: