You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Get an optional boolean associated with a key.
* It returns the defaultValue if there is no such key, or if it is not
* a Boolean or the String "true" or "false" (case insensitive).
But actually it returns the defaultValue only when the key is not in the json, and throws a RuntimeException in other cases.
public boolean optBoolean(String key, boolean defaultValue) {
Object o = opt(key);
if (o == null) {
return defaultValue;
} else {
try {
return doGetBoolean(key, o);
} catch (JSONException ex) {
throw new RuntimeException(ex);
}
}
}
The text was updated successfully, but these errors were encountered:
h-cheon
added a commit
to h-cheon/jettison
that referenced
this issue
Jun 14, 2023
For example, the description of
optBoolean
isBut actually it returns the defaultValue only when the key is not in the json, and throws a RuntimeException in other cases.
The text was updated successfully, but these errors were encountered: