Skip to content

Commit

Permalink
Request for more values identified as boolean for the boolean field t…
Browse files Browse the repository at this point in the history
…ype - `no`, closes #984.
  • Loading branch information
kimchy committed May 31, 2011
1 parent 8267a76 commit 1f17e9d
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -31,6 +31,9 @@ public static boolean parseBoolean(char[] text, int offset, int length, boolean
if (length == 1) {
return text[offset] != '0';
}
if (length == 2) {
return !(text[offset] == 'n' && text[offset + 1] == 'o');
}
if (length == 3) {
return !(text[offset] == 'o' && text[offset + 1] == 'f' && text[offset + 2] == 'f');
}
Expand All @@ -44,13 +47,13 @@ public static boolean parseBoolean(String value, boolean defaultValue) {
if (value == null) {
return defaultValue;
}
return !(value.equals("false") || value.equals("0") || value.equals("off"));
return !(value.equals("false") || value.equals("0") || value.equals("off") || value.equals("no"));
}

public static Boolean parseBoolean(String value, Boolean defaultValue) {
if (value == null) {
return defaultValue;
}
return !(value.equals("false") || value.equals("0") || value.equals("off"));
return !(value.equals("false") || value.equals("0") || value.equals("off") || value.equals("no"));
}
}

0 comments on commit 1f17e9d

Please sign in to comment.