This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new d1a19ae09b0 CAMEL-17962: cleanup duplicated charset features in
camel-netty (#7440)
d1a19ae09b0 is described below
commit d1a19ae09b0bb22578aafbef0698829633e77957
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Wed Apr 13 17:51:10 2022 +0200
CAMEL-17962: cleanup duplicated charset features in camel-netty (#7440)
---
.../main/java/org/apache/camel/component/netty/NettyConverter.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConverter.java
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConverter.java
index f2eaca6027d..6b1c54b4041 100644
---
a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConverter.java
+++
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyConverter.java
@@ -20,7 +20,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
@@ -62,13 +62,13 @@ public final class NettyConverter {
}
@Converter
- public static String toString(ByteBuf buffer, Exchange exchange) throws
UnsupportedEncodingException {
+ public static String toString(ByteBuf buffer, Exchange exchange) {
byte[] bytes = toByteArray(buffer, exchange);
// use type converter as it can handle encoding set on the Exchange
if (exchange != null) {
return
exchange.getContext().getTypeConverter().convertTo(String.class, exchange,
bytes);
}
- return new String(bytes, "UTF-8");
+ return new String(bytes, StandardCharsets.UTF_8);
}
@Converter