{"record":{"id":"14aadbafed7b5086","repo":"SonarSource/sonarqube","slug":"the-property-s-is-not-a-double-value","errorCode":null,"errorMessage":"The property '%s' is not a double value","messagePattern":"The property '(.+?)' is not a double value","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sonar-plugin-api-impl/src/main/java/org/sonar/api/config/internal/Settings.java","lineNumber":264,"sourceCode":"    }\n    return null;\n  }\n\n  /**\n   * Effective value as {@code Double}.\n   *\n   * @return the value as {@code Double}. If the property does not have value nor default value, then {@code null} is returned.\n   * @throws NumberFormatException if value is not empty and is not a parsable number\n   */\n  @CheckForNull\n  @Override\n  public Double getDouble(String key) {\n    String value = getString(key);\n    if (StringUtils.isNotEmpty(value)) {\n      try {\n        return Double.valueOf(value);\n      } catch (NumberFormatException e) {\n        throw new IllegalStateException(String.format(\"The property '%s' is not a double value\", key));\n      }\n    }\n    return null;\n  }\n\n  /**\n   * Value is split by comma and trimmed. Never returns null.\n   * <br>\n   * Examples :\n   * <ul>\n   * <li>\"one,two,three \" -&gt; [\"one\", \"two\", \"three\"]</li>\n   * <li>\"  one, two, three \" -&gt; [\"one\", \"two\", \"three\"]</li>\n   * <li>\"one, , three\" -&gt; [\"one\", \"\", \"three\"]</li>\n   * </ul>\n   */\n  @Override\n  public String[] getStringArray(String key) {\n    String effectiveKey = definitions.validKey(key);","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/sonar-plugin-api-impl/src/main/java/org/sonar/api/config/internal/Settings.java#L246-L282","documentation":"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.","triggerScenarios":"Calling getDouble(key) when the property contains non-numeric text, a comma decimal separator, locale-formatted numbers, or truncated values like '1.2.3'.","commonSituations":"Same as getFloat: copy-pasted values with commas or units ('1.5s'), user-supplied unvalidated input, typos in sonar.properties.","solutions":["Correct the stored value to a valid double with '.' decimal separator (e.g. 3.14)","Validate the value before calling getDouble (Double.valueOf / regex check)","Re-save the property via UI/API with a numeric value","Provide a default via getDefaultValue when the property is optional"],"exampleFix":"// before\nDouble d = settings.getDouble(\"sonar.factor\"); // value = \"1,5\"\n// after\nsettings.setProperty(\"sonar.factor\", \"1.5\");\nDouble d = settings.getDouble(\"sonar.factor\");","handlingStrategy":"validation","validationCode":"// validate before calling getDouble\nString v = settings.getString(key);\nif (v != null && !v.trim().isEmpty()) {\n  try { Double.valueOf(v.trim()); }\n  catch (NumberFormatException e) {\n    throw new IllegalArgumentException(\"property \" + key + \" must be a double, got: \" + v);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  return settings.getDouble(key);\n} catch (IllegalStateException e) {\n  log.warn(\"Non-double value for {} - using default\", key, e);\n  return defaultValue;\n}","preventionTips":["Always use '.' as decimal separator in settings","Strip units/suffixes from values before storing","Validate numeric inputs before setProperty","Use PropertyDefinition validators at write time"],"tags":["type-conversion","configuration","number-parsing"],"backgroundTag":"invalid-config-value","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}