Skip to content

Commit 73a984f

Browse files
committed
feat(env): Migrate agent bootstrap to environment component
1 parent e085472 commit 73a984f

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

dd-java-agent/src/main/java/datadog/trace/bootstrap/AgentBootstrap.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ private static void agentmainImpl(
152152
if (agentClass.getClassLoader() != null) {
153153
throw new IllegalStateException("DD Java Agent NOT added to bootstrap classpath.");
154154
}
155-
final Method startMethod =
156-
agentClass.getMethod("start", Object.class, Instrumentation.class, URL.class, String.class);
157-
158155
try {
156+
final Method startMethod =
157+
agentClass.getMethod(
158+
"start", Object.class, Instrumentation.class, URL.class, String.class);
159159
startMethod.invoke(null, initTelemetry, inst, agentJarURL, agentArgs);
160-
} catch (ReflectiveOperationException | LinkageError e) {
160+
} catch (Throwable e) {
161161
throw new IllegalStateException("Unable to start DD Java Agent.", e);
162162
}
163163
}

dd-java-agent/src/main/java6/datadog/trace/bootstrap/AgentPreCheck.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,9 @@ static boolean compatible(String javaVersion, String javaHome, PrintStream outpu
101101

102102
reportIncompatibleJava(javaVersion, javaHome, agentVersion, output);
103103

104-
try {
105-
String forwarderPath = System.getenv("DD_TELEMETRY_FORWARDER_PATH");
106-
if (forwarderPath != null) {
107-
sendTelemetry(forwarderPath, javaVersion, agentVersion);
108-
}
109-
} catch (SecurityException ignored) {
104+
String forwarderPath = System.getenv("DD_TELEMETRY_FORWARDER_PATH");
105+
if (forwarderPath != null) {
106+
sendTelemetry(forwarderPath, javaVersion, agentVersion);
110107
}
111108

112109
return false;

0 commit comments

Comments
 (0)