Buggy code:
class TypeConverterDelegate { private static final Log logger = LogFactory . getLog ( TypeConverterDelegate . class ) ; private final PropertyEditorRegistrySupport propertyEditorRegistry ; private final Object targetObject ; public TypeConverterDelegate ( PropertyEditorRegistrySupport propertyEditorRegistry ) { } public TypeConverterDelegate ( PropertyEditorRegistrySupport propertyEditorRegistry , Object targetObject ) { } public < T > T convertIfNecessary ( Object newValue , Class < T > requiredType ) throws IllegalArgumentException { } public < T > T convertIfNecessary ( Object newValue , Class < T > requiredType , MethodParameter methodParam ) throws IllegalArgumentException { } public < T > T convertIfNecessary ( String propertyName , Object oldValue , Object newValue , Class < T > requiredType ) throws IllegalArgumentException { } public < T > T convertIfNecessary ( String propertyName , Object oldValue , Object newValue , Class < T > requiredType , MethodParameter methodParam ) throws IllegalArgumentException { } public Object convertIfNecessary ( Object oldValue , Object newValue , PropertyDescriptor descriptor ) throws IllegalArgumentException { } public Object convertIfNecessary ( Object oldValue , Object newValue , Field field ) throws IllegalArgumentException { } @ SuppressWarnings ( "unchecked" ) private < T > T convertIfNecessary ( String propertyName , Object oldValue , Object newValue , Class < T > requiredType , TypeDescriptor typeDescriptor ) throws IllegalArgumentException { Object convertedValue = newValue ; PropertyEditor editor = this . propertyEditorRegistry . findCustomEditor ( requiredType , propertyName ) ; ConversionService conversionService = this . propertyEditorRegistry . getConversionService ( ) ; if ( ( ( editor == null ) && ( conversionService != null ) ) && ( convertedValue != null ) ) { <START_BUG> TypeDescriptor sourceTypeDesc = new TypeDescriptor ( convertedValue ) ; <END_BUG> if ( conversionService . canConvert ( sourceTypeDesc , typeDescriptor ) ) { return ( ( T ) ( conversionService . convert ( convertedValue , sourceTypeDesc , typeDescriptor ) ) ) ; } } if ( ( editor != null ) || ( ( requiredType != null ) && ( ! ( ClassUtils . isAssignableValue ( requiredType , convertedValue ) ) ) ) ) { if ( ( ( ( requiredType != null ) && ( Collection . class . isAssignableFrom ( requiredType ) ) ) && ( convertedValue instanceof String ) ) && ( ( typeDescriptor . getMethodParameter ( ) ) != null ) ) { Class elementType = GenericCollectionTypeResolver . getCollectionParameterType ( typeDescriptor . getMethodParameter ( ) ) ; if ( ( elementType != null ) && ( Enum . class . isAssignableFrom ( elementType ) ) ) { convertedValue = StringUtils . commaDelimitedListToStringArray ( ( ( String ) ( convertedValue ) ) ) ; } } if ( editor == null ) { editor = findDefaultEditor ( requiredType , typeDescriptor ) ; } convertedValue = doConvertValue ( oldValue , convertedValue , requiredType , editor ) ; } if ( requiredType != null ) { if ( convertedValue != null ) { if ( requiredType . isArray ( ) ) { if ( ( convertedValue instanceof String ) && ( Enum . class . isAssignableFrom ( requiredType . getComponentType ( ) ) ) ) { convertedValue = StringUtils . commaDelimitedListToStringArray ( ( ( String ) ( convertedValue ) ) ) ; } return ( ( T ) ( convertToTypedArray ( convertedValue , propertyName , requiredType . getComponentType ( ) ) ) ) ; } else if ( convertedValue instanceof Collection ) { convertedValue = convertToTypedCollection ( ( ( Collection ) ( convertedValue ) ) , propertyName , requiredType , typeDescriptor ) ; } else if ( convertedValue instanceof Map ) { convertedValue = convertToTypedMap ( ( ( Map ) ( convertedValue ) ) , propertyName , requiredType , typeDescriptor ) ; } if ( ( convertedValue . getClass ( ) . isArray ( ) ) && ( ( Array . getLength ( convertedValue ) ) == 1 ) ) { convertedValue = Array . get ( convertedValue , 0 ) ; } if ( ( String . class . equals ( requiredType ) ) && ( ClassUtils . isPrimitiveOrWrapper ( convertedValue . getClass ( ) ) ) ) { return ( ( T ) ( convertedValue . toString ( ) ) ) ; } else if ( ( convertedValue instanceof String ) && ( ! ( requiredType . isInstance ( convertedValue ) ) ) ) { if ( ( ! ( requiredType . isInterface ( ) ) ) && ( ! ( requiredType . isEnum ( ) ) ) ) { try { Constructor strCtor = requiredType . getConstructor ( String . class ) ; return ( ( T ) ( BeanUtils . instantiateClass ( strCtor , convertedValue ) ) ) ; } catch ( NoSuchMethodException ex ) { if ( TypeConverterDelegate . logger . isTraceEnabled ( ) ) { TypeConverterDelegate . logger . trace ( ( ( "No<seq2seq4repair_space>String<seq2seq4repair_space>constructor<seq2seq4repair_space>found<seq2seq4repair_space>on<seq2seq4repair_space>type<seq2seq4repair_space>[" + ( requiredType . getName ( ) ) ) + "]" ) , ex ) ; } } catch ( Exception ex ) { if ( TypeConverterDelegate . logger . isDebugEnabled ( ) ) { TypeConverterDelegate . logger . debug ( ( ( "Construction<seq2seq4repair_space>via<seq2seq4repair_space>String<seq2seq4repair_space>failed<seq2seq4repair_space>for<seq2seq4repair_space>type<seq2seq4repair_space>[" + ( requiredType . getName ( ) ) ) + "]" ) , ex ) ; } } } String trimmedValue = ( ( String ) ( convertedValue ) ) . trim ( ) ; if ( ( requiredType . isEnum ( ) ) && ( "" . equals ( trimmedValue ) ) ) { return null ; } convertedValue = attemptToConvertStringToEnum ( requiredType , trimmedValue , convertedValue ) ; } } if ( ! ( ClassUtils . isAssignableValue ( requiredType , convertedValue ) ) ) { StringBuilder msg = new StringBuilder ( ) ; msg . append ( "Cannot<seq2seq4repair_space>convert<seq2seq4repair_space>value<seq2seq4repair_space>of<seq2seq4repair_space>type<seq2seq4repair_space>[" ) . append ( ClassUtils . getDescriptiveType ( newValue ) ) ; msg . append ( "]<seq2seq4repair_space>to<seq2seq4repair_space>required<seq2seq4repair_space>type<seq2seq4repair_space>[" ) . append ( ClassUtils . getQualifiedName ( requiredType ) ) . append ( "]" ) ; if ( propertyName != null ) { msg . append ( "<seq2seq4repair_space>for<seq2seq4repair_space>property<seq2seq4repair_space>'" ) . append ( propertyName ) . append ( "'" ) ; }

Fix:
TypeDescriptor sourceTypeDesc = TypeDescriptor . forObject ( convertedValue ) ;