File tree 1 file changed +9
-1
lines changed
interfaces/src/main/java/io/bdeploy/interfaces/variables
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
package io .bdeploy .interfaces .variables ;
2
2
3
3
import java .util .Collection ;
4
+ import java .util .List ;
4
5
import java .util .stream .Collectors ;
5
6
6
7
import com .google .common .collect .MoreCollectors ;
7
8
8
9
import io .bdeploy .interfaces .configuration .dcu .ApplicationConfiguration ;
10
+ import io .bdeploy .interfaces .configuration .dcu .ParameterConfiguration ;
9
11
import io .bdeploy .interfaces .configuration .instance .InstanceNodeConfiguration ;
10
12
11
13
/**
@@ -68,7 +70,13 @@ public ApplicationConfiguration getAppById(String appId) {
68
70
}
69
71
70
72
public String getParam (ApplicationConfiguration app , String paramId ) {
71
- return app .start .parameters .stream ().filter (p -> p .uid .equals (paramId )).collect (MoreCollectors .onlyElement ()).value ;
73
+ List <ParameterConfiguration > params = app .start .parameters .stream ().filter (p -> p .uid .equals (paramId ))
74
+ .collect (Collectors .toList ());
75
+ if (params .size () != 1 ) {
76
+ throw new IllegalArgumentException (
77
+ "Cannot find unique parameter " + paramId + " for application " + app .name + ", found " + params .size ());
78
+ }
79
+ return params .get (0 ).value ;
72
80
}
73
81
74
82
}
You can’t perform that action at this time.
0 commit comments