commit | d34aaf27eee381a2943afbb55f58dd1c1de92d8c | [log] [tgz] |
---|---|---|
author | 柯志勇10068695 <ke.zhiyong@zte.com.cn> | Tue Oct 23 17:18:19 2018 +0800 |
committer | zhiyong ke <ke.zhiyong@zte.com.cn> | Tue Oct 23 09:13:09 2018 +0000 |
tree | 423aac0745843a2c00200322c255424fc0e2a583 | |
parent | 4c615ac8d8c240dc34c190dc4596b737f02c63db [diff] |
If dataNodeList if null or empty, the following code dataNodeList.get(0) will get an error. Change-Id: Ia2599f7b6a8af3823497c0f6a3098de931f5407a
diff --git a/apps/restconf/restconfmgr/src/main/java/org/onosproject/restconf/restconfmanager/RestconfManager.java b/apps/restconf/restconfmgr/src/main/java/org/onosproject/restconf/restconfmanager/RestconfManager.java index 21410f6..673ee62 100644 --- a/apps/restconf/restconfmgr/src/main/java/org/onosproject/restconf/restconfmanager/RestconfManager.java +++ b/apps/restconf/restconfmgr/src/main/java/org/onosproject/restconf/restconfmanager/RestconfManager.java
@@ -230,6 +230,10 @@ ResourceData receivedData = convertJsonToDataNode(rmLastPathSegment(rl.uriForYangRuntime()), rootNode); ResourceId rid = receivedData.resourceId(); List<DataNode> dataNodeList = receivedData.dataNodes(); + if (dataNodeList == null || dataNodeList.isEmpty()) { + log.warn("There is no one Data Node can be proceed."); + return; + } if (dataNodeList.size() > 1) { log.warn("There are more than one Data Node can be proceed: {}", dataNodeList.size()); }