Todor Neykov created ARTEMIS-2769:
-------------------------------------

             Summary: NumberFormatException  
                 Key: ARTEMIS-2769
                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2769
             Project: ActiveMQ Artemis
          Issue Type: Bug
          Components: ActiveMQ-Artemis-Native
    Affects Versions: 2.13.0, 2.12.0
            Reporter: Todor Neykov
            Assignee: Clebert Suconic


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