Merge pull request #698 from marcusholl/pr/DoNotReturnWrongValueIfOnlyAPartOfAPathCanBeResolved

[fix] do not return a wrong config value if only a part of the path c…
This commit is contained in:
Marcus Holl
2019-05-15 10:26:43 +02:00
committed by GitHub
+6 -5
View File
@@ -375,11 +375,12 @@ class Helper {
return mappings
}
static getValue(Map config, def pPath) {
def p =config[pPath.head()]
static getValue(Map config, List pPath) {
def p = config[pPath.head()]
if(pPath.size() == 1) return p // there is no tail
if(p in Map) getValue(p, pPath.tail())
else return p
return null // there is a remaining path which could not be resolved.
// the value we are looking for does not exist.
}
static resolveDocuRelevantSteps(GroovyScriptEngine gse, File stepsDir) {
@@ -640,7 +641,7 @@ def handleStep(stepName, prepareDefaultValuesStep, gse, customDefaults) {
it ->
def defaultValue = Helper.getValue(defaultConfig, it.split('/'))
def defaultValue = Helper.getValue(defaultConfig, it.tokenize('/'))
def parameterProperties = [
defaultValue: defaultValue,
@@ -675,7 +676,7 @@ def handleStep(stepName, prepareDefaultValuesStep, gse, customDefaults) {
[
dependentParameterKey: dependentParameterKey,
key: possibleValue,
value: Helper.getValue(defaultConfig.get(possibleValue), k.split('/'))
value: Helper.getValue(defaultConfig.get(possibleValue), k.tokenize('/'))
]
}
}