{"record":{"id":"55bec78ba0fdee63","repo":"theonedev/onedev","slug":"boolean-value-s-not-recognized","errorCode":null,"errorMessage":"Boolean value \"{s}\" not recognized","messagePattern":"Boolean value \"(.+?)\" not recognized","errorType":"exception","errorClass":"org.apache.wicket.util.string.StringValueConversionException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/org/apache/wicket/util/string/Strings.java","lineNumber":644,"sourceCode":"\n\t\t\tif (s.equalsIgnoreCase(\"on\") || s.equalsIgnoreCase(\"yes\") || s.equalsIgnoreCase(\"y\") ||\n\t\t\t\ts.equalsIgnoreCase(\"1\"))\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif (s.equalsIgnoreCase(\"off\") || s.equalsIgnoreCase(\"no\") || s.equalsIgnoreCase(\"n\") ||\n\t\t\t\ts.equalsIgnoreCase(\"0\"))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (isEmpty(s))\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tthrow new StringValueConversionException(\"Boolean value \\\"\" + s + \"\\\" not recognized\");\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Joins string fragments using the specified separator\n\t * \n\t * @param separator\n\t * @param fragments\n\t * @return combined fragments\n     */\n\tpublic static String join(final String separator, final List<String> fragments)\n\t{\n\t\tif (fragments == null)\n\t\t{\n\t\t\treturn \"\";\n\t\t}","sourceCodeStart":626,"sourceCodeEnd":662,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/org/apache/wicket/util/string/Strings.java#L626-L662","documentation":"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.","triggerScenarios":"Calling Strings.isTrue(s) (or toBoolean) with values like 'TRUE ', 'enabled', 'Y', 'ja', or localized booleans that are not in Wicket's accepted set.","commonSituations":"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.","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"],"exampleFix":"// before\nboolean b = Strings.isTrue(configValue); // 'enabled' -> exception\n// after\nString v = Strings.isEmpty(configValue) ? \"false\" : configValue.trim().toLowerCase();\nboolean b = v.equals(\"true\") || v.equals(\"yes\") || v.equals(\"on\") || v.equals(\"1\");","handlingStrategy":"validation","validationCode":"// Java\nString v = s == null ? null : s.trim().toLowerCase(Locale.ROOT);\nif (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\"))) {\n    throw new IllegalArgumentException(\"Unrecognized boolean: \" + s);\n}\nboolean b = Strings.isTrue(s);","typeGuard":null,"tryCatchPattern":"try {\n    b = Strings.isTrue(value);\n} catch (StringValueConversionException e) {\n    log.warn(\"Bad boolean value: {}\", value);\n    b = false; // or your default\n}","preventionTips":["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"],"tags":["wicket","string-conversion","boolean"],"backgroundTag":"invalid-boolean-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}