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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.1.0
    • Component/s: camel-core
    • Labels:
      None
    • Patch Info:
      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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: