theonedev/onedev · error · org.apache.wicket.util.string.StringValueConversionException
Boolean value "{s}" not recognized
Error message
Boolean value "{s}" not recognized What it means
Strings.isTrue(CharSequence) converts a string to a boolean using Wicket's recognized truth values (true/yes/on/1 and false/no/off/0). If the string is non-empty but matches none of them, it throws StringValueConversionException('Boolean value "..." not recognized'). Empty/null strings return false rather than throwing.
Source
Thrown at server-core/src/main/java/org/apache/wicket/util/string/Strings.java:644
if (s.equalsIgnoreCase("on") || s.equalsIgnoreCase("yes") || s.equalsIgnoreCase("y") ||
s.equalsIgnoreCase("1"))
{
return true;
}
if (s.equalsIgnoreCase("off") || s.equalsIgnoreCase("no") || s.equalsIgnoreCase("n") ||
s.equalsIgnoreCase("0"))
{
return false;
}
if (isEmpty(s))
{
return false;
}
throw new StringValueConversionException("Boolean value \"" + s + "\" not recognized");
}
return false;
}
/**
* Joins string fragments using the specified separator
*
* @param separator
* @param fragments
* @return combined fragments
*/
public static String join(final String separator, final List<String> fragments)
{
if (fragments == null)
{
return "";
}View on GitHub (pinned to d44925c47c)
Solutions
- Normalize the input to one of the accepted tokens (true/false/yes/no/on/0/1) before conversion
- Trim the string first, since whitespace may defeat the match
- Parse manually (e.g. Boolean.parseBoolean after toLowerCase) if you need lenient semantics
- Check the exact string with logging — the exception includes the offending value
Example fix
// before
boolean b = Strings.isTrue(configValue); // 'enabled' -> exception
// after
String v = Strings.isEmpty(configValue) ? "false" : configValue.trim().toLowerCase();
boolean b = v.equals("true") || v.equals("yes") || v.equals("on") || v.equals("1"); Defensive patterns
Strategy: validation
Validate before calling
// Java
String v = s == null ? null : s.trim().toLowerCase(Locale.ROOT);
if (v != null && !(v.equals("true") || v.equals("false") || v.equals("yes") || v.equals("no") || v.equals("on") || v.equals("off") || v.equals("1") || v.equals("0"))) {
throw new IllegalArgumentException("Unrecognized boolean: " + s);
}
boolean b = Strings.isTrue(s); Try / catch
try {
b = Strings.isTrue(value);
} catch (StringValueConversionException e) {
log.warn("Bad boolean value: {}", value);
b = false; // or your default
} Prevention
- Trim and lower-case inputs before conversion
- Restrict config vocabularies to accepted tokens (true/false/yes/no/on/off/1/0)
- Default absent values explicitly instead of converting raw input
- Note: empty string returns false, only non-empty unknowns throw
When it happens
Trigger: Calling Strings.isTrue(s) (or toBoolean) with values like 'TRUE ', 'enabled', 'Y', 'ja', or localized booleans that are not in Wicket's accepted set.
Common situations: Parsing config files where booleans are written differently than Wicket expects; locale-specific 'true' words; trailing whitespace or case conventions other than Wicket's accepted tokens.
Related errors
- Expected single character, not "{s}"
- Character value was null
- Cannot convert '%s' to enum constant of type '%s'.
- Invalid boolean value
- Not eligible for multi-value
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/55bec78ba0fdee63.
Report an issue: GitHub.