Skip to content

Commit 23883df

Browse files
[release/v1.33.x] Avoid NullPointerException when jms destination is not available (#11577)
Co-authored-by: Lauri Tulmin <[email protected]>
1 parent b6c5376 commit 23883df

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

instrumentation/jms/jms-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jms/MessageWithDestination.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ public static MessageWithDestination create(
3131
jmsDestination = fallbackDestination;
3232
}
3333

34-
if (jmsDestination.isQueue()) {
35-
return createMessageWithQueue(message, jmsDestination);
36-
}
37-
if (jmsDestination.isTopic()) {
38-
return createMessageWithTopic(message, jmsDestination);
34+
if (jmsDestination != null) {
35+
if (jmsDestination.isQueue()) {
36+
return createMessageWithQueue(message, jmsDestination);
37+
}
38+
if (jmsDestination.isTopic()) {
39+
return createMessageWithTopic(message, jmsDestination);
40+
}
3941
}
4042
return new AutoValue_MessageWithDestination(
4143
message, "unknown", /* isTemporaryDestination= */ false);

0 commit comments

Comments
 (0)