code: private static void checkArguments(JSONObject jsonObject, String key) throws JSONException {
  		if (key == null) {
  			throw new IllegalArgumentException("Can't go searching for a null key.");
  		}
  		if (jsonObject == null) {
  			throw new JSONException("Can't search for key '" + key + "' in a null object.");
  		}
  		if (!jsonObject.containsKey(key)) {
  			throw new JSONException("Key '" + key + "' could not be found.");
  		}
  		// Please, proceed...
  	}
docs: ------------------------------------------------------------------------