提交 86bac90f 编写于 作者: J Jesse Glick

[FIXED JENKINS-28384] NPE when Node.toComputer → null.

上级 f728da2b
......@@ -51,6 +51,7 @@ import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
import javax.annotation.CheckForNull;
/**
* Utilization statistics for a node or a set of nodes.
......@@ -614,13 +615,17 @@ public abstract class LoadStatistics {
return this;
}
public Builder with(Node node) {
if (node != null)
return with(node.toComputer());
public Builder with(@CheckForNull Node node) {
if (node != null) {
return with(node.toComputer());
}
return this;
}
public Builder with(Computer computer) {
public Builder with(@CheckForNull Computer computer) {
if (computer == null) {
return this;
}
if (computer.isOnline()) {
final List<Executor> executors = computer.getExecutors();
final boolean acceptingTasks = computer.isAcceptingTasks();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册