Otavio Rodolfo Piske created CAMEL-18685:
--------------------------------------------

             Summary: camel-file: charset conversions causing 
UnmappableCharacterException
                 Key: CAMEL-18685
                 URL: https://issues.apache.org/jira/browse/CAMEL-18685
             Project: Camel
          Issue Type: Bug
          Components: camel-file
            Reporter: Otavio Rodolfo Piske


In the file component, reading a file that contains an unmappable character 
causes the component to throw UnmappableCharacterException. 

 

This happens because, by default, the behavior for handling unmapped characters 
in the [Charset class is to report 
them|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/charset/CharsetDecoder.html#decode(java.nio.ByteBuffer)].
 

 

Ideally, we should allow configuring the behavior so that it can either be 
replaced or ignored. For instance, we can try tweaking the code to use 
something like (in FileOperations) to ignore errors:

 

 
{code:java}
Charset.forName(charset).newDecoder().onMalformedInput(CodingErrorAction.IGNORE).charset();
{code}
 

Ignore is just one of the options. We may also want to try to replace them (as 
Camel did prior to 2.20).

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to