Fix boolean flags defaulting to false.

This commit is contained in:
boy0001 2015-03-29 17:12:32 +11:00
parent bdcd327d9b
commit bcc366fc3c

View File

@ -48,10 +48,22 @@ public abstract class FlagValue<T> {
@Override @Override
public Boolean parse(final String t) { public Boolean parse(final String t) {
try { switch (t.toLowerCase()) {
return Boolean.parseBoolean(t); case "1":
} catch (final IllegalArgumentException e) { case "yes":
return null; case "allow":
case "true": {
return true;
}
case "0":
case "no":
case "deny":
case "false": {
return false;
}
default: {
return null;
}
} }
} }