[ 
https://issues.apache.org/jira/browse/ARTEMIS-3061?focusedWorklogId=534428&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-534428
 ]

ASF GitHub Bot logged work on ARTEMIS-3061:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Jan/21 18:50
            Start Date: 11/Jan/21 18:50
    Worklog Time Spent: 10m 
      Work Description: 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:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 534428)
    Time Spent: 1h 20m  (was: 1h 10m)

> AMQPMessage::getDuplicateProperty can save key comparisons and class checks
> ---------------------------------------------------------------------------
>
>                 Key: ARTEMIS-3061
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3061
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>          Components: AMQP
>    Affects Versions: 2.16.0
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>            Priority: Minor
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to