diff --git a/core/src/main/java/hudson/tools/ToolInstaller.java b/core/src/main/java/hudson/tools/ToolInstaller.java index 45f0fd789514ddfecb33e1a2e2e5ab796b96b41c..3d5f56df0f6e749262111682529c92fda2bf7c39 100644 --- a/core/src/main/java/hudson/tools/ToolInstaller.java +++ b/core/src/main/java/hudson/tools/ToolInstaller.java @@ -104,12 +104,19 @@ public abstract class ToolInstaller implements Describable, Exten * @since 1.310 */ protected final FilePath preferredLocation(ToolInstallation tool, Node node) { + if (node == null) { + throw new IllegalArgumentException("must pass non-null node"); + } String home = Util.fixEmptyAndTrim(tool.getHome()); if (home == null) { // XXX should this somehow uniquify paths among ToolInstallation.all()? home = tool.getName().replaceAll("[^A-Za-z0-9_.-]+", "_"); } - return node.getRootPath().child("tools").child(home); + FilePath root = node.getRootPath(); + if (root == null) { + throw new IllegalArgumentException("Node " + node.getDisplayName() + " seems to be offline"); + } + return root.child("tools").child(home); } public ToolInstallerDescriptor getDescriptor() {