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

Optional charset parameter in convertBodyTo is ignored by most converters in IOConverter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.1.0
    • camel-core
    • None
    • Patch Available

    Description

      Most of the converters in IOConverter that do a char <-> byte conversion ignore the charset given as second argument to convertBodyTo. The attached patch fixes this.

      • For relevant converter methods, it introduces an additional second Exchange parameter from which the desired charset is obtained.
      • For backwards compatibility to code that uses the IOConverter directly, a one-parameter version of these methods was kept but the @Converter annotation was removed (Camel doesn't allow overloaded static type converter methods to be registered i.e. they overwrite in other in the registry).
      • The patch furthermore removes existing redundancies in code like getting the charset from the exchange, check if the exchange is null etc.
      • The String->byte[] converter from ObjectConverter was moved to IOConverter because its implementation is more closely related to other methods in this converter class.

      Attachments

        1. camel-core.patch
          15 kB
          Martin Krasser
        There are no Sub-Tasks for this issue.

        Activity

          People

            njiang Willem Jiang
            mrt1nz Martin Krasser
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: