Camel
  1. Camel
  2. CAMEL-2056

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major 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.
      1. camel-core.patch
        15 kB
        Martin Krasser

        Activity

        Hide
        Claus Ibsen added a comment -

        Closing old resolved issues

        Show
        Claus Ibsen added a comment - Closing old resolved issues
        Hide
        Claus Ibsen added a comment -

        Reworked patch to avoid ignoring charset issue. Also people should not use the converters directly but use the Camel TypeConverterRegistry.

        trunk: 825090.

        Show
        Claus Ibsen added a comment - Reworked patch to avoid ignoring charset issue. Also people should not use the converters directly but use the Camel TypeConverterRegistry. trunk: 825090.
        Hide
        Willem Jiang added a comment -

        Applied patch with thanks to Martin, also updated the camel-spring unit test with this patch.

        Trunk
        http://svn.apache.org/viewvc?rev=823495&view=rev

        Show
        Willem Jiang added a comment - Applied patch with thanks to Martin, also updated the camel-spring unit test with this patch. Trunk http://svn.apache.org/viewvc?rev=823495&view=rev
        Hide
        Martin Krasser added a comment -

        Attached patch.

        Show
        Martin Krasser added a comment - Attached patch.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development