diff --git a/client/pom.xml b/client/pom.xml index 9387eb3b68c3bf21a5316231dec437449284bab0..db5bb19825ce006c6fbb95750a75d4abfac18391 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -47,10 +47,6 @@ org.apache.commons commons-lang3 - - commons-codec - commons-codec - io.opentracing opentracing-api diff --git a/client/src/main/java/org/apache/rocketmq/client/trace/TraceView.java b/client/src/main/java/org/apache/rocketmq/client/trace/TraceView.java index e78d37ab2cdbd4c5f0ece7d43aca814f1f44eb20..7601221cded8fcda3670f34ab15adad56d927671 100644 --- a/client/src/main/java/org/apache/rocketmq/client/trace/TraceView.java +++ b/client/src/main/java/org/apache/rocketmq/client/trace/TraceView.java @@ -17,9 +17,9 @@ package org.apache.rocketmq.client.trace; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; -import org.apache.commons.codec.Charsets; import org.apache.rocketmq.common.message.MessageExt; public class TraceView { @@ -40,7 +40,7 @@ public class TraceView { public static List decodeFromTraceTransData(String key, MessageExt messageExt) { List messageTraceViewList = new ArrayList(); - String messageBody = new String(messageExt.getBody(), Charsets.UTF_8); + String messageBody = new String(messageExt.getBody(), StandardCharsets.UTF_8); if (messageBody == null || messageBody.length() <= 0) { return messageTraceViewList; } diff --git a/client/src/test/java/org/apache/rocketmq/client/trace/TraceViewTest.java b/client/src/test/java/org/apache/rocketmq/client/trace/TraceViewTest.java index b1fdbaf965ad1d6fe30e35ea9fdcc672a52b29e2..0397db256abf9e3fb7e3dc2d822ee5ab90b1754f 100644 --- a/client/src/test/java/org/apache/rocketmq/client/trace/TraceViewTest.java +++ b/client/src/test/java/org/apache/rocketmq/client/trace/TraceViewTest.java @@ -17,12 +17,12 @@ package org.apache.rocketmq.client.trace; -import org.apache.commons.codec.Charsets; import org.apache.rocketmq.common.message.MessageExt; import org.apache.rocketmq.common.message.MessageType; import org.junit.Assert; import org.junit.Test; +import java.nio.charset.StandardCharsets; import java.util.List; public class TraceViewTest { @@ -46,7 +46,7 @@ public class TraceViewTest { .append(true).append(TraceConstants.FIELD_SPLITOR) .toString(); MessageExt message = new MessageExt(); - message.setBody(messageBody.getBytes(Charsets.UTF_8)); + message.setBody(messageBody.getBytes(StandardCharsets.UTF_8)); String key = "AC1415116D1418B4AAC217FE1B4E0000"; List traceViews = TraceView.decodeFromTraceTransData(key, message); Assert.assertEquals(traceViews.size(), 1);