commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 14170] New: - ConvertUtils.convert(Object) doesn't use registered convertor
Date Fri, 01 Nov 2002 16:23:02 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14170>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14170

ConvertUtils.convert(Object) doesn't use registered convertor

           Summary: ConvertUtils.convert(Object) doesn't use registered
                    convertor
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: brian.knorr@nextjet.com


The following is a detailed description of what we have found... any help is 
greatly appreciated:

Looking at the commons-beanutils source you will find the following method on 
BeanUtils.java:

    public static String getNestedProperty(Object bean, String name)
            throws IllegalAccessException, InvocationTargetException,
            NoSuchMethodException {

        Object value = PropertyUtils.getNestedProperty(bean, name);
        return (ConvertUtils.convert(value));
    }

***Please notice that it calls ConvertUtils.convert(value) - here is the source 
for that method:

    public static String convert(Object value) {
        if (value == null) {
            return ((String) null);
        } else if (value.getClass().isArray()) {
            if (Array.getLength(value) < 1) {
                return (null);
            }
            value = Array.get(value, 0);
            if (value == null)
                return ((String) null);
            else
                return (value.toString());
        } else {
            return (value.toString());
        }
    }

***As one can see the convert method never tries to use a registered 
convertor... is this a bug or its intended behavior?  When calling getProperty, 
getNestedProperty, or getSimpleProperty on BeanUtils.java we would like to have 
our registered convertor convert the Object to a String rather than the system 
calling toString.  Please advise...

Thanks,

Brian

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


Mime
View raw message