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

@Exported returns double XML value for getter

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Take a look at this JiraIssueParameterValue

      This results in correct JSON representation, but in incorrent XML/python representation:

      <parameter>
      <name>TEST</name>
      <value>PROJ-1</value>
      <value>PROJ-1</value>
      </parameter>
      

      The build.xml XML is correct though, so it seems to be the exporter's fault.

        Attachments

          Issue Links

            Activity

            Hide
            danielbeck Daniel Beck added a comment -

            This is caused by the JiraIssueParameterValue's getValue() method having the same signature as its superclass method, but a different return type.

            This means class.getMethods() returns two different entries, one for String and one for Object. The Exported annotation apparently applies to both these methods (probably because it only considers signatures?), so both get serialized independently.

            This is looks like a bug in Stapler, which assumes getMethods() has no "duplicates", caused by a very unusual case in the Jira Plugin.

            Possible workarounds for Jira plugin, that would fix this issue for past releases of Jenkins core/Stapler:

            • Export a new method public String value() instead, so the Exported annotation does not apply to the supertype method
            • Change the return type of getValue() to Object, so there won't be two entries in JiraIssueParameterValue.class.getMethods() for getValue. Minor changes to other methods in the same class need to be done (add a few toString() calls).

            Since Stapler issues are tracked elsewhere, reassigning this to the Jira Plugin which could apply one of the workarounds mentioned above.

            Show
            danielbeck Daniel Beck added a comment - This is caused by the JiraIssueParameterValue 's getValue() method having the same signature as its superclass method, but a different return type. This means class.getMethods() returns two different entries, one for String and one for Object . The Exported annotation apparently applies to both these methods (probably because it only considers signatures?), so both get serialized independently. This is looks like a bug in Stapler, which assumes getMethods() has no "duplicates", caused by a very unusual case in the Jira Plugin. Possible workarounds for Jira plugin, that would fix this issue for past releases of Jenkins core/Stapler: Export a new method public String value() instead, so the Exported annotation does not apply to the supertype method Change the return type of getValue() to Object , so there won't be two entries in JiraIssueParameterValue.class.getMethods() for getValue . Minor changes to other methods in the same class need to be done (add a few toString() calls). Since Stapler issues are tracked elsewhere, reassigning this to the Jira Plugin which could apply one of the workarounds mentioned above.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Radek Antoniuk
            Path:
            src/main/java/hudson/plugins/jira/Updater.java
            src/main/java/hudson/plugins/jira/listissuesparameter/JiraIssueParameterValue.java
            http://jenkins-ci.org/commit/jira-plugin/7f6e3aab02f35008764191bf49edd21a1e7365d4
            Log:
            JENKINS-31268 - Workaround for Stapler bug during serialization

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Radek Antoniuk Path: src/main/java/hudson/plugins/jira/Updater.java src/main/java/hudson/plugins/jira/listissuesparameter/JiraIssueParameterValue.java http://jenkins-ci.org/commit/jira-plugin/7f6e3aab02f35008764191bf49edd21a1e7365d4 Log: JENKINS-31268 - Workaround for Stapler bug during serialization

              People

              Assignee:
              warden Radek Antoniuk
              Reporter:
              warden Radek Antoniuk
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: