Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Nightly Builds
-
None
-
commons-beanutils-20070610-src.zip
Description
Either lookup(Class, Class) or convert(Object, Class) method doesn't work correctly in class ConvertUtilsBean.
Problematic is the case when target class is String.
The code from convert(..) which doesn't work:
Object converted = value;
Converter converter = lookup(sourceType, targetType);
if (converter != null) {
if (log.isTraceEnabled())
converted = converter.convert(targetType, value);
}
// here we already have converted value (String), but we will rewrite it by default .toString() - it's a bug
if (targetType == String.class && value != null)