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

Map.get("${var}") returns null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • pipeline
    • Jenkins 2.204.4 LTS

      When accessing a map key via .get() with a var replacement in the key the get operation always returns null.

       

      Example snippet:

      def map = ["key_identifier": "test"]

      def id = "identifier"
      def resA = map.get("key_identifier")
      print(resA)

      def resB = map.get("key_${id}")
      print(resB)
       
      This will return in the output:
      Test
      null

            Unassigned Unassigned
            snapstromegon Raphael Höser
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: