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

Clebert Suconic edited comment on ARTEMIS-2769 at 5/19/20, 3:50 PM:
--------------------------------------------------------------------

In theory final users would only break this by feeding invalid strings on URI 
or XML. While the second case you need direct access to the ConfigurationHelper 
class to cause an issue.

In what scenario are you hitting a failure on this? by editing the XML? by 
editing an URI? or this is just theorical by code inspection?


was (Author: clebertsuconic):
In theory final users would only break this by feeding invalid strings on URI 
or XML. While the second case you need direct access to the 
ConfigurationProperty to cause an issue.

In what scenario are you hitting a failure on this? by editing the XML? by 
editing an URI? or this is just theorical by code inspection?

> NumberFormatException  
> -----------------------
>
>                 Key: ARTEMIS-2769
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2769
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.12.0, 2.13.0
>            Reporter: Todor Neykov
>            Assignee: Clebert Suconic
>            Priority: Minor
>              Labels: easyfix
>
> Hi, 
> I found an issue in ConfigurationHelper.getIntProperty() 
> If there is a String propery but not a numeric value it lead to 
> NumberFormatException. 
> My expectation in this case is to be returned a default value instead of 
> exception. 
> The code is
> {code:java}
> if (prop instanceof String) {
>     return Integer.valueOf((String) prop);
> } else ...
>  
> {code}
> Fix proposal : 
> {code:java}
> if (prop instanceof String)
> {
>     try
>     {
>         return Integer.valueOf((String)prop);
>     }
>     catch (NumberFormatException e)
>     {
>         ActiveMQClientLogger.LOGGER.propertyNotInteger(propName, 
> prop.getClass().getName());
>         return def;
>     }
> }
> else ...
> {code}
> Same case is in getLongProperty() 
>  



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

Reply via email to