Repository: camel
Updated Branches:
  refs/heads/camel-2.18.x 6ef2384e5 -> b21d06acd
  refs/heads/camel-2.19.x 2ba7fb43c -> 3990ebe4b
  refs/heads/master 22d5241b5 -> 3db951632


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/4b06e5fe
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4b06e5fe
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4b06e5fe

Branch: refs/heads/master
Commit: 4b06e5fe5f0d4e4eba1de9c5f10eb65ef5b6bf74
Parents: 22d5241
Author: Bhun Kho <[email protected]>
Authored: Fri Jun 9 18:22:45 2017 +0200
Committer: Claus Ibsen <[email protected]>
Committed: Fri Jun 9 19:09:29 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/4b06e5fe/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

Reply via email to