Distribution fails when no user input required in design 14/95214/2
authorsarada prasad sahoo <sarada.prasad.sahoo@huawei.com>
Mon, 9 Sep 2019 09:28:34 +0000 (14:58 +0530)
committersarada prasad sahoo <sarada.prasad.sahoo@huawei.com>
Mon, 9 Sep 2019 09:33:44 +0000 (15:03 +0530)
When we distribute a design from SDC and design does
not have any user input in properties, then distribution
fails with error ArrayIndexOutOfBoundException

Issue-ID: SO-2279
Signed-off-by: sarada prasad sahoo <sarada.prasad.sahoo@huawei.com>
Change-Id: I47bd724e25d81befc09ec452aa63d8519c927520

asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java

index 10fd55a..e8e068a 100644 (file)
@@ -26,6 +26,7 @@ package org.onap.so.asdc.installer.heat;
 
 import java.sql.Timestamp;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
@@ -580,7 +581,8 @@ public class ToscaResourceInstaller {
         String outInput;
         String defaultValue = null;
         if (value instanceof Map) {
-            outInput = ((LinkedHashMap) value).values().toArray()[0].toString();
+            Collection values = ((LinkedHashMap) value).values();
+            outInput = (values.size() > 0) ? values.toArray()[0].toString() : "";
         } else if (value instanceof GetInput) {
             String inputName = ((GetInput) value).getInputName();
             Optional<Input> inputOptional =