[ 
https://issues.apache.org/jira/browse/AMQ-7017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16552635#comment-16552635
 ] 

Christopher L. Shannon commented on AMQ-7017:
---------------------------------------------

Seems like there might be more to fix here.  Checking for 0 is a good idea 
however it doesn't make sense that you would run into this condition in the 
first place...It seems odd you would have a positive number for sends blocked 
but have 0 for total sends

> ProducerBrokerExchange.getPercentageBlocked() throws ArithmeticException 
> (divide by zero)
> -----------------------------------------------------------------------------------------
>
>                 Key: AMQ-7017
>                 URL: https://issues.apache.org/jira/browse/AMQ-7017
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.15.4
>            Reporter: Matthew Stratton
>            Priority: Trivial
>              Labels: patch
>         Attachments: fix-producer-exchange-divide-by-zero.txt
>
>
> I found this when testing a broker plugin for tracking messages sent 
> (including some stats like getPercentageBlocked). When there have been no 
> blocked messages an ArithmeticException is thrown due to an unchecked divide 
> by zero. 
> I fixed it and added a couple unit tests.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to