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

Andre Flakowski commented on ARTEMIS-2594:
------------------------------------------

Okay, thanks for the clarification! 

Seemed counterintuitive to me, maybe add the "throws NumberFormatException" 
from the invoked valueOf methods to better document the RuntimeExceptions, 
other than that sorry for the false alarm :)

> TypedProperties#getLongProperty throws java.lang.NumberFormatException if 
> property is not set / null
> ----------------------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-2594
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2594
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.10.1
>         Environment: CentOS 5.4.10 x86_64 GNU/Linux, openjdk version "11.0.3" 
> 2019-04-16 LTS
>            Reporter: Andre Flakowski
>            Priority: Major
>
> See:
> {code:java}
> org.apache.activemq.artemis.utils.collections.TypedProperties#getLongProperty{code}
> [https://github.com/apache/activemq-artemis/blob/2.10.1/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/TypedProperties.java#L234]
> if the value for the key is not present / null, 
> {code:java}
> Long.valueOf(null);{code}
> is invoked which will always throw a java.lang.NumberFormatException
> presumably null should be returned and  the behaviour would be:
> {code:java}
> Long number = request.getLongProperty(key);
> if (number != null) {
>     Long sum = Long.sum(42, number);
> }
> {code}
>  



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

Reply via email to