Skip to content
Permalink
Browse files
Merge pull request #11 from beckje01/master
Null Pointer Fix [JENKINS-10467]
  • Loading branch information
vjuranek committed Jul 29, 2011
2 parents 86e0902 + e38d523 commit a1f916ed0aaf9c9e11e399416f3cd01c6c9bccbe
Showing 2 changed files with 10 additions and 1 deletion.
@@ -124,7 +124,7 @@ public SlaveTemplate getTemplate(String ami) {
*/
public SlaveTemplate getTemplate(Label label) {
for (SlaveTemplate t : templates)
if(label.matches(t.getLabelSet()))
if(label == null || label.matches(t.getLabelSet()))
return t;
return null;
}
@@ -39,5 +39,14 @@ public void testLabelExpression() throws Exception{
assertEquals(false, ac.canProvision(Label.parseExpression("aaa || bbb")));
assertEquals(false, ac.canProvision(Label.parseExpression("aaa || bbb")));
}

public void testEmptyLabel() throws Exception{
SlaveTemplate temp = new SlaveTemplate("ami", "foo", "22", InstanceType.LARGE, "", "foo ami", "bar", "aaa", "10", "rrr", "fff", "-Xmx1g");
List<SlaveTemplate> templates = new ArrayList<SlaveTemplate>();
templates.add(temp);
ac = new AmazonEC2Cloud(AwsRegion.US_EAST_1, "abc", "def", "ghi", "3", templates);

assertEquals(true, ac.canProvision(null));
}

}

0 comments on commit a1f916e

Please sign in to comment.