camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [5/6] camel git commit: Actual number of bytes can be greater than the string length due to multibyte chars
Date Fri, 09 Jun 2017 17:13:26 GMT
Actual number of bytes can be greater than the string length due to multibyte chars


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

Branch: refs/heads/camel-2.18.x
Commit: 81baf0ebf672a5e1e59fd68bdf61115c27b23aca
Parents: 6ef2384
Author: Bhun Kho <bhun.kho@ictu.nl>
Authored: Fri Jun 9 18:22:45 2017 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jun 9 19:13:05 2017 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/converter/NIOConverter.java  | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/81baf0eb/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java b/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
index fbb573f..fabaa0d 100644
--- a/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/converter/NIOConverter.java
@@ -84,7 +84,6 @@ public final class NIOConverter {
 
     @Converter
     public static ByteBuffer toByteBuffer(String value, Exchange exchange) {
-        ByteBuffer buf = ByteBuffer.allocate(value.length());
         byte[] bytes = null;
         if (exchange != null) {
             String charsetName = exchange.getProperty(Exchange.CHARSET_NAME, String.class);
@@ -99,9 +98,7 @@ public final class NIOConverter {
         if (bytes == null) {
             bytes = value.getBytes();
         }
-        buf.put(bytes);
-        buf.flip();
-        return buf;
+        return ByteBuffer.wrap(bytes);
     }
 
     @Converter


Mime
View raw message