You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/04/13 13:35:18 UTC

[camel] 08/12: CAMEL-17962: cleanup duplicated charset features in camel-protobuf

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

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

commit 4a5d0d5ca4a0a0bf774063d1f8263443f4bac8a0
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Wed Apr 13 13:54:59 2022 +0200

    CAMEL-17962: cleanup duplicated charset features in camel-protobuf
---
 .../java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java b/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java
index 3c3ccf61c3f..d79ce28489d 100644
--- a/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java
+++ b/components/camel-protobuf/src/main/java/org/apache/camel/dataformat/protobuf/ProtobufDataFormat.java
@@ -20,6 +20,7 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.lang.reflect.Method;
+import java.nio.charset.StandardCharsets;
 import java.util.Map;
 
 import com.google.protobuf.Message;
@@ -135,7 +136,7 @@ public class ProtobufDataFormat extends ServiceSupport
 
         String contentTypeHeader = CONTENT_TYPE_HEADER_NATIVE;
         if (contentTypeFormat.equals(CONTENT_TYPE_FORMAT_JSON)) {
-            IOUtils.write(JsonFormat.printer().print(inputMessage), outputStream, "UTF-8");
+            IOUtils.write(JsonFormat.printer().print(inputMessage), outputStream, StandardCharsets.UTF_8);
             contentTypeHeader = CONTENT_TYPE_HEADER_JSON;
         } else if (contentTypeFormat.equals(CONTENT_TYPE_FORMAT_NATIVE)) {
             inputMessage.writeTo(outputStream);