Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-17575

Implicit narrowing conversion in compound assignment for "messages-added"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 28.0.0.Beta1, 28.0.0.Final
    • None
    • JMS
    • None

      messaging-activemq/subsystem/src/main/java/org/wildfly/extension/messaging/activemq/jms/JMSTopicReadAttributeHandler.java

          private long getMessagesAdded(AddressControl addressControl, ManagementService managementService) {
              List<QueueControl> queues = getQueues(DurabilityType.ALL, addressControl, managementService);
              int count = 0;
              for (QueueControl queue : queues) {
                  count += queue.getMessagesAdded();
              }
              return count;
          }
      

      This will get incorrect value if the long value returned from queue.getMessagesAdded() is bigger than Integer.MAX_VALUE.

              chaowan@redhat.com Chao Wang
              chaowan@redhat.com Chao Wang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: