From 7a8066027cb93b7bb6618ee973ea27513a7c3f40 Mon Sep 17 00:00:00 2001 From: Alex Volanis Date: Fri, 21 Sep 2018 17:01:08 -0400 Subject: [PATCH] Fix issue with Jenkins 2.141 and changes for JENKINS-52818 The new logic exposed this incorrect usage from this plugin. Had to add null guard because this is failing a findbugs test although the .get() method is marked with @Nonnull annotation in the Jenkins core class. --- .../stashpullrequestbuilder/StashBuilds.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashBuilds.java b/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashBuilds.java index ca015277..451d9560 100644 --- a/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashBuilds.java +++ b/src/main/java/stashpullrequestbuilder/stashpullrequestbuilder/StashBuilds.java @@ -49,8 +49,8 @@ public void onCompleted(Run run, TaskListener listener) { return; } Result result = run.getResult(); - JenkinsLocationConfiguration globalConfig = new JenkinsLocationConfiguration(); - String rootUrl = globalConfig.getUrl(); + JenkinsLocationConfiguration globalConfig = JenkinsLocationConfiguration.get(); + String rootUrl = globalConfig == null ? null : globalConfig.getUrl(); String buildUrl = ""; if (rootUrl == null) { buildUrl = " PLEASE SET JENKINS ROOT URL FROM GLOBAL CONFIGURATION " + run.getUrl();