Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-5172

TypeConverter - Tighten up API to rethrow failed exception during type conversion, and introduce new API for try to convert

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.8.5, 2.9.3, 2.10.0
    • camel-core
    • None
    • Unknown

    Description

      The org.apache.camel.TypeConverter API would not propagate exceptions that would occur during type conversion back to the caller. But instead return null.

      We should tighten this up and introduce a new API for trying to convert, so what we would have is

      • convertTo = converts, and throws exception if failure during conversion, can return null, if no value to convert, or no type converter exists to do this
      • mandatoryConvertTo = convertTo + will throw exception if no value, eg it never returns null
      • new tryConvertTo = convertTo but will catch exceptions and return null (like the old behavior)

      This introduces an API change in TypeConverter. But it is more intuitive. There is some internal logic that needs to be adjust a bit due they rely on the old behavior.

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              davsclaus Claus Ibsen
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: