Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.8.3
-
None
Description
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.