{"record":{"id":"618d01c150e3840c","repo":"theonedev/onedev","slug":"invalid-number-token","errorCode":null,"errorMessage":"Invalid number: ${token}","messagePattern":"Invalid number: (.+?)","errorType":"validation","errorClass":"ConversionException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/editable/numberlist/NumberListEditor.java","lineNumber":72,"sourceCode":"\n\t\t});\n\n\t\tinput.add(newPlaceholderModifier());\n\t}\n\n\t@Override\n\tprotected List<Number> convertInputToValue() throws ConversionException {\n\t\tList<Number> numbers = new ArrayList<>();\n\t\tString text = input.getConvertedInput();\n\t\tif (StringUtils.isNotBlank(text)) {\n\t\t\tfor (String token : StringUtils.splitAndTrim(text, \" \")) {\n\t\t\t\ttry {\n\t\t\t\t\tif (elementClass == Long.class)\n\t\t\t\t\t\tnumbers.add(Long.valueOf(token));\n\t\t\t\t\telse\n\t\t\t\t\t\tnumbers.add(Integer.valueOf(token));\n\t\t\t\t} catch (NumberFormatException e) {\n\t\t\t\t\tthrow new ConversionException(\"Invalid number: \" + token);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn numbers;\n\t}\n\n\t@Override\n\tpublic boolean needExplicitSubmit() {\n\t\treturn true;\n\t}\n\n}\n","sourceCodeStart":54,"sourceCodeEnd":85,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/editable/numberlist/NumberListEditor.java#L54-L85","documentation":"NumberListEditor converts user-entered text into a list of numbers by splitting input into tokens and parsing each with Long.valueOf or Integer.valueOf depending on the element class. If a token is not a valid number, NumberFormatException is caught and rethrown as a Wicket ConversionException with the offending token. This gives per-token feedback for numeric list inputs.","triggerScenarios":"A user types a non-numeric token (e.g. 'abc', '1.5' for Integer/Long, '1,000' with thousands separator, or an empty fragment from stray commas/spaces) into a field edited by NumberListEditor and the form converts input.","commonSituations":"Entering decimal numbers into an integer list field; pasting lists with stray separators or trailing commas; locale-formatted numbers like '1 000' or '1,5'; leaving double commas producing empty tokens.","solutions":["Correct the input so each comma/space separated token is a whole number (e.g. 1, 2, 3).","Remove decimal points, thousands separators, currency symbols, and empty entries (double commas/trailing commas).","If the values genuinely need decimals, the field's element type is wrong — use a property type supporting floats rather than List<Long>/List<Integer>.","Check for invisible characters when pasting (non-breaking spaces) and retype the value."],"exampleFix":"// before (input)\n1, 2.5, 3\n// after (input)\n1, 2, 3","handlingStrategy":"validation","validationCode":"// client-side pre-check before submitting a number list field\nfunction isValidNumberList(text) {\n    return text.split(/[,\\s]+/).filter(t => t.length > 0)\n               .every(t => /^-?\\d+$/.test(t));\n}","typeGuard":"boolean isValidNumberToken(String token) {\n    return token != null && token.matches(\"-?\\\\d+\");\n}","tryCatchPattern":"try {\n    List<Long> numbers = (List<Long>) editor.getConvertedInput();\n} catch (ConversionException e) {\n    error(\"Each entry must be a whole number; offending value: \" + e.getMessage());\n}","preventionTips":["Validate the field client-side with an integer regex before form submission.","Avoid pasting lists with thousands separators, decimals, or stray commas; clean the text first.","If decimal values are expected, use a float-capable property type instead of List<Integer>/List<Long>.","Show an input hint describing the expected format (comma-separated integers)."],"tags":["conversion","input-validation","wicket","number-format"],"backgroundTag":"invalid-number-format","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}