Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-15405

camel file component with charset throw UnmappableCharacterException while writing a file with special characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • fuse-7.7-GA
    • Camel
    • None
    • False
    • False
    • % %
    • Undefined
    • Hide
      • This issue doesn't occur in Red Hat Fuse 6.3.
      • Create following route with jboss.fuse.bom.version 7.6.0.fuse-760027-redhat-00001 or of Red Hat Fuse 7.7.
           <camelContext id="_context1" xmlns="http://camel.apache.org/schema/blueprint">
                <route>
        <from id="_from14" uri="file:C:\Users\chand\Downloads\testfiletransfer\incoming?copyAndDeleteOnRenameFail=false&amp;delay=90000&amp;fileExist=Fail&amp;greedy=true&amp;include=AR080.*&amp;move=.done\${file:name}${date:now:MM-dd-yy_HHmmssSSSS}&amp;readLock=rename&amp;readLockLoggingLevel=INFO&amp;readLockMinAge=10000&amp;readLockTimeout=20000&amp;scheduler=quartz2&amp;scheduler.cron=0/2 * * * * ?&amp;sortBy=file:modified"/>
        <to id="_to14" uri="file:C:\Users\chand\Downloads\testfiletransfer\outgoing?charset=windows-1252&amp;fileExist=Fail&amp;autoCreate=false"/>
         <log id="_log14" loggingLevel="INFO" message="Route:AR080 - Processed file ${file:name}"/>
        </route>
            </camelContext>
        
      • Run it in Red Hat Fuse 7.7 GA or as "Local Camel Context" from any IDE.
      • Place attached file AR080 in incoming folder so that route can consume it. This file has special character.
      • Check logs, we would observe exception
        Caused by: java.nio.charset.UnmappableCharacterException: Input length = 1
        	at java.nio.charset.CoderResult.throwException(Unknown Source) ~[?:1.8.0_251]
        	at sun.nio.cs.StreamEncoder.implWrite(Unknown Source) ~[?:1.8.0_251]
        	at sun.nio.cs.StreamEncoder.write(Unknown Source) ~[?:1.8.0_251]
        	at java.io.OutputStreamWriter.write(Unknown Source) ~[?:1.8.0_251]
        	at java.io.BufferedWriter.write(Unknown Source) ~[?:1.8.0_251]
        	at org.apache.camel.util.IOHelper.copy(IOHelper.java:246) ~[!/:2.21.0.fuse-760027-redhat-00001]
        	at org.apache.camel.component.file.FileOperations.writeFileByReaderWithCharset(FileOperations.java:464) ~[!/:2.21.0.fuse-760027-redhat-00001]
        	at org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:330) ~[!/:2.21.0.fuse-760027-redhat-00001]
        	... 19 more
        
      Show
      This issue doesn't occur in Red Hat Fuse 6.3. Create following route with jboss.fuse.bom.version 7.6.0.fuse-760027-redhat-00001 or of Red Hat Fuse 7.7. <camelContext id= "_context1" xmlns= "http: //camel.apache.org/schema/blueprint" > <route> <from id= "_from14" uri= "file:C:\Users\chand\Downloads\testfiletransfer\incoming?copyAndDeleteOnRenameFail= false &amp;delay=90000&amp;fileExist=Fail&amp;greedy= true &amp;include=AR080.*&amp;move=.done\${file:name}${date:now:MM-dd-yy_HHmmssSSSS}&amp;readLock=rename&amp;readLockLoggingLevel=INFO&amp;readLockMinAge=10000&amp;readLockTimeout=20000&amp;scheduler=quartz2&amp;scheduler.cron=0/2 * * * * ?&amp;sortBy=file:modified" /> <to id= "_to14" uri= "file:C:\Users\chand\Downloads\testfiletransfer\outgoing?charset=windows-1252&amp;fileExist=Fail&amp;autoCreate= false " /> <log id= "_log14" loggingLevel= "INFO" message= "Route:AR080 - Processed file ${file:name}" /> </route> </camelContext> Run it in Red Hat Fuse 7.7 GA or as "Local Camel Context" from any IDE. Place attached file AR080 in incoming folder so that route can consume it. This file has special character. Check logs, we would observe exception Caused by: java.nio.charset.UnmappableCharacterException: Input length = 1 at java.nio.charset.CoderResult.throwException(Unknown Source) ~[?:1.8.0_251] at sun.nio.cs.StreamEncoder.implWrite(Unknown Source) ~[?:1.8.0_251] at sun.nio.cs.StreamEncoder.write(Unknown Source) ~[?:1.8.0_251] at java.io.OutputStreamWriter.write(Unknown Source) ~[?:1.8.0_251] at java.io.BufferedWriter.write(Unknown Source) ~[?:1.8.0_251] at org.apache.camel.util.IOHelper.copy(IOHelper.java:246) ~[!/:2.21.0.fuse-760027-redhat-00001] at org.apache.camel.component.file.FileOperations.writeFileByReaderWithCharset(FileOperations.java:464) ~[!/:2.21.0.fuse-760027-redhat-00001] at org.apache.camel.component.file.FileOperations.storeFile(FileOperations.java:330) ~[!/:2.21.0.fuse-760027-redhat-00001] ... 19 more

      1. AR080
        46 kB
      2. reproducer.zip
        15 kB

            yfang@redhat.com Freeman(Yue) Fang
            rhn-support-cpandey Chandra Shekhar Pandey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: