If dataNodeList if null or empty, the following code dataNodeList.get(0) will get an error.
Change-Id: Ia78cc64d322ab89cdb588891c1fbb2db8a6eb586
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 8c8d58f..21410f6 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
@@ -140,6 +140,10 @@
ResourceData receivedData = convertJsonToDataNode(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());
}
@@ -175,6 +179,10 @@
DataResourceLocator rl = DataResourceLocator.newInstance(uri);
ResourceData receivedData = convertJsonToDataNode(rmLastPathSegment(rl.uriForYangRuntime()), rootNode);
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());
}