Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-51030

readYaml parses numerical strings as Double.Infinity

XMLWordPrintable

      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.

            Unassigned Unassigned
            ssmall_blue Spencer Small
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: