Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-2769

NumberFormatException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.12.0, 2.13.0
    • 2.14.0
    • None

    Description

      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

      if (prop instanceof String) {
          return Integer.valueOf((String) prop);
      } else ...
       
      

      Fix proposal : 

      if (prop instanceof String)
      {
          try
          {
              return Integer.valueOf((String)prop);
          }
          catch (NumberFormatException e)
          {
              ActiveMQClientLogger.LOGGER.propertyNotInteger(propName, prop.getClass().getName());
              return def;
          }
      }
      else ...
      

      Same case is in getLongProperty() 

       

      Attachments

        Activity

          People

            clebertsuconic Clebert Suconic
            neykov_t Todor Neykov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h