From de38cb1db25b6bec8ec49cca865b8996d829a9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Vidal=20Dom=C3=ADnguez?= Date: Fri, 29 Nov 2024 15:16:11 +0100 Subject: [PATCH] Add subsequence for the stringbuffer --- .../trace/instrumentation/java/lang/StringBuilderCallSite.java | 1 + .../instrumentation/java/lang/StringBuilderCallSiteTest.groovy | 1 + 2 files changed, 2 insertions(+) diff --git a/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringBuilderCallSite.java b/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringBuilderCallSite.java index 4fa3ff9e017..637c7a108b5 100644 --- a/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringBuilderCallSite.java +++ b/dd-java-agent/instrumentation/java-lang/src/main/java/datadog/trace/instrumentation/java/lang/StringBuilderCallSite.java @@ -141,6 +141,7 @@ public static String afterSubstring( } @CallSite.After("java.lang.CharSequence java.lang.StringBuilder.subSequence(int, int)") + @CallSite.After("java.lang.CharSequence java.lang.StringBuffer.subSequence(int, int)") public static CharSequence afterSubSequence( @CallSite.This final CharSequence self, @CallSite.Argument final int beginIndex, diff --git a/dd-java-agent/instrumentation/java-lang/src/test/groovy/datadog/trace/instrumentation/java/lang/StringBuilderCallSiteTest.groovy b/dd-java-agent/instrumentation/java-lang/src/test/groovy/datadog/trace/instrumentation/java/lang/StringBuilderCallSiteTest.groovy index 4d5de890f0a..c12f5d4bca8 100644 --- a/dd-java-agent/instrumentation/java-lang/src/test/groovy/datadog/trace/instrumentation/java/lang/StringBuilderCallSiteTest.groovy +++ b/dd-java-agent/instrumentation/java-lang/src/test/groovy/datadog/trace/instrumentation/java/lang/StringBuilderCallSiteTest.groovy @@ -228,6 +228,7 @@ class StringBuilderCallSiteTest extends AgentTestRunner { where: type | suite | param | beginIndex | endIndex | expected "builder" | new TestStringBuilderSuite() | sb('012345') | 1 | 5 | '1234' + "buffer" | new TestStringBufferSuite() | sbf('012345') | 1 | 5 | '1234' } private static class BrokenToString {