Skip to content

Commit 4a9c2a3

Browse files
committed
Our API could use "no" to denote false. Make sure our implementation of getBool catches it.
1 parent ab0599a commit 4a9c2a3

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/JSONUtils.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,11 @@ public static boolean getBool(JSONObject json, String name) {
210210
return false;
211211
if (value.equalsIgnoreCase("false"))
212212
return false;
213+
if (value.equalsIgnoreCase("no"))
214+
return false;
213215
return true;
214216
}
215217

216-
public static boolean isStringTrue(JSONObject json, String name) {
217-
String rawAvailable = json.optString(name).toLowerCase();
218-
return "yes".equals(rawAvailable) || "1".equals(rawAvailable) || "true".equals(rawAvailable);
219-
}
220-
221218
/*
222219
* returns the JSONObject child of the passed parent that matches the passed query
223220
* this is basically an "optJSONObject" that supports nested queries, for example:

0 commit comments

Comments
 (0)