From d6f03e6033b42f60c8138d421803d179960503ef Mon Sep 17 00:00:00 2001 From: emeroad Date: Fri, 30 Aug 2024 19:12:01 +0900 Subject: [PATCH] [#11440] Bump commons-lang3 from 3.16.0 to 3.17.0 --- .../common/server/bo/RandomTSpan.java | 25 +++++++++++-------- pom.xml | 2 +- .../thrift/sender/UdpDataSenderTest.java | 9 +++++-- .../web/mapper/FilteringSpanDecoderTest.java | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/RandomTSpan.java b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/RandomTSpan.java index c2f443f590df..94b495c2ad83 100644 --- a/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/RandomTSpan.java +++ b/commons-server/src/test/java/com/navercorp/pinpoint/common/server/bo/RandomTSpan.java @@ -48,11 +48,11 @@ public TSpan randomTSpan() { tSpan.setParentSpanId(random.nextInt(0, 100000)); tSpan.setStartTime(System.currentTimeMillis() + random.nextInt(0, 1000)); tSpan.setElapsed(random.nextInt(0, 2000)); - tSpan.setRpc(RandomStringUtils.random(10)); + tSpan.setRpc(randomAlphanumeric(10)); tSpan.setServiceType(randomServerServiceType()); - tSpan.setEndPoint(RandomStringUtils.random(20)); - tSpan.setRemoteAddr(RandomStringUtils.random(20)); + tSpan.setEndPoint(randomAlphanumeric(20)); + tSpan.setRemoteAddr(randomAlphanumeric(20)); List tAnnotationList = randomTAnnotationList(); if (CollectionUtils.isNotEmpty(tAnnotationList)) { @@ -73,7 +73,7 @@ public TSpan randomTSpan() { if (random.nextBoolean()) { TIntStringValue exceptionInfo = new TIntStringValue(); exceptionInfo.setIntValue(random.nextInt(0, 5000)); - exceptionInfo.setStringValue(RandomStringUtils.random(100)); + exceptionInfo.setStringValue(randomAlphanumeric(100)); tSpan.setExceptionInfo(exceptionInfo); } tSpan.setLoggingTransactionInfo((byte) random.nextInt(0, 256)); @@ -99,7 +99,7 @@ public TAnnotation randomTAnnotation(int key) { // sort order tAnnotation.setKey(key); TAnnotationValue tAnnotationValue = new TAnnotationValue(); - tAnnotationValue.setStringValue(RandomStringUtils.random(10)); + tAnnotationValue.setStringValue(randomAlphanumeric(10)); tAnnotation.setValue(tAnnotationValue); return tAnnotation; } @@ -111,10 +111,10 @@ public TSpanEvent randomTSpanEvent(short sequence) { tSpanEvent.setSequence(sequence); tSpanEvent.setStartElapsed(random.nextInt(0, 1000)); tSpanEvent.setEndElapsed(random.nextInt(0, 1000)); -// tSpanEvent.setRpc(RandomStringUtils.random(10)); +// tSpanEvent.setRpc(randomAlphanumeric(10)); // Database (2000 ~ 2899) tSpanEvent.setServiceType((short) random.nextInt(2000, 2889)); - tSpanEvent.setEndPoint(RandomStringUtils.random(10)); + tSpanEvent.setEndPoint(randomAlphanumeric(10)); List tAnnotationList = randomTAnnotationList(); if (CollectionUtils.isNotEmpty(tAnnotationList)) { @@ -123,7 +123,7 @@ public TSpanEvent randomTSpanEvent(short sequence) { tSpanEvent.setDepth(random.nextInt(0, 256)); tSpanEvent.setNextSpanId(random.nextLong()); - tSpanEvent.setDestinationId(RandomStringUtils.random(20)); + tSpanEvent.setDestinationId(randomAlphanumeric(20)); tSpanEvent.setApiId(random.nextInt(0, 65535)); tSpanEvent.setNextAsyncId(random.nextInt()); @@ -131,7 +131,7 @@ public TSpanEvent randomTSpanEvent(short sequence) { if (random.nextBoolean()) { TIntStringValue exceptionInfo = new TIntStringValue(); exceptionInfo.setIntValue(random.nextInt(0, 5000)); - exceptionInfo.setStringValue(RandomStringUtils.random(100)); + exceptionInfo.setStringValue(randomAlphanumeric(100)); tSpanEvent.setExceptionInfo(exceptionInfo); } @@ -154,10 +154,15 @@ public TSpanChunk randomTSpanChunk() { tSpanChunk.setTransactionId(TransactionIdUtils.formatByteBuffer("agent", System.currentTimeMillis(), random.nextLong(0, Long.MAX_VALUE))); tSpanChunk.setSpanId(random.nextLong()); - tSpanChunk.setEndPoint(RandomStringUtils.random(20)); + tSpanChunk.setEndPoint(randomAlphanumeric(20)); // tSpanChunk.setSpanEventList() tSpanChunk.setApplicationServiceType(randomServerServiceType()); return tSpanChunk; } + + + private String randomAlphanumeric(int count) { + return RandomStringUtils.insecure().nextAlphabetic(count); + } } diff --git a/pom.xml b/pom.xml index 06a9baec3538..a414a3b835e5 100644 --- a/pom.xml +++ b/pom.xml @@ -1204,7 +1204,7 @@ org.apache.commons commons-lang3 - 3.16.0 + 3.17.0 commons-lang diff --git a/thrift-datasender/src/test/java/com/navercorp/pinpoint/thrift/sender/UdpDataSenderTest.java b/thrift-datasender/src/test/java/com/navercorp/pinpoint/thrift/sender/UdpDataSenderTest.java index 6de8adf7b911..c0b82977982e 100644 --- a/thrift-datasender/src/test/java/com/navercorp/pinpoint/thrift/sender/UdpDataSenderTest.java +++ b/thrift-datasender/src/test/java/com/navercorp/pinpoint/thrift/sender/UdpDataSenderTest.java @@ -54,6 +54,7 @@ public class UdpDataSenderTest { private final int PORT = SocketUtils.findAvailableUdpPort(9009); private final BiPredicate> maxBytesLengthPredicate = new MaxBytesLengthPredicate<>(logger, ThriftUdpMessageSerializer.UDP_MAX_PACKET_LENGTH); + RandomStringUtils randomString = RandomStringUtils.insecure(); @BeforeAll public static void before() { @@ -105,7 +106,7 @@ public void sendAndFlushCheck() { @Test public void sendExceedData() throws InterruptedException { - String random = RandomStringUtils.randomAlphabetic(ThriftUdpMessageSerializer.UDP_MAX_PACKET_LENGTH + 100); + String random = randomAlphabetic(ThriftUdpMessageSerializer.UDP_MAX_PACKET_LENGTH + 100); TAgentInfo agentInfo = new TAgentInfo(); agentInfo.setAgentId(random); boolean limit = sendMessage_getLimit(agentInfo, 1000); @@ -116,7 +117,7 @@ public void sendExceedData() throws InterruptedException { @Test public void sendData() throws InterruptedException { - String random = RandomStringUtils.randomAlphabetic(100); + String random = randomAlphabetic(100); TAgentInfo agentInfo = new TAgentInfo(); agentInfo.setAgentId(random); boolean limit = sendMessage_getLimit(agentInfo, 1000); @@ -125,6 +126,10 @@ public void sendData() throws InterruptedException { Assertions.assertFalse(limit); } + private String randomAlphabetic(int count) { + return randomString.nextAlphabetic(count); + } + private boolean sendMessage_getLimit(TBase tbase, long waitTimeMillis) throws InterruptedException { final AtomicBoolean limitCounter = new AtomicBoolean(false); diff --git a/web/src/test/java/com/navercorp/pinpoint/web/mapper/FilteringSpanDecoderTest.java b/web/src/test/java/com/navercorp/pinpoint/web/mapper/FilteringSpanDecoderTest.java index b7ff32066a7d..c60d7ee338a2 100644 --- a/web/src/test/java/com/navercorp/pinpoint/web/mapper/FilteringSpanDecoderTest.java +++ b/web/src/test/java/com/navercorp/pinpoint/web/mapper/FilteringSpanDecoderTest.java @@ -164,7 +164,7 @@ private static SpanBo createSpanBo(String applicationId) { } private static TransactionId createTransactionId() { - String agentId = RandomStringUtils.randomAlphanumeric(4, 24); + String agentId = RandomStringUtils.insecure().nextAlphanumeric(4, 24); long boundAgentStartTime = System.currentTimeMillis(); long originAgentStartTime = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);