You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2018/02/21 12:43:24 UTC

[camel] branch camel-2.19.x updated: CAMEL-12284: camel-beanio - Set encoding option does not work

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

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


The following commit(s) were added to refs/heads/camel-2.19.x by this push:
     new 744f641  CAMEL-12284: camel-beanio - Set encoding option does not work
744f641 is described below

commit 744f6419e5a6d10d33e36e7aa14abed40f4a177e
Author: Claus Ibsen <cl...@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 c01350b..f2ce2b9 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
@@ -191,7 +191,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 710b32c..0eb68ea 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
@@ -27,7 +27,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
davsclaus@apache.org.