This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 495dd3f  CAMEL-12284: camel-beanio - Set encoding option does not work
495dd3f is described below

commit 495dd3f04a890b810b194ae5b138169be21c2da2
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Feb 21 13:42:09 2018 +0100

    CAMEL-12284: camel-beanio - Set encoding option does not work
---
 .../java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java  | 7 +++++++
 .../camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml   | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
 
b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
index 1ef854d..48e974f 100644
--- 
a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
+++ 
b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
@@ -208,7 +208,14 @@ public class BeanIODataFormat extends ServiceSupport 
implements DataFormat, Data
         configuration.setIgnoreInvalidRecords(ignoreInvalidRecords);
     }
 
+    public void setEncoding(String encoding) {
+        setEncoding(Charset.forName(encoding));
+    }
+
     public void setEncoding(Charset encoding) {
+        if (encoding == null) {
+            throw new IllegalArgumentException("Charset encoding is null");
+        }
         configuration.setEncoding(encoding);
     }
 
diff --git 
a/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
 
b/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
index cc33b84..d4c5067 100644
--- 
a/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
+++ 
b/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/SpringBeanIODataFormatSimpleTest.xml
@@ -29,7 +29,7 @@
   <camelContext xmlns="http://camel.apache.org/schema/spring";>
     <!-- setup beanio data format -->
     <dataFormats>
-      <beanio id="myBeanio" 
mapping="org/apache/camel/dataformat/beanio/mappings.xml" 
streamName="employeeFile"/>
+      <beanio id="myBeanio" 
mapping="org/apache/camel/dataformat/beanio/mappings.xml" 
streamName="employeeFile" encoding="UTF-8"/>
     </dataFormats>
 
     <route>

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.

Reply via email to