mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
fix(commonPipelineEnvironment): StackOverflowError (#2917)
* chore(cpe): add debug messages and catch error * fix catch * fix variable declaration * fix type name * check for instanceof JSONNull * check for net.sf.json.JSONNull * fix formatting * fix StackOverflow exception * Update vars/writePipelineEnv.groovy
This commit is contained in:
parent
3fa46f20d3
commit
d6b7a0f566
@ -222,15 +222,14 @@ class commonPipelineEnvironment implements Serializable {
|
||||
}
|
||||
|
||||
void createMapEntry(script, Map resMap, String filename, value) {
|
||||
try{
|
||||
if (value) {
|
||||
// prefix is assumed by step if nothing else is specified
|
||||
def prefix = ~/^.pipeline\/commonPipelineEnvironment\//
|
||||
filename -= prefix
|
||||
resMap[filename] = value
|
||||
}
|
||||
}catch(StackOverflowError error) {
|
||||
script.echo("failed to write file: " + filename)
|
||||
// net.sf.json.JSONNull can come in through readPipelineEnv via readJSON()
|
||||
// leaving them in will create a StackOverflowError further down in writePipelineEnv()
|
||||
// thus removing them from the map for now
|
||||
if (value != null && !(value instanceof net.sf.json.JSONNull)) {
|
||||
// prefix is assumed by step if nothing else is specified
|
||||
def prefix = ~/^.pipeline\/commonPipelineEnvironment\//
|
||||
filename -= prefix
|
||||
resMap[filename] = value
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user