{"record":{"id":"1b29cdef725b8b4a","repo":"theonedev/onedev","slug":"invalid-decimal-value","errorCode":null,"errorMessage":"Invalid decimal: ${value}","messagePattern":"Invalid decimal: (.+?)","errorType":"exception","errorClass":"NotAcceptableException","httpStatus":406,"severity":"warning","filePath":"server-core/src/main/java/io/onedev/server/util/QueryUtils.java","lineNumber":59,"sourceCode":"\tprivate static final Pattern INSIDE_QUOTE = Pattern.compile(\"\\\"([^\\\"\\\\\\\\]|\\\\\\\\.)*\");\n\n\tpublic static String getValue(String token) {\n\t\treturn StringUtils.unescape(FenceAware.unfence(token));\n\t}\n\t\n\tpublic static int getIntValue(String value) {\n\t\ttry {\n\t\t\treturn Integer.parseInt(value);\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid number: \" + value);\n\t\t}\n\t}\n\n\tpublic static float getFloatValue(String value) {\n\t\ttry {\n\t\t\treturn Float.parseFloat(value);\n\t\t} catch (NumberFormatException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid decimal: \" + value);\n\t\t}\n\t}\n\t\n\tpublic static LabelSpec getLabelSpec(String labelName) {\n\t\tvar labelSpec = OneDev.getInstance(LabelSpecService.class).find(labelName);\n\t\tif (labelSpec != null) \n\t\t\treturn labelSpec;\n\t\telse\n\t\t\tthrow new NotFoundException(\"Undefined label: \" + labelName);\n\t}\n\t\n\tpublic static int getWorkingPeriodValue(String value) {\n\t\ttry {\n\t\t\tvar timeTrackingSetting = OneDev.getInstance(SettingService.class).getIssueSetting().getTimeTrackingSetting();\n\t\t\treturn timeTrackingSetting.parseWorkingPeriod(value);\n\t\t} catch (ValidationException e) {\n\t\t\tthrow new NotAcceptableException(\"Invalid working period: \" + value);\n\t\t}","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/util/QueryUtils.java#L41-L77","documentation":"QueryUtils.getFloatValue parses a query value string to a float via Float.parseFloat. A NumberFormatException is rethrown as NotAcceptableException(\"Invalid decimal: ...\"), so invalid operands in numeric-decimal query criteria fail as request validation errors.","triggerScenarios":"Passing a non-decimal string ('12,5' with comma decimal separator, '1e', 'abc', empty string) to QueryUtils.getFloatValue while building or parsing an issue query.","commonSituations":"Locale issues (comma vs dot decimal separator); typos in saved queries; REST clients sending localized number formats.","solutions":["Use a dot as the decimal separator: 12.5 not 12,5","Verify the value contains only digits, optional sign, dot, and optional exponent","Trim surrounding whitespace or invisible characters from the query string"],"exampleFix":"// before\ngetFloatValue(\"12,5\"); // throws\n// after\ngetFloatValue(\"12.5\"); // 12.5f","handlingStrategy":"validation","validationCode":"function isFloat(v) { return !Number.isNaN(Number(v.trim().replace(',', '.'))); }","typeGuard":"boolean isValidFloat(String v) {\n    try { Float.parseFloat(v.trim()); return true; } catch (NumberFormatException e) { return false; }\n}","tryCatchPattern":"try {\n    float f = QueryUtils.getFloatValue(raw);\n} catch (NotAcceptableException e) {\n    // normalize separators or report invalid decimal to the user\n}","preventionTips":["Always use dot as decimal separator in queries regardless of locale","Trim whitespace from operands","Reject comma decimal inputs at the UI/API layer"],"tags":["query","validation","parsing","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"}