Oliver Heger created BEANUTILS-449:
--------------------------------------

             Summary: LocaleConverters do not take the target type into account
                 Key: BEANUTILS-449
                 URL: https://issues.apache.org/jira/browse/BEANUTILS-449
             Project: Commons BeanUtils
          Issue Type: Bug
          Components: ConvertUtils & Converters
    Affects Versions: 1.8.3
            Reporter: Oliver Heger
             Fix For: LATER THAN 1.8.4


The base implementation of the {{convert(Class type, Object value, String 
pattern)}} method in {{BaseLocaleConverter}} completely ignores the _type_ 
parameter which defines the desired target class of the conversion. Obviously, 
it is assumed that the converter is correctly registered for the class it 
supports.

Converters should check whether they support the passed in target type and 
throw an exception if not. This would lead to more robust code providing 
meaningful error messages. Otherwise, a wrong converter registration is harder 
to detect; it would probably lead to {{ClassCastException}} errors elsewhere in 
the application.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to