未验证 提交 7519a53c 编写于 作者: H huangli 提交者: GitHub

[ISSUE 3333] Remove commons-codes dependency (#3334)

上级 fea769da
...@@ -47,10 +47,6 @@ ...@@ -47,10 +47,6 @@
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency> <dependency>
<groupId>io.opentracing</groupId> <groupId>io.opentracing</groupId>
<artifactId>opentracing-api</artifactId> <artifactId>opentracing-api</artifactId>
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
package org.apache.rocketmq.client.trace; package org.apache.rocketmq.client.trace;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.codec.Charsets;
import org.apache.rocketmq.common.message.MessageExt; import org.apache.rocketmq.common.message.MessageExt;
public class TraceView { public class TraceView {
...@@ -40,7 +40,7 @@ public class TraceView { ...@@ -40,7 +40,7 @@ public class TraceView {
public static List<TraceView> decodeFromTraceTransData(String key, MessageExt messageExt) { public static List<TraceView> decodeFromTraceTransData(String key, MessageExt messageExt) {
List<TraceView> messageTraceViewList = new ArrayList<TraceView>(); List<TraceView> messageTraceViewList = new ArrayList<TraceView>();
String messageBody = new String(messageExt.getBody(), Charsets.UTF_8); String messageBody = new String(messageExt.getBody(), StandardCharsets.UTF_8);
if (messageBody == null || messageBody.length() <= 0) { if (messageBody == null || messageBody.length() <= 0) {
return messageTraceViewList; return messageTraceViewList;
} }
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
package org.apache.rocketmq.client.trace; 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.MessageExt;
import org.apache.rocketmq.common.message.MessageType; import org.apache.rocketmq.common.message.MessageType;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
public class TraceViewTest { public class TraceViewTest {
...@@ -46,7 +46,7 @@ public class TraceViewTest { ...@@ -46,7 +46,7 @@ public class TraceViewTest {
.append(true).append(TraceConstants.FIELD_SPLITOR) .append(true).append(TraceConstants.FIELD_SPLITOR)
.toString(); .toString();
MessageExt message = new MessageExt(); MessageExt message = new MessageExt();
message.setBody(messageBody.getBytes(Charsets.UTF_8)); message.setBody(messageBody.getBytes(StandardCharsets.UTF_8));
String key = "AC1415116D1418B4AAC217FE1B4E0000"; String key = "AC1415116D1418B4AAC217FE1B4E0000";
List<TraceView> traceViews = TraceView.decodeFromTraceTransData(key, message); List<TraceView> traceViews = TraceView.decodeFromTraceTransData(key, message);
Assert.assertEquals(traceViews.size(), 1); Assert.assertEquals(traceViews.size(), 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册