1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-20 05:19:40 +02:00

fix: stackoverflow error when writing cpe file (#2729)

* catch stackoverflow error

* update log

* update log

* update log

* explicit return if value null

* wip

* wip

* wip

* wip

* prevent error

* cleanup

* cleanup

* use notify

* removed import

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
This commit is contained in:
lndrschlz 2021-03-29 13:44:55 +02:00 committed by GitHub
parent b70af2651e
commit b612a1fb3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,11 +206,15 @@ class commonPipelineEnvironment implements Serializable {
}
void writeValueToFile(script, String filename, value){
if (value){
if (!(value in CharSequence)) filename += '.json'
if (script.fileExists(filename)) return
if (!(value in CharSequence)) value = groovy.json.JsonOutput.toJson(value)
script.writeFile file: filename, text: value
try{
if (value){
if (!(value in CharSequence)) filename += '.json'
if (script.fileExists(filename)) return
if (!(value in CharSequence)) value = groovy.json.JsonOutput.toJson(value)
script.writeFile file: filename, text: value
}
}catch(StackOverflowError error) {
script.echo("failed to write file: " + filename)
}
}