DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=33840>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=33840





------- Additional Comments From [EMAIL PROTECTED]  2005-08-02 17:18 -------
Furthermore, at least the 1.7 implementation is not sufficiently robust.  For
example, if I try:

PropertyUtils.isReadable(new WrapDynaBean(new Socket()), "inputStream")

returns 'true'.  A subsequent read of this field will yield:

java.lang.IllegalArgumentException: Property 'inputStream' has no read method

PropertyUtils should either inspect DynaBeans in a manner that WrapDynaBean (and
presumably other types of DynaBeans) can modulate (for instance: template
methods DynaBean.isReadable()/isWriteable()) or it should special-case
WrapDynaBean to perform the more thorough PropertyDescriptor test on the
WrapDynaBean.instance() return value:

// Return the requested result
Object realInstance;
if (bean instanceof WrapDynaBean) {
    realInstance = ((WrapDynaBean) bean).getInstance();
} else {
    realInstance = bean;
}
try {
  PropertyDescriptor desc =
      getPropertyDescriptor(bean, name);
  if (desc != null) {
      Method readMethod = desc.getReadMethod();
          if ((readMethod == null) &&
              (desc instanceof IndexedPropertyDescriptor)) {
              readMethod = ((IndexedPropertyDescriptor)
desc).getIndexedReadMethod();
          }
          return (readMethod != null);
      } else {
          return (false);
      }
  } catch (IllegalAccessException e) {
      return (false);
  } catch (InvocationTargetException e) {
      return (false);
  } catch (NoSuchMethodException e) {
      return (false);
  }
}

For that matter, is there a reason the read/write status of a property is not
just part of the DynaProperty structure?



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to