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

readYAML with 0 bytes file returns LinkedList and fails on containsKey()

XMLWordPrintable

      When reading a yaml file with 0 bytes size using `readYAML` step it returns 
      LinkedList
      which fails on containsKey operation:
      ERROR: groovy.lang.MissingMethodException: No signature of method: java.util.LinkedList.containsKey() is applicable for argument types: (java.lang.String) values: [blabla]Possible solutions: contains(java.lang.Object), containsAll(java.util.Collection), contains(java.lang.Object), contains(java.lang.Object), containsAll([Ljava.lang.Object

      Reproduce by:

                          deleteDir()
                          sh "truncate -s 0 jenkins.yml"
                          def packagesYaml = readYaml(file: "jenkins.yml")
                          echo(packagesYaml.getClass().toString())
                          echo(packagesYaml.containsKey("hello").toString())

            rsandell rsandell
            barel_elbaz Barel Elbaz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: