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

Reactive Parameter ignores toString

    Details

    • Similar Issues:

      Description

      class Choice {
      	String tag
      	String branch
      	@Override
      	String toString() {
      		return tag  + ' / ' + branch
      	}
      }
      def obj1 = new Choice(branch: '1', tag:"3")
      def obj2 = new Choice(branch: '2', tag:"4")
      return [obj1, obj2] 

      The following groovy script works fine for Active Choice parameter, but broken for Reactive one.

      For some reason, Reactive version ignores toString (yet it shows correct string for a second), showing "Object" string instead:

      First paramater is reactive, the second is non-reactive

        Attachments

          Activity

          Hide
          kinow Bruno P. Kinoshita added a comment -

          Oh, interesting problem. Thanks for reporting. I'll need to debug to understand what's going on. Might have time this coming Sunday (NZ time).

          Show
          kinow Bruno P. Kinoshita added a comment - Oh, interesting problem. Thanks for reporting. I'll need to debug to understand what's going on. Might have time this coming Sunday (NZ time).
          Hide
          kinow Bruno P. Kinoshita added a comment -

          Just a quick update. I debugged this issue over the weekend, but couldn't understand why it was happening. Reproducing was quite simple, thanks to the example provided in the issue description. Will have another go next time I have some spare time.

          Show
          kinow Bruno P. Kinoshita added a comment - Just a quick update. I debugged this issue over the weekend, but couldn't understand why it was happening. Reproducing was quite simple, thanks to the example provided in the issue description. Will have another go next time I have some spare time.
          Hide
          ioannis Ioannis Moutsatsos added a comment -
          class Choice {
           String tag
           String branch
           @Override
           String toString() {
           return tag + ' / ' + branch
           }
          }
          def obj1 = new Choice(branch: '1', tag:"3")
          def obj2 = new Choice(branch: '2', tag:"4")
          println obj1.getClass()
          return [obj1 as String, obj2 as String ]
          

          This works as expected.

          It seems to me that the original array is not 'stingified' .You need to explicity cast the Choice objects to String.

          Show
          ioannis Ioannis Moutsatsos added a comment - class Choice { String tag String branch @Override String toString() { return tag + ' / ' + branch } } def obj1 = new Choice(branch: '1' , tag: "3" ) def obj2 = new Choice(branch: '2' , tag: "4" ) println obj1.getClass() return [obj1 as String , obj2 as String ] This works as expected. It seems to me that the original array is not 'stingified' .You need to explicity cast the Choice objects to String.
          Hide
          ioannis Ioannis Moutsatsos added a comment -

          Cast Objects to String. The returned Groovy array should always be a String array 

          Show
          ioannis Ioannis Moutsatsos added a comment - Cast Objects to String. The returned Groovy array should always be a String array 

            People

            • Assignee:
              ioannis Ioannis Moutsatsos
              Reporter:
              sanya_rnd Alexander Biryukov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: