If dataNodeList if null or empty, the following code dataNodeList.get(0) will get an error.

Change-Id: Ia2599f7b6a8af3823497c0f6a3098de931f5407a
This commit is contained in:
柯志勇10068695 2018-10-23 17:18:19 +08:00 committed by zhiyong ke
parent 4c615ac8d8
commit d34aaf27ee

View File

@ -230,6 +230,10 @@ public class RestconfManager implements RestconfService {
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());
}