From 248889519b8607a5838ca227bb9edc85bb40aff8 Mon Sep 17 00:00:00 2001 From: Eric Bartusch Date: Wed, 29 May 2019 15:07:58 -0500 Subject: [PATCH 1/2] Update ActiveNotifier.java Fixing issue where previous build could also be current build if multiple builds were running concurrently --- src/main/java/jenkins/plugins/slack/ActiveNotifier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/jenkins/plugins/slack/ActiveNotifier.java b/src/main/java/jenkins/plugins/slack/ActiveNotifier.java index a8917dbf..787b3b09 100755 --- a/src/main/java/jenkins/plugins/slack/ActiveNotifier.java +++ b/src/main/java/jenkins/plugins/slack/ActiveNotifier.java @@ -134,7 +134,7 @@ public void completed(AbstractBuild r) { if (null != previousBuild) { do { previousBuild = previousBuild.getPreviousCompletedBuild(); - } while (null != previousBuild && previousBuild.getResult() == Result.ABORTED); + } while ((null != previousBuild && previousBuild.getResult() == Result.ABORTED) || previousBuild.getNumber() == r.getNumber()); if (null != previousBuild) { log.info(key, "found #%d as previous completed, non-aborted build", previousBuild.getNumber()); } else { From 95d60ee2cb7e213b491eb71e17510e32c229d3b6 Mon Sep 17 00:00:00 2001 From: Eric Bartusch Date: Wed, 29 May 2019 18:57:31 -0500 Subject: [PATCH 2/2] adding null check --- src/main/java/jenkins/plugins/slack/ActiveNotifier.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/jenkins/plugins/slack/ActiveNotifier.java b/src/main/java/jenkins/plugins/slack/ActiveNotifier.java index 787b3b09..a545d74a 100755 --- a/src/main/java/jenkins/plugins/slack/ActiveNotifier.java +++ b/src/main/java/jenkins/plugins/slack/ActiveNotifier.java @@ -134,7 +134,7 @@ public void completed(AbstractBuild r) { if (null != previousBuild) { do { previousBuild = previousBuild.getPreviousCompletedBuild(); - } while ((null != previousBuild && previousBuild.getResult() == Result.ABORTED) || previousBuild.getNumber() == r.getNumber()); + } while ((null != previousBuild && previousBuild.getResult() == Result.ABORTED) || (null != previousBuild && previousBuild.getNumber() == r.getNumber())); if (null != previousBuild) { log.info(key, "found #%d as previous completed, non-aborted build", previousBuild.getNumber()); } else {