Skip to content

Commit d929c5d

Browse files
committed
ARTEMIS-4962 mitigate NPE in FilterImpl
1 parent 57adcd3 commit d929c5d

File tree

1 file changed

+9
-6
lines changed
  • artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl

1 file changed

+9
-6
lines changed

artemis-server/src/main/java/org/apache/activemq/artemis/core/filter/impl/FilterImpl.java

+9-6
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,17 @@ private static Object getHeaderFieldValue(final Message msg, final SimpleString
163163
String amqpNativeID = msg.getStringProperty(NATIVE_MESSAGE_ID);
164164
if (amqpNativeID != null) {
165165
return SimpleString.of(amqpNativeID);
166+
} else {
167+
return null;
166168
}
167-
}
168-
// It's the stringified (hex) representation of a user id that can be used in a selector expression
169-
String userID = msg.getUserID().toString();
170-
if (userID.startsWith("ID:")) {
171-
return SimpleString.of(userID);
172169
} else {
173-
return SimpleString.of("ID:" + msg.getUserID());
170+
// It's the stringified (hex) representation of a user id that can be used in a selector expression
171+
String userID = msg.getUserID().toString();
172+
if (userID.startsWith("ID:")) {
173+
return SimpleString.of(userID);
174+
} else {
175+
return SimpleString.of("ID:" + msg.getUserID());
176+
}
174177
}
175178
} else if (FilterConstants.ACTIVEMQ_PRIORITY.equals(fieldName)) {
176179
return (int) msg.getPriority();

0 commit comments

Comments
 (0)