[SDC-402] TDP 335705 test fix
authorPavel Aharoni <pa0916@att.com>
Wed, 27 Sep 2017 07:18:38 +0000 (10:18 +0300)
committerPavel Aharoni <pa0916@att.com>
Wed, 27 Sep 2017 07:21:52 +0000 (10:21 +0300)
Change-Id: Ia9a72c70fe084bba250da316bc9d4d443c010c79
Signed-off-by: Pavel Aharoni <pa0916@att.com>
pom.xml
src/main/java/org/openecomp/sdc/toscaparser/api/functions/GetInput.java

diff --git a/pom.xml b/pom.xml
index ba462d9..cf28b14 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
 
        <groupId>org.openecomp.sdc.jtosca</groupId>
        <artifactId>jtosca</artifactId>
-       <version>1.1.11-SNAPSHOT</version>
+       <version>1.1.12-SNAPSHOT</version>
         <name>sdc-jtosca</name>
        <properties>
 
index 14b0d4e..0c96b0f 100644 (file)
@@ -73,9 +73,14 @@ public class GetInput extends Function {
                        }
                }
                if(inputDef != null) {
-                       if (args.size() == 2 && args.get(1) instanceof Integer) {
-                               if (inputDef.getDefault() != null && inputDef.getDefault() instanceof ArrayList) {
+                       if (args.size() == 2 && inputDef.getDefault() != null && inputDef.getDefault() instanceof ArrayList){
+                               if ( args.get(1) instanceof Integer
+                                               && ((ArrayList) inputDef.getDefault()).size()> ((Integer)args.get(1)).intValue()) {
                                        return ((ArrayList) inputDef.getDefault()).get(((Integer)args.get(1)).intValue());
+                               }else{
+                                       ThreadLocalsHolder.getCollector().appendValidationIssue(new JToscaValidationIssue("JE274",(String.format(
+                                                       "GetInputError: cannot resolve input Def name \"%s\", the expected structure is an argument with a name of input type list and a second argument with an index in the list", args.get(0)))));
+                                       return null;
                                }
                        }
                        return inputDef.getDefault();