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

rombert pushed a commit to branch feature/SLING-7245
in repository https://gitbox.apache.org/repos/asf/sling-tooling-jenkins.git


The following commit(s) were added to refs/heads/feature/SLING-7245 by this 
push:
     new febeae5  SLING-7245 - Validate pull requests using Jenkins
febeae5 is described below

commit febeae5b30adb593d06383bf8c26ef08fcc0e7fb
Author: Robert Munteanu <[email protected]>
AuthorDate: Wed Jan 30 10:19:16 2019 +0100

    SLING-7245 - Validate pull requests using Jenkins
    
    Avoid directly joining JSON arrays, it's not permitted.
---
 vars/slingOsgiBundleBuild.groovy | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/vars/slingOsgiBundleBuild.groovy b/vars/slingOsgiBundleBuild.groovy
index d25b0cb..8315b76 100644
--- a/vars/slingOsgiBundleBuild.groovy
+++ b/vars/slingOsgiBundleBuild.groovy
@@ -16,7 +16,7 @@ def call(Map params = [:]) {
 
     def moduleDir = params.containsKey('moduleDir') ? params.moduleDir : '.'
     def upstreamProjectsCsv = jobConfig.upstreamProjects ? 
-        jobConfig.upstreamProjects.join(',') : ''
+        jsonArrayToCsv(jobConfig.upstreamProjects) : ''
 
     node('ubuntu') {
 
@@ -66,7 +66,7 @@ def call(Map params = [:]) {
                             }
                         }
                         if ( reference && jobConfig.archivePatterns ) {
-                            archiveArtifacts(artifacts: 
jobConfig.archivePatterns.join(','), allowEmptyArchive: true)
+                            archiveArtifacts(artifacts: 
jsonArrayToCsv(jobConfig.archivePatterns), allowEmptyArchive: true)
                         }
                     }
                     reference = false
@@ -153,8 +153,15 @@ No further emails will be sent until the status of the 
build is changed.
         body += "Build log follows below:\n\n"
         body += '${BUILD_LOG}'
     }
-    def recipientList = []
-    recipients.each { r -> recipientList.add(r) }
 
-    emailext subject: subject, body: body, replyTo: '[email protected]', 
recipientProviders: recipientProviders, to: recipientList.join(',')
+    emailext subject: subject, body: body, replyTo: '[email protected]', 
recipientProviders: recipientProviders, to: jsonArrayToCsv(recipients)
+}
+
+// workaround for "Scripts not permitted to use method net.sf.json.JSONArray 
join java.lang.String"
+def jsonArrayToCsv(net.sf.json.JSONArray items) {
+    def result = []
+    items.each { item ->
+        result.add(item)
+    }
+    return items.join(',')
 }
\ No newline at end of file

Reply via email to