liuxunorg commented on issue #3344: [ZEPPELIN-4102] fix "getJSONObject()" to "optJSONObject()" to avoid crash URL: https://github.com/apache/zeppelin/pull/3344#issuecomment-497989773 @bd2019us , thanks for the contribution! :-) The next time you mention PR, Please add a point to solve the problem description. This will help others review the code. And merge it in as soon as possible. ### When the return value is not a JSONObject object, the return value is null, and no exception is thrown; ``` public JSONObject optJSONObject(String name) { Object object = opt(name); return object instanceof JSONObject ? (JSONObject) object : null; } ``` ### Throws an exception when the return value is not a JSONObject object; ``` public JSONObject getJSONObject(String name) throws JSONException { Object object = get(name); if (object instanceof JSONObject) { return (JSONObject) object; } else { throw JSON.typeMismatch(name, object, "JSONObject"); } } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services