{"record":{"id":"79a7c9780e675638","repo":"JetBrains/intellij-community","slug":"attribute-attributename-is-not-a-proper-float","errorCode":null,"errorMessage":"attribute '{attributeName}' is not a proper float: {str}","messagePattern":"attribute '(.+?)' is not a proper float: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwXmlReader.java","lineNumber":120,"sourceCode":"    final String str = element.getAttributeValue(attributeName);\n    if (str == null) {\n      return defaultValue;\n    }\n    try {\n      return Double.parseDouble(str);\n    }\n    catch (NumberFormatException e) {\n      throw new IllegalArgumentException(\"attribute '\" + attributeName + \"' is not a proper double: \" + str);\n    }\n  }\n\n  public static float getRequiredFloat(final Element element, final String attributeName) {\n    final String str = getRequiredString(element, attributeName);\n    try {\n      return Float.parseFloat(str);\n    }\n    catch (NumberFormatException e) {\n      throw new IllegalArgumentException(\"attribute '\" + attributeName + \"' is not a proper float: \" + str);\n    }\n  }\n\n  static Object getRequiredPrimitiveTypeValue(final Element element, final String attributeName, final Class valueClass) {\n    final String str = getRequiredString(element, attributeName);\n    try {\n      final Method method = valueClass.getMethod(\"valueOf\", String.class);\n      return method.invoke(null, str);\n    }\n    catch (NumberFormatException e) {\n      throw new IllegalArgumentException(\"attribute '\" + attributeName + \"' is not a proper float: \" + str);\n    }\n    catch (Exception e) {\n      throw new RuntimeException(e);\n    }\n  }\n\n  static StringDescriptor getStringDescriptor(final Element element, final String valueAttr,","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwXmlReader.java#L102-L138","documentation":"Thrown by LwXmlReader.getRequiredFloat when a required attribute fails Float.parseFloat. Float-valued attributes occur in form layout metadata; a malformed string (non-numeric, comma decimal, trailing units) produces IllegalArgumentException with the attribute name and raw value.","triggerScenarios":"A form-XML attribute read via getRequiredFloat holds a value Float.parseFloat rejects — e.g. \"thin\", \"1,5\", \"12f\". Note the parse happens on the trimmed value from getRequiredString, and the attribute itself must already exist or error 53 fires first.","commonSituations":"Hand-edited form XML with descriptive words in numeric attributes; Java-style float literals pasted in ('1.5f'); locale-edited decimal commas.","solutions":["Set the attribute to a plain decimal number without suffixes, e.g. \"1.5\".","If unsure of the expected range, check a designer-saved form using the same component.","Avoid pasting Java source literals into form XML."],"exampleFix":"<!-- before -->\n<indent sizeIncr=\"1.5f\"/>\n\n<!-- after -->\n<indent sizeIncr=\"1.5\"/>","handlingStrategy":"validation","validationCode":"// Validate float-shaped values before parse\nif (!str.trim().matches(\"-?\\\\d+(\\\\.\\\\d+)?([eE][+-]?\\\\d+)?[fF]?\")) throw new IllegalStateException(\"'\" + attr + \"' must be a float, got: \" + str);\n// note: strip a trailing f/F before writing back to XML","typeGuard":null,"tryCatchPattern":"try { LwXmlReader.getRequiredFloat(element, attr); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"not a proper float\")) { /* write a plain decimal without 'f' suffix */ } else throw e; }","preventionTips":["Form XML wants bare decimals; remove Java float suffixes.","Use dot decimals regardless of system locale."],"tags":["gui-designer","form-xml","number-format","float"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}