You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2018/06/29 13:10:06 UTC

[maven-jenkins-lib] branch master updated: Add removeFromCollection() due to RejectedAccessException on Collection.remove(Object)

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

rfscholte 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 1226a78  Add removeFromCollection() due to RejectedAccessException on Collection.remove(Object)
1226a78 is described below

commit 1226a78f60867e48df716e1667fd7d8e40bd5a27
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Jun 29 15:09:59 2018 +0200

    Add removeFromCollection() due to RejectedAccessException on Collection.remove(Object)
---
 vars/asfMavenTlpPlgnBuild.groovy | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/vars/asfMavenTlpPlgnBuild.groovy b/vars/asfMavenTlpPlgnBuild.groovy
index 5d706bb..83f6af1 100644
--- a/vars/asfMavenTlpPlgnBuild.groovy
+++ b/vars/asfMavenTlpPlgnBuild.groovy
@@ -41,7 +41,7 @@ def call(Map params = [:]) {
     for (String os in oses) {
       for (def mvn in mavens) {
 	    def jdk = jenkinsEnv.jdkForMaven(mvn)
-		jdks.remove(jdk)
+		jdks = removeFromCollection(jdks,jdk)
 	    doCreateTask( os, jdk, mvn, tasks )
       }
       for (def jdk in jdks) {
@@ -86,6 +86,13 @@ def call(Map params = [:]) {
   }
 }
 
+// org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:
+//    Scripts not permitted to use method java.util.Collection remove java.lang.Object
+def removeFromCollection( list, item )
+{
+  list.stream().filter{ it != item }.collect()
+} 
+
 def doCreateTask( os, jdk, maven, tasks )
 {
 	String label = jenkinsEnv.labelForOS(os);