You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "bd2019us (JIRA)" <ji...@apache.org> on 2019/04/01 00:59:00 UTC
[jira] [Created] (UNOMI-224) JSONObject.getString() may cause
exception, optString() should be used.
bd2019us created UNOMI-224:
------------------------------
Summary: JSONObject.getString() may cause exception, optString() should be used.
Key: UNOMI-224
URL: https://issues.apache.org/jira/browse/UNOMI-224
Project: Apache Unomi
Issue Type: Bug
Reporter: bd2019us
Location : tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo121.java:104,106,116
The method JSONObject.getString(key) may throw JSONException when the key does not exist, which will crash the program. To ensure safety, the JSONObject.optString(key) should be used, which will return a default value ("") when the key does not exist and avoid program to crash.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)