From 6e9babd41e37381b8b2d7f24df01cd10f918c09f Mon Sep 17 00:00:00 2001 From: James Nord Date: Tue, 3 Jul 2018 13:28:33 +0100 Subject: [PATCH] Method just called and cast another method that was CheckForNull toComputer() was annotated with CHeckForNull yet getComputer which just calls that and casts it was not. This causes code using getComputer() to not have a findbugs check and this has been observed in a NullPOinterException happening at runtime. --- core/src/main/java/hudson/model/Slave.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index 9b0a02b338..c3a497f9a1 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -529,7 +529,12 @@ public abstract class Slave extends Node implements Serializable { /** * Gets the corresponding computer object. + * + * @return + * this method can return null if there's no {@link Computer} object for this node, + * such as when this node has no executors at all. */ + @CheckForNull public SlaveComputer getComputer() { return (SlaveComputer)toComputer(); }