File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed
agent-bootstrap/src/main/java/datadog/trace/bootstrap/benchmark
agent-builder/src/main/java/datadog/trace/agent/tooling
src/test/groovy/datadog/trace/agent Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 11package datadog .trace .bootstrap .benchmark ;
22
3+ import datadog .environment .SystemProperties ;
34import java .io .*;
45import java .nio .charset .StandardCharsets ;
56import java .util .Objects ;
@@ -18,8 +19,8 @@ public class StaticEventLogger {
1819 static {
1920 BufferedWriter writer = null ;
2021
21- if ("true" .equalsIgnoreCase (System . getProperty ("dd.benchmark.enabled" ))) {
22- String dir = System . getProperty ("dd.benchmark.output.dir" );
22+ if ("true" .equalsIgnoreCase (SystemProperties . get ("dd.benchmark.enabled" ))) {
23+ String dir = SystemProperties . get ("dd.benchmark.output.dir" );
2324 dir = (dir != null ? dir + File .separator : "" );
2425 String fileName = dir + "startup_" + System .currentTimeMillis () + ".csv" ;
2526
Original file line number Diff line number Diff line change 55import static datadog .trace .agent .tooling .bytebuddy .matcher .GlobalIgnoresMatcher .globalIgnoresMatcher ;
66import static net .bytebuddy .matcher .ElementMatchers .isDefaultFinalizer ;
77
8+ import datadog .environment .SystemProperties ;
89import datadog .trace .agent .tooling .bytebuddy .SharedTypePools ;
910import datadog .trace .agent .tooling .bytebuddy .iast .TaintableRedefinitionStrategyListener ;
1011import datadog .trace .agent .tooling .bytebuddy .matcher .DDElementMatchers ;
@@ -318,18 +319,17 @@ public static Set<InstrumenterModule.TargetSystem> getEnabledSystems() {
318319 }
319320
320321 private static void addByteBuddyRawSetting () {
321- final String savedPropertyValue = System .getProperty (TypeDefinition .RAW_TYPES_PROPERTY );
322- try {
323- System .setProperty (TypeDefinition .RAW_TYPES_PROPERTY , "true" );
322+ final String savedPropertyValue = SystemProperties .get (TypeDefinition .RAW_TYPES_PROPERTY );
323+ if (SystemProperties .set (TypeDefinition .RAW_TYPES_PROPERTY , "true" )) {
324324 final boolean rawTypes = TypeDescription .AbstractBase .RAW_TYPES ;
325325 if (!rawTypes && DEBUG ) {
326326 log .debug ("Too late to enable {}" , TypeDefinition .RAW_TYPES_PROPERTY );
327327 }
328- } finally {
328+ } else {
329329 if (savedPropertyValue == null ) {
330- System . clearProperty (TypeDefinition .RAW_TYPES_PROPERTY );
330+ SystemProperties . clear (TypeDefinition .RAW_TYPES_PROPERTY );
331331 } else {
332- System . setProperty (TypeDefinition .RAW_TYPES_PROPERTY , savedPropertyValue );
332+ SystemProperties . set (TypeDefinition .RAW_TYPES_PROPERTY , savedPropertyValue );
333333 }
334334 }
335335 }
Original file line number Diff line number Diff line change @@ -58,15 +58,15 @@ class InitializationTelemetryTest extends Specification {
5858 })
5959 def " incomplete agent start-up" () {
6060 // In this case, the SecurityManager blocks a custom permission that is checked by bytebuddy causing
61- // agent initialization to fail. However, we should catch the exception allowing the application
61+ // agent initialization to fail. However, we should catch the exception allowing the application
6262 // to run normally.
6363 when :
6464 def result = InitializationTelemetryCheck . runTestJvm(InitializationTelemetryCheck.BlockByteBuddy )
6565
66- then :
66+ then : ' should complete successfully and catch error '
6767 result. exitCode == 0
6868 ! result. telemetryJson. contains(' library_entrypoint.complete' )
69- result. telemetryJson. contains(' error_type:java.lang.IllegalStateException ' )
69+ result. telemetryJson. contains(' error_type:' )
7070 }
7171
7272 @IgnoreIf (reason = " SecurityManager is permanently disabled as of JDK 24" , value = {
You can’t perform that action at this time.
0 commit comments