commit | f6421e8f2f61e6827d0898e6141b0e1210fbcc84 | [log] [tgz] |
---|---|---|
author | kezhiyong <ke.zhiyong@zte.com.cn> | Wed Jan 16 06:42:06 2019 +0000 |
committer | Andrea Campanella <andrea@opennetworking.org> | Wed Jan 16 08:17:22 2019 +0000 |
tree | 03f2e2b67607459ea2fe99b582737327eb46311e | |
parent | a60a2d9124f00e4cf7d8575a2756bac627fe9129 [diff] |
If modelObject is empty here, it may cause exception later. Change-Id: I892fdde7dabbf9dc55a74a6722413e260d0eedae (cherry picked from commit b227781dea877d44d2f5157cde2bc445a538d71e)
diff --git a/apps/odtn/api/src/main/java/org/onosproject/odtn/utils/tapi/TapiObjectHandler.java b/apps/odtn/api/src/main/java/org/onosproject/odtn/utils/tapi/TapiObjectHandler.java index 15208a2..9b36a2d 100644 --- a/apps/odtn/api/src/main/java/org/onosproject/odtn/utils/tapi/TapiObjectHandler.java +++ b/apps/odtn/api/src/main/java/org/onosproject/odtn/utils/tapi/TapiObjectHandler.java
@@ -240,6 +240,9 @@ if (modelObjectData.modelObjects().size() > 1) { throw new IllegalStateException("Multiple modelObject found."); } + if (modelObjectData.modelObjects().isEmpty()) { + throw new IllegalStateException("ModelObject must not be empty."); + } return (T) modelObjectData.modelObjects().get(0); }