SonarSource/sonarqube · error · IllegalStateException

The property ' ' is not a double value

Error message

The property '%s' is not a double value

What it means

Settings.getDouble retrieves the string value of a property and converts it to a Double. If the value is non-empty but not a valid double, the NumberFormatException is replaced by this IllegalStateException. The library throws it because a non-numeric value for a double setting is a configuration error that must surface immediately.

Solutions

  1. Correct the stored value to a valid double with '.' decimal separator (e.g. 3.14)
  2. Validate the value before calling getDouble (Double.valueOf / regex check)
  3. Re-save the property via UI/API with a numeric value
  4. Provide a default via getDefaultValue when the property is optional

Example fix

// before
Double d = settings.getDouble("sonar.factor"); // value = "1,5"
// after
settings.setProperty("sonar.factor", "1.5");
Double d = settings.getDouble("sonar.factor");
Defensive patterns

Strategy: validation

Validate before calling

// validate before calling getDouble
String v = settings.getString(key);
if (v != null && !v.trim().isEmpty()) {
  try { Double.valueOf(v.trim()); }
  catch (NumberFormatException e) {
    throw new IllegalArgumentException("property " + key + " must be a double, got: " + v);
  }
}

Try / catch

try {
  return settings.getDouble(key);
} catch (IllegalStateException e) {
  log.warn("Non-double value for {} - using default", key, e);
  return defaultValue;
}

Prevention

When it happens

Trigger: Calling getDouble(key) when the property contains non-numeric text, a comma decimal separator, locale-formatted numbers, or truncated values like '1.2.3'.

Common situations: Same as getFloat: copy-pasted values with commas or units ('1.5s'), user-supplied unvalidated input, typos in sonar.properties.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/14aadbafed7b5086. Report an issue: GitHub.

Appendix: source

Thrown at sonar-plugin-api-impl/src/main/java/org/sonar/api/config/internal/Settings.java:264

    }
    return null;
  }

  /**
   * Effective value as {@code Double}.
   *
   * @return the value as {@code Double}. If the property does not have value nor default value, then {@code null} is returned.
   * @throws NumberFormatException if value is not empty and is not a parsable number
   */
  @CheckForNull
  @Override
  public Double getDouble(String key) {
    String value = getString(key);
    if (StringUtils.isNotEmpty(value)) {
      try {
        return Double.valueOf(value);
      } catch (NumberFormatException e) {
        throw new IllegalStateException(String.format("The property '%s' is not a double value", key));
      }
    }
    return null;
  }

  /**
   * Value is split by comma and trimmed. Never returns null.
   * <br>
   * Examples :
   * <ul>
   * <li>"one,two,three " -&gt; ["one", "two", "three"]</li>
   * <li>"  one, two, three " -&gt; ["one", "two", "three"]</li>
   * <li>"one, , three" -&gt; ["one", "", "three"]</li>
   * </ul>
   */
  @Override
  public String[] getStringArray(String key) {
    String effectiveKey = definitions.validKey(key);

View on GitHub (pinned to 184c821202)