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

Simple SFTP-to-File integration with charset options fails

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Unknown

      Description

      Simple SFTP-to-File integrations with charset conversion like:

      from("sftp://sample@localhost:2222/in?password=password&delete=true&charset=ISO-8859-1")
          .to("file:/tmp/samples-camel/SftpToFileTest/out?charset=UTF-8");
      

      fails to output a file in /tmp/samples-camel/SftpToFileTest/out/ correctly. Depending on the combinations, it sometimes converts the charset wrongly and sometimes it simply doesn't output a file to the target dir.

      The root cause is that SftpOperations puts ByteArrayOutputStream instead of byte[] or InputStream to the exchange file body when retrieving a file:
      https://github.com/apache/camel/blob/camel-2.22.0/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java#L718-L720
      which then results in no converter from OutputStream to java.io.Reader being found in GenericFileConverter downstream, and thus the File producer handles a RemoteFile awkwardly when outputting a file.

        Attachments

        1. SftpToFileTest.zip
          2 kB
          Tadayoshi Sato

          Issue Links

            Activity

              People

              • Assignee:
                tadayosi Tadayoshi Sato
                Reporter:
                tadayosi Tadayoshi Sato
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: