JetBrains/intellij-community · error · IllegalArgumentException

attribute '{attributeName}' is not a proper double: {str}

Error message

attribute '{attributeName}' is not a proper double: {str}

What it means

Thrown by LwXmlReader.getRequiredDouble when a required attribute cannot be parsed by Double.parseDouble. Double attributes appear in form XML for things like proportional grid layout weights/floats in some serializers; a malformed value triggers IllegalArgumentException with the attribute name and the bad string.

Source

Thrown at java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwXmlReader.java:97

      throw new IllegalArgumentException("attribute '" + attributeName + "' is not a proper integer: " + str);
    }
  }

  public static boolean getOptionalBoolean(final Element element, final String attributeName, final boolean defaultValue) {
    final String str = element.getAttributeValue(attributeName);
    if (str == null) {
      return defaultValue;
    }
    return Boolean.valueOf(str).booleanValue();
  }

  public static double getRequiredDouble(final Element element, final String attributeName) {
    final String str = getRequiredString(element, attributeName);
    try {
      return Double.parseDouble(str);
    }
    catch (NumberFormatException e) {
      throw new IllegalArgumentException("attribute '" + attributeName + "' is not a proper double: " + str);
    }
  }

  static double getOptionalDouble(final Element element, final String attributeName, double defaultValue) {
    final String str = element.getAttributeValue(attributeName);
    if (str == null) {
      return defaultValue;
    }
    try {
      return Double.parseDouble(str);
    }
    catch (NumberFormatException e) {
      throw new IllegalArgumentException("attribute '" + attributeName + "' is not a proper double: " + str);
    }
  }

  public static float getRequiredFloat(final Element element, final String attributeName) {
    final String str = getRequiredString(element, attributeName);

View on GitHub (pinned to be881553f2)

Solutions

  1. Write the value as a plain dot-decimal literal, e.g. weight="0.5".
  2. Remove thousands separators, units, and percent signs from numeric attributes.
  3. Re-save the form from the designer to regenerate canonical numbers.

Example fix

<!-- before -->
<column weight="50%"/>

<!-- after -->
<column weight="0.5"/>
Defensive patterns

Strategy: validation

Validate before calling

// Validate double format (dot decimal, optional exponent) before parse
if (!str.trim().matches("-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?")) throw new IllegalStateException("'" + attr + "' must be a double, got: " + str);

Try / catch

try { LwXmlReader.getRequiredDouble(element, attr); } catch (IllegalArgumentException e) { if (e.getMessage().contains("not a proper double")) { /* use dot-decimal, strip units/percent/locale commas */ } else throw e; }

Prevention

When it happens

Trigger: A form-XML attribute read via getRequiredDouble holds a non-double string — e.g. "big", "1,5" (comma separator), "50%", or empty. Integer.parseInt-style errors are not the issue here; any string Double.parseDouble rejects (including trailing text) throws.

Common situations: Locale-sensitive editing inserting decimal commas; hand-edited forms adding units or symbolic names; generators emitting formatted numbers with grouping separators.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/1ee6f60a40bba82f. Report an issue: GitHub.