You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2019/08/02 19:39:44 UTC

[maven-jenkins-lib] branch master updated: last() cannot be called on []

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-jenkins-lib.git


The following commit(s) were added to refs/heads/master by this push:
     new 85661cb  last() cannot be called on []
85661cb is described below

commit 85661cb08f55035a841c11abd767f4009c9b0831
Author: tibordigana <ti...@apache.org>
AuthorDate: Fri Aug 2 21:39:27 2019 +0200

    last() cannot be called on []
---
 vars/asfMavenTlpPlgnBuild.groovy | 6 +++---
 vars/asfMavenTlpStdBuild.groovy  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/vars/asfMavenTlpPlgnBuild.groovy b/vars/asfMavenTlpPlgnBuild.groovy
index a3e9007..6e04081 100644
--- a/vars/asfMavenTlpPlgnBuild.groovy
+++ b/vars/asfMavenTlpPlgnBuild.groovy
@@ -99,10 +99,10 @@ def call(Map params = [:]) {
       echo "***** FAST FAILURE *****\n\nFast failure triggered by ${taskContext.failingFast}\n\n***** FAST FAILURE *****"
     }
     stage("Notifications") {
-      def isFirstBuild = currentBuild == null || currentBuild.changeSets == null
-	  def authors = isFirstBuild ? [] : currentBuild.changeSets.last().toList().collect { it.author.toString() }.unique()
+	  def changes = currentBuild?.changeSets
+	  def authors = !changes || changes.isEmpty() ? [] : currentBuild.changeSets.last().toList().collect { it.author.toString() }.unique()
 	  println("The author of the last change: ${authors}")
-	  if (isFirstBuild || !authors.contains('github')) jenkinsNotify()
+	  if (!changes || !authors.contains('github')) jenkinsNotify()
     }
   }
 }
diff --git a/vars/asfMavenTlpStdBuild.groovy b/vars/asfMavenTlpStdBuild.groovy
index d906adf..6288337 100644
--- a/vars/asfMavenTlpStdBuild.groovy
+++ b/vars/asfMavenTlpStdBuild.groovy
@@ -179,10 +179,10 @@ def call(Map params = [:]) {
       echo "***** FAST FAILURE *****\n\nFast failure triggered by ${failingFast}\n\n***** FAST FAILURE *****"
     }
     stage("Notifications") {
-      def isFirstBuild = currentBuild == null || currentBuild.changeSets == null
-	  def authors = isFirstBuild ? [] : currentBuild.changeSets.last().toList().collect { it.author.toString() }.unique()
+	  def changes = currentBuild?.changeSets
+	  def authors = !changes || changes.isEmpty() ? [] : currentBuild.changeSets.last().toList().collect { it.author.toString() }.unique()
 	  println("The author of the last change: ${authors}")
-	  if (isFirstBuild || !authors.contains('github')) jenkinsNotify()
+	  if (!changes || !authors.contains('github')) jenkinsNotify()
     }
   }
 }