theonedev/onedev · warning · NotAcceptableException

Invalid decimal: ${value}

Error message

Invalid decimal: ${value}

What it means

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.

Source

Thrown at server-core/src/main/java/io/onedev/server/util/QueryUtils.java:59

	private static final Pattern INSIDE_QUOTE = Pattern.compile("\"([^\"\\\\]|\\\\.)*");

	public static String getValue(String token) {
		return StringUtils.unescape(FenceAware.unfence(token));
	}
	
	public static int getIntValue(String value) {
		try {
			return Integer.parseInt(value);
		} catch (NumberFormatException e) {
			throw new NotAcceptableException("Invalid number: " + value);
		}
	}

	public static float getFloatValue(String value) {
		try {
			return Float.parseFloat(value);
		} catch (NumberFormatException e) {
			throw new NotAcceptableException("Invalid decimal: " + value);
		}
	}
	
	public static LabelSpec getLabelSpec(String labelName) {
		var labelSpec = OneDev.getInstance(LabelSpecService.class).find(labelName);
		if (labelSpec != null) 
			return labelSpec;
		else
			throw new NotFoundException("Undefined label: " + labelName);
	}
	
	public static int getWorkingPeriodValue(String value) {
		try {
			var timeTrackingSetting = OneDev.getInstance(SettingService.class).getIssueSetting().getTimeTrackingSetting();
			return timeTrackingSetting.parseWorkingPeriod(value);
		} catch (ValidationException e) {
			throw new NotAcceptableException("Invalid working period: " + value);
		}

View on GitHub (pinned to d44925c47c)

Solutions

  1. Use a dot as the decimal separator: 12.5 not 12,5
  2. Verify the value contains only digits, optional sign, dot, and optional exponent
  3. Trim surrounding whitespace or invisible characters from the query string

Example fix

// before
getFloatValue("12,5"); // throws
// after
getFloatValue("12.5"); // 12.5f
Defensive patterns

Strategy: validation

Validate before calling

function isFloat(v) { return !Number.isNaN(Number(v.trim().replace(',', '.'))); }

Type guard

boolean isValidFloat(String v) {
    try { Float.parseFloat(v.trim()); return true; } catch (NumberFormatException e) { return false; }
}

Try / catch

try {
    float f = QueryUtils.getFloatValue(raw);
} catch (NotAcceptableException e) {
    // normalize separators or report invalid decimal to the user
}

Prevention

When it happens

Trigger: 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.

Common situations: Locale issues (comma vs dot decimal separator); typos in saved queries; REST clients sending localized number formats.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/1b29cdef725b8b4a. Report an issue: GitHub.