[FIXED JENKINS-9003] NPE when polling after node removed

This commit is contained in:
Christoph Kutzinski committed 2011-05-22 12:58:10 +02:00
1 parent 68f5a0d23a
commit 0b01182b8d
2 files changed
+22 -1

No files matched your search

@@ -1263,7 +1263,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
// lock the workspace of the last build
FilePath ws=lb.getWorkspace();
if (ws==null || !ws.exists()) {
if (workspaceOffline(lb)) {
// workspace offline. build now, or nothing will ever be built
Label label = getAssignedLabel();
if (label != null && label.isSelfLabel()) {
@@ -1326,6 +1326,24 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return NO_CHANGES;
}
}
private boolean workspaceOffline(R build) throws IOException, InterruptedException {
FilePath ws = build.getWorkspace();
if (ws==null || !ws.exists()) {
return true;
}
Node builtOn = build.getBuiltOn();
if (builtOn == null) { // node built-on doesn't exist anymore
return true;
}
if (builtOn.toComputer() == null) { // node still exists, but has 0 executors - o.s.l.t.
return true;
}
return false;
}
/**
* Returns true if this user has made a commit to this project.