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

.plus() method works incorrect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • groovy-plugin, pipeline
    • None
    •  Jenkins ver. 2.164.1

      Problem code:

      script {
      TEST_STRING="oen/two/three"
      TEST_LIST=TEST_STRING.split("/")
      echo "$TEST_LIST"
      TEST_LIST=TEST_LIST.plus(0,"one")
      echo "$TEST_LIST"
      }
      

      Expected output:

      [Pipeline] echo
      08:58:07  [oen, two, three]
      [Pipeline] echo
      08:58:07  [one, two, three]
      

      Current output:

      [Pipeline] echo
      08:58:07  [oen, two, three]
      [Pipeline] echo
      08:58:07  [oen, two, three, 0, one]
      

            vjuranek vjuranek
            gek gek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: