-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 2.107.2, Linux
I have the following YAML:
this: is: a: string: "44e6696"
I would expect that when I call readYaml in a Jenkins pipeline, the value of "44e6696" will be preserved as a String. Instead, it appears to be parsed as a Double and ends up with the value of Infinity:
def yaml = readYaml(file: "myFile.yaml") echo "Class info: ${yaml.this.is.a.string.getClass().dump()}" echo "Value: ${yaml.this.is.a.string}"
Class info: <java.lang.Class@78e67e0a cachedConstructor=null newInstanceCallerCache=null name=java.lang.Double reflectionData=java.lang.ref.SoftReference@2f922ce0 classRedefinedCount=0 genericInfo=sun.reflect.generics.repository.ClassRepository@51a80565 enumConstants=null enumConstantDirectory=null annotationData=null annotationType=null classValueMap=null> Value: Infinity
I have not been able to identify a workaround.
[JENKINS-51030] readYaml parses numerical strings as Double.Infinity
Description |
Original:
I have the following YAML: {code:yaml} this: is: a: string: "44e6696" {code} I would expect that when I call {{readYaml}} in a Jenkins pipeline, the value of "44e6696" will be preserved as a String. Instead, it appears to be parsed as a Double and ends up with the value of {{Infinity}}: {code:groovy} def yaml = readYaml(file: "myFile.yaml") echo "Class info: ${yaml.this.is.a.string.getClass().dump()}" echo "Value: ${yaml.this.is.a.string}" {code} {code} Class info: <java.lang.Class@78e67e0a cachedConstructor=null newInstanceCallerCache=null name=java.lang.Double reflectionData=java.lang.ref.SoftReference@2f922ce0 classRedefinedCount=0 genericInfo=sun.reflect.generics.repository.ClassRepository@51a80565 enumConstants=null enumConstantDirectory=null annotationData=null annotationType=null classValueMap=null> Value: Infinity {code} I have not been able to identify a workaround. |
New:
I have the following YAML: {code} this: is: a: string: "44e6696" {code} I would expect that when I call {{readYaml}} in a Jenkins pipeline, the value of "44e6696" will be preserved as a String. Instead, it appears to be parsed as a Double and ends up with the value of {{Infinity}}: {code} def yaml = readYaml(file: "myFile.yaml") echo "Class info: ${yaml.this.is.a.string.getClass().dump()}" echo "Value: ${yaml.this.is.a.string}" {code} {code} Class info: <java.lang.Class@78e67e0a cachedConstructor=null newInstanceCallerCache=null name=java.lang.Double reflectionData=java.lang.ref.SoftReference@2f922ce0 classRedefinedCount=0 genericInfo=sun.reflect.generics.repository.ClassRepository@51a80565 enumConstants=null enumConstantDirectory=null annotationData=null annotationType=null classValueMap=null> Value: Infinity {code} I have not been able to identify a workaround. |
Component/s | New: pipeline-utility-steps-plugin [ 21135 ] | |
Component/s | Original: core [ 15593 ] |