You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/01/11 18:50:13 UTC
[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3404: ARTEMIS-3061 AMQPMessage::getDuplicateProperty can save key comparisons and class checks
clebertsuconic commented on a change in pull request #3404:
URL: https://github.com/apache/activemq-artemis/pull/3404#discussion_r555265446
##########
File path: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
##########
@@ -1382,20 +1382,26 @@ public final Object getObjectProperty(String key) {
return AMQPMessageIdHelper.INSTANCE.toCorrelationIdString(properties.getCorrelationId());
}
} else {
- Object value = getApplicationPropertiesMap(false).get(key);
- if (value instanceof UnsignedInteger ||
- value instanceof UnsignedByte ||
- value instanceof UnsignedLong ||
- value instanceof UnsignedShort) {
- return ((Number)value).longValue();
- } else {
- return value;
- }
+ return getApplicationObjectProperty(key);
}
return null;
}
+ private Object getApplicationObjectProperty(String key) {
+ Object value = getApplicationPropertiesMap(false).get(key);
+ if (value instanceof Number) {
Review comment:
Can't we just do the ultimate simplification? I know this would be a semantic change but looking at the usages I only see this being used on filter.
I think it would be safe to change this to:
```java
if (value instanceof Number) {
return ((Number) value).longValue();
}
return value;
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org