Skip to content

Commit 5b77c73

Browse files
committed
Avoid null store put on Ignite instrumentation
1 parent bd3f6f5 commit 5b77c73

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

dd-java-agent/instrumentation/ignite-2.0/src/main/java/datadog/trace/instrumentation/ignite/v2/IgniteInstrumentation.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ public static void stopSpan(
7878
@Advice.This Ignite that,
7979
@Advice.Thrown final Throwable throwable,
8080
@Advice.Return final IgniteCache<?, ?> cache) {
81-
82-
InstrumentationContext.get(IgniteCache.class, Ignite.class).put(cache, that);
81+
if (cache != null) {
82+
InstrumentationContext.get(IgniteCache.class, Ignite.class).put(cache, that);
83+
}
8384
}
8485
}
8586

@@ -91,8 +92,10 @@ public static void stopSpan(
9192
@Advice.Thrown final Throwable throwable,
9293
@Advice.Return final Collection<IgniteCache<?, ?>> caches) {
9394

94-
for (IgniteCache<?, ?> cache : caches) {
95-
InstrumentationContext.get(IgniteCache.class, Ignite.class).put(cache, that);
95+
if (caches != null) {
96+
for (IgniteCache<?, ?> cache : caches) {
97+
InstrumentationContext.get(IgniteCache.class, Ignite.class).put(cache, that);
98+
}
9699
}
97100
}
98101
}

0 commit comments

Comments
 (0)