提交 e80fd614 编写于 作者: J Jesse Glick

[FIXED JENKINS-47455] Null safety relating to offline nodes.

上级 e3f151f7
......@@ -436,11 +436,19 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
protected Lease decideWorkspace(@Nonnull Node n, WorkspaceList wsl) throws InterruptedException, IOException {
String customWorkspace = getProject().getCustomWorkspace();
if (customWorkspace != null) {
FilePath rootPath = n.getRootPath();
if (rootPath == null) {
throw new AbortException(n.getDisplayName() + " seems to be offline");
}
// we allow custom workspaces to be concurrently used between jobs.
return Lease.createDummyLease(n.getRootPath().child(getEnvironment(listener).expand(customWorkspace)));
return Lease.createDummyLease(rootPath.child(getEnvironment(listener).expand(customWorkspace)));
}
// TODO: this cast is indicative of abstraction problem
return wsl.allocate(n.getWorkspaceFor((TopLevelItem)getProject()), getBuild());
FilePath ws = n.getWorkspaceFor((TopLevelItem) getProject());
if (ws == null) {
throw new AbortException(n.getDisplayName() + " seems to be offline");
}
return wsl.allocate(ws, getBuild());
}
public Result run(@Nonnull BuildListener listener) throws Exception {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册