[go: up one dir, main page]

Skip to content

Improve getDoubleParameter() to Handle Null and Invalid Values Gracefully

The getDoubleParameter(String key) method in the Params class was prone to NullPointerException and uninformative failure handling when the input parameter was null, empty, or non-numeric.

A recent improvement introduces the following enhancements:

  • Introduced a default return value of 0.0 for robustness.
  • Replaced System.err logging with proper SLF4J logger.warn() calls.
  • Added informative log messages when:
  • the parameter is missing (null or empty),
  • the parameter is invalid (NumberFormatException).