Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIX JENKINS-16624] executing a build leads to NPE
Initialize a ClearcaseInstallation properly in case it has never been
initalized through a global settings save.
  • Loading branch information
Vlatombe committed Feb 4, 2013
1 parent 79b281a commit fd0a41c
Showing 1 changed file with 8 additions and 8 deletions.
Expand Up @@ -70,11 +70,15 @@ public class ClearCaseInstallation extends ToolInstallation implements NodeSpeci
public final static String CLEARTOOL_EXE = "bin/cleartool";
public final static String CLEARTOOL_EXE_FALLBACK = "cleartool";

private ClearCaseInstallation() {
this(null);
}

@DataBoundConstructor
public ClearCaseInstallation(String home) {
super(NAME, home, Collections.EMPTY_LIST);
}

public ClearCaseInstallation forNode(Node node, TaskListener log) throws IOException, InterruptedException {
return new ClearCaseInstallation(translateFor(node, log));
}
Expand Down Expand Up @@ -102,8 +106,7 @@ public String getCleartoolExe(Node node, TaskListener listener) {
public static class DescriptorImpl extends ToolDescriptor<ClearCaseInstallation> {

public DescriptorImpl() {
// let's avoid a NullPointerException in getInstallations()
setInstallations(new ClearCaseInstallation[0]);
setInstallations(new ClearCaseInstallation());
load();
}

Expand Down Expand Up @@ -163,11 +166,8 @@ public String getDisplayName() {
}

public ClearCaseInstallation getInstallation() {
ClearCaseInstallation[] installations = getInstallations();
if(installations.length > 0) {
return installations[0];
}
return null;
// It is expected to have always one clearcase installation
return getInstallations()[0];
}

public String getDefaultViewName() {
Expand Down

0 comments on commit fd0a41c

Please sign in to comment.