Uploaded image for project: 'Commons BeanUtils'
  1. Commons BeanUtils
  2. BEANUTILS-449

LocaleConverters do not take the target type into account

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.3
    • 1.9.0
    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            oheger Oliver Heger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: