Skip to content
Permalink
Browse files
Merge pull request #1700 from jglick/NPE-JENKINS-28384
[JENKINS-28384] NPE when Node.toComputer → null
  • Loading branch information
jglick committed May 13, 2015
2 parents 550ba0c + 86bac90 commit 49f5a4586720ba4eed50c214558f65fd4692542f
Showing with 9 additions and 4 deletions.
  1. +9 −4 core/src/main/java/hudson/model/LoadStatistics.java
@@ -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.
@@ -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();

0 comments on commit 49f5a45

Please sign in to comment.