mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
Avoid using Iterators to get around NotSerializableException (#1220)
This commit is contained in:
parent
d754a669b2
commit
4c97231ff9
@ -103,11 +103,11 @@ class WhitesourceConfigurationHelper implements Serializable {
|
||||
if (!moduleSpecificFile)
|
||||
moduleSpecificFile = [:]
|
||||
|
||||
mapping.each {
|
||||
entry ->
|
||||
def dependentValue = entry.omitIfPresent ? moduleSpecificFile[entry.omitIfPresent] : null
|
||||
if ((entry.omitIfPresent && !dependentValue || !entry.omitIfPresent) && (entry.force || moduleSpecificFile[entry.name] == null) && entry.value != 'null')
|
||||
moduleSpecificFile[entry.name] = entry.value.toString()
|
||||
for(int i = 0; i < mapping.size(); i++) {
|
||||
def entry = mapping.get(i)
|
||||
def dependentValue = entry.omitIfPresent ? moduleSpecificFile[entry.omitIfPresent] : null
|
||||
if ((entry.omitIfPresent && !dependentValue || !entry.omitIfPresent) && (entry.force || moduleSpecificFile[entry.name] == null) && entry.value != 'null')
|
||||
moduleSpecificFile[entry.name] = entry.value.toString()
|
||||
}
|
||||
|
||||
def output = serializationClosure(moduleSpecificFile)
|
||||
|
@ -53,8 +53,9 @@ class WhitesourceOrgAdminRepository implements Serializable {
|
||||
|
||||
def groups = []
|
||||
def users = []
|
||||
config.whitesource.emailAddressesOfInitialProductAdmins.each {
|
||||
email -> users.add(["email": email])
|
||||
for(int i = 0; i < config.whitesource.emailAddressesOfInitialProductAdmins.size(); i++) {
|
||||
def email = config.whitesource.emailAddressesOfInitialProductAdmins.get(i)
|
||||
users.add(["email": email])
|
||||
}
|
||||
|
||||
requestBody = [
|
||||
|
@ -521,10 +521,10 @@ int checkSecurityViolations(Map config, WhitesourceRepository repository) {
|
||||
def projectsMetaInformation = repository.fetchProjectsMetaInfo()
|
||||
def vulnerabilities = repository.fetchVulnerabilities(projectsMetaInformation)
|
||||
def severeVulnerabilities = 0
|
||||
vulnerabilities.each {
|
||||
item ->
|
||||
if ((item.vulnerability.score >= config.whitesource.cvssSeverityLimit || item.vulnerability.cvss3_score >= config.whitesource.cvssSeverityLimit) && config.whitesource.cvssSeverityLimit >= 0)
|
||||
severeVulnerabilities++
|
||||
for(int i = 0; i < vulnerabilities.size(); i++) {
|
||||
def item = vulnerabilities.get(i)
|
||||
if ((item.vulnerability.score >= config.whitesource.cvssSeverityLimit || item.vulnerability.cvss3_score >= config.whitesource.cvssSeverityLimit) && config.whitesource.cvssSeverityLimit >= 0)
|
||||
severeVulnerabilities++
|
||||
}
|
||||
|
||||
writeFile(file: "${config.vulnerabilityReportFileName}.json", text: new JsonUtils().groovyObjectToPrettyJsonString(vulnerabilities))
|
||||
|
Loading…
x
Reference in New Issue
Block a user