Refactor an agent usage, and fix logic issue
MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/Instrumenter.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/Instrumenter.java
@@ -133,9 +133,10 @@ public interface Instrumenter {
*/
final ReferenceMatcher muzzle = getInstrumentationMuzzle();
if (null != muzzle) {
+ final boolean isMatch = muzzle.matches(classLoader);
+ if (!isMatch) {
final List<Reference.Mismatch> mismatches =
muzzle.getMismatchedReferenceSources(classLoader);
- if (mismatches.size() > 0) {
if (log.isDebugEnabled()) {
log.debug(
"Instrumentation muzzled: {} -- {} on {}",
@@ -153,7 +154,7 @@ public interface Instrumenter {
Instrumenter.Default.this.getClass().getName(),
classLoader);
}
- return mismatches.size() == 0;
+ return isMatch;
}
return true;
}

MODIFY
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/ReferenceMatcher.java
dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/muzzle/ReferenceMatcher.java
@@ -66,7 +66,7 @@ public class ReferenceMatcher
}
mismatchCache.put(loader, mismatches);
- return true;
+ return mismatches.size() == 0;
}
/**

Refactor an agent usage, and fix logic issue