You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/09/30 16:26:12 UTC

[GitHub] [skywalking] muse-dev[bot] commented on a change in pull request #5601: Use explicit charset instead of default charset

muse-dev[bot] commented on a change in pull request #5601:
URL: https://github.com/apache/skywalking/pull/5601#discussion_r497642517



##########
File path: apm-sniffer/apm-sdk-plugin/avro-plugin/src/main/java/org/apache/skywalking/apm/plugin/avro/SWServerRPCPlugin.java
##########
@@ -50,7 +51,7 @@ public void serverReceiveRequest(RPCContext context) {
         while (items.hasNext()) {
             items = items.next();
             ByteBuffer buffer = (ByteBuffer) meta.get(new Utf8(items.getHeadKey()));
-            items.setHeadValue(new String(buffer.array()));
+            items.setHeadValue(new String(buffer.array(), StandardCharsets.UTF_8));

Review comment:
       *ByteBufferBackingArray:*  ByteBuffer.array() shouldn't be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org