Skip to content

Commit

Permalink
Merge pull request #1700 from jglick/NPE-JENKINS-28384
Browse files Browse the repository at this point in the history
[JENKINS-28384] NPE when Node.toComputer → null
  • Loading branch information
jglick committed May 13, 2015
2 parents 550ba0c + 86bac90 commit 49f5a45
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions core/src/main/java/hudson/model/LoadStatistics.java
Expand Up @@ -51,6 +51,7 @@
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.
Expand Down Expand Up @@ -614,13 +615,17 @@ public Builder withQueueLength(int queueLength) {
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();
Expand Down

0 comments on commit 49f5a45

Please sign in to comment.