camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [3/3] git commit: CAMEL-7375 Remove the parameter of encode which should be address when we get the payload from message body
Date Thu, 29 May 2014 08:49:56 GMT
CAMEL-7375 Remove the parameter of encode which should be address when we get the payload from
message body


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a0b96994
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a0b96994
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a0b96994

Branch: refs/heads/master
Commit: a0b9699441f7d60ff05e82ea3b0759af88dd8a78
Parents: c275dfb
Author: Willem Jiang <willem.jiang@gmail.com>
Authored: Thu May 29 16:48:18 2014 +0800
Committer: Willem Jiang <willem.jiang@gmail.com>
Committed: Thu May 29 16:49:28 2014 +0800

----------------------------------------------------------------------
 .../dataformat/barcode/BarcodeDataFormat.java   |  3 +--
 .../dataformat/barcode/BarcodeParameters.java   | 25 ++------------------
 .../barcode/BarcodeDataFormatTest.java          |  9 ++-----
 3 files changed, 5 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/a0b96994/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
b/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
index dee0b21..7e69787 100644
--- a/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
+++ b/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
@@ -222,11 +222,10 @@ public class BarcodeDataFormat implements DataFormat {
 
         // set values
         final String type = this.params.getType().toString();
-        final String encoding = this.params.getEncoding(); 
         
         // create code image  
         final BitMatrix matrix = writer.encode(
-                new String(payload.getBytes(encoding), encoding),
+                payload,
                 this.params.getFormat(), 
                 this.params.getWidth(), 
                 this.params.getHeight(), 

http://git-wip-us.apache.org/repos/asf/camel/blob/a0b96994/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeParameters.java
----------------------------------------------------------------------
diff --git a/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeParameters.java
b/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeParameters.java
index b1197f0..2804a59 100644
--- a/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeParameters.java
+++ b/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeParameters.java
@@ -41,11 +41,6 @@ public class BarcodeParameters {
     public static final int HEIGHT = 100;
     
     /**
-     * Default encoding: UTF-8
-     */
-    public static final String ENCODING = "UTF-8";
-    
-    /**
      * Default barcode format: QR-CODE
      */
     public static final BarcodeFormat FORMAT = BarcodeFormat.QR_CODE;
@@ -66,11 +61,6 @@ public class BarcodeParameters {
     private Integer height = HEIGHT;
     
     /**
-     * The message encoding.
-     */
-    private String encoding = ENCODING;
-    
-    /**
      * The barcode format (e.g. QR-Code, DataMatrix,...).
      */
     private BarcodeFormat format = FORMAT;
@@ -82,7 +72,6 @@ public class BarcodeParameters {
      *  <li>image type: PNG</li>
      *  <li>image width: 100px</li>
      *  <li>image heigth: 100px</li>
-     *  <li>encoding: UTF-8</li>
      *  <li>format: QR-Code</li>
      * </ul>
      */
@@ -95,12 +84,10 @@ public class BarcodeParameters {
      * @param type
      * @param width
      * @param height
-     * @param encoding
      * @param format
      */
     public BarcodeParameters(final BarcodeImageType type, final int width, 
-            final int height, final String encoding, final BarcodeFormat format) {
-        this.encoding = encoding;
+            final int height, final BarcodeFormat format) {
         this.height = height;
         this.width = width;
         this.type = type;
@@ -130,15 +117,7 @@ public class BarcodeParameters {
     public void setHeight(Integer height) {
         this.height = height;
     }
-
-    public String getEncoding() {
-        return encoding;
-    }
-
-    public void setEncoding(String encoding) {
-        this.encoding = encoding;
-    }
-
+   
     public BarcodeFormat getFormat() {
         return format;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/a0b96994/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatTest.java
----------------------------------------------------------------------
diff --git a/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatTest.java
b/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatTest.java
index 807778c..dad9387 100644
--- a/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatTest.java
+++ b/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatTest.java
@@ -45,7 +45,6 @@ public class BarcodeDataFormatTest {
         this.checkParams(BarcodeParameters.IMAGE_TYPE
                 , BarcodeParameters.WIDTH
                 , BarcodeParameters.HEIGHT
-                , BarcodeParameters.ENCODING
                 , BarcodeParameters.FORMAT
                 , barcodeDataFormat.getParams());
     }
@@ -60,7 +59,6 @@ public class BarcodeDataFormatTest {
         this.checkParams(BarcodeParameters.IMAGE_TYPE
                 , BarcodeParameters.WIDTH
                 , BarcodeParameters.HEIGHT
-                , BarcodeParameters.ENCODING
                 , BarcodeFormat.AZTEC
                 , barcodeDataFormat.getParams());
     }
@@ -73,7 +71,7 @@ public class BarcodeDataFormatTest {
         BarcodeDataFormat barcodeDataFormat = 
                 new BarcodeDataFormat(200, 250);
         this.checkParams(BarcodeParameters.IMAGE_TYPE
-                , 200, 250, BarcodeParameters.ENCODING
+                , 200, 250
                 , BarcodeParameters.FORMAT
                 , barcodeDataFormat.getParams());
     }
@@ -88,7 +86,6 @@ public class BarcodeDataFormatTest {
         this.checkParams(BarcodeImageType.JPG
                 , BarcodeParameters.WIDTH
                 , BarcodeParameters.HEIGHT
-                , BarcodeParameters.ENCODING
                 , BarcodeParameters.FORMAT
                 , barcodeDataFormat.getParams());
     }
@@ -103,7 +100,6 @@ public class BarcodeDataFormatTest {
                         , BarcodeFormat.AZTEC);
         this.checkParams(BarcodeImageType.JPG
                 , 200, 250
-                , BarcodeParameters.ENCODING
                 , BarcodeFormat.AZTEC
                 , barcodeDataFormat.getParams());
     }
@@ -226,11 +222,10 @@ public class BarcodeDataFormatTest {
      * @param params 
      */
     private void checkParams(BarcodeImageType imageType, int width, int height
-            , String encoding, BarcodeFormat format, BarcodeParameters params) {
+            , BarcodeFormat format, BarcodeParameters params) {
         assertEquals(params.getType(), imageType);
         assertTrue(params.getWidth() == width);
         assertTrue(params.getHeight() == height);
-        assertEquals(params.getEncoding(), encoding);
         assertEquals(params.getFormat(), format);
     }
 }


Mime
View raw message