You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eagle.apache.org by "bd2019us (JIRA)" <ji...@apache.org> on 2019/03/31 21:46:00 UTC
[jira] [Created] (EAGLE-1094) JSONObject.getString() may cause
exception, optString() should be used.
bd2019us created EAGLE-1094:
-------------------------------
Summary: JSONObject.getString() may cause exception, optString() should be used.
Key: EAGLE-1094
URL: https://issues.apache.org/jira/browse/EAGLE-1094
Project: Eagle
Issue Type: Bug
Reporter: bd2019us
Locations:
(1) eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/extractor/hdfs/HdfsTopologyEntityParser.java:158
(2) eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/extractor/hdfs/HdfsTopologyEntityParser.java:165
(3) eagle-topology-check/eagle-topology-app/src/main/java/org/apache/eagle/topology/extractor/hdfs/HdfsTopologyEntityParser.java:180
(4) eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/resolver/MAPRFSVolumeResolver.java:117
(5) eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/rest/MapRNameResolver.java:65
JSONObject.getString(elem) would throw an exception if the key of "elem" does not exist, which may cause the program crash. Therefore, another one "optString()" should be used to avoid such kind of errors since it will return a default value ("") and won't risk the program in crashing.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)