1. Camel
  2. CAMEL-2056

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


    • 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:
    • Patch Info:
      Patch Available


      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


        Jeff Turner made changes -
        Project Import Sat Nov 27 00:14:50 EST 2010 [ 1290834890113 ]
        Claus Ibsen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Willem Jiang made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 2.1.0 [ 12002 ]
        Willem Jiang made changes -
        Assignee Willem Jiang [ njiang ]
        Martin Krasser made changes -
        Link This issue is related to CAMEL-1573 [ CAMEL-1573 ]
        Martin Krasser made changes -
        Link This issue is related to CAMEL-400 [ CAMEL-400 ]
        Martin Krasser made changes -
        Field Original Value New Value
        Attachment camel-core.patch [ 18507 ]
        Martin Krasser created issue -


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


            • Created: