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

Lack of finally block in TreeUnmarshaller can cause DescribableList to throw ClassCastException or NoSuchMethodException

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      TreeUnmarshaller in XStream has a bug that it pushes a class onto a types stack but fails to pop it in a finally block. Then if there is an error, the context's requiredType will be bogus, which can confuse DescribableList.ConverterImpl.unmarshal as it tries to pick the right kind of list to create—it will find the type of one of the list's elements. You will end up with a ClassCastException if that type has a public no-arg constructor, or a NoSuchMethodException if it does not. The XStream bug is aggravated by the order in which the Jenkins code calls things.

      Not to be confused with JENKINS-27736, which is quite different.

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            core/src/main/java/hudson/util/DescribableList.java
            core/src/test/java/hudson/util/DescribableListTest.java
            http://jenkins-ci.org/commit/jenkins/976fe5aaa05858b88c5141b8d133efea696233b8
            Log:
            JENKINS-49054 Work around XStream bug by looking up list type before trying to unmarshal elements.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/util/DescribableList.java core/src/test/java/hudson/util/DescribableListTest.java http://jenkins-ci.org/commit/jenkins/976fe5aaa05858b88c5141b8d133efea696233b8 Log: JENKINS-49054 Work around XStream bug by looking up list type before trying to unmarshal elements.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Oleg Nenashev
            Path:
            core/src/main/java/hudson/util/DescribableList.java
            core/src/test/java/hudson/util/DescribableListTest.java
            http://jenkins-ci.org/commit/jenkins/53ac66eec090cb8884f2b59719e78b24c7402777
            Log:
            Merge pull request #3248 from jglick/JENKINS-49054

            JENKINS-49054 Work around XStream bug by looking up list type before trying to unmarshal elements

            Compare: https://github.com/jenkinsci/jenkins/compare/832f17fe5290...53ac66eec090

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/util/DescribableList.java core/src/test/java/hudson/util/DescribableListTest.java http://jenkins-ci.org/commit/jenkins/53ac66eec090cb8884f2b59719e78b24c7402777 Log: Merge pull request #3248 from jglick/ JENKINS-49054 JENKINS-49054 Work around XStream bug by looking up list type before trying to unmarshal elements Compare: https://github.com/jenkinsci/jenkins/compare/832f17fe5290...53ac66eec090
            Hide
            oleg_nenashev Oleg Nenashev added a comment -

            It has been fixed and released in 2.103

            Show
            oleg_nenashev Oleg Nenashev added a comment - It has been fixed and released in 2.103
            Hide
            jglick Jesse Glick added a comment -

            See JENKINS-49169 for follow-up tasks.

            Show
            jglick Jesse Glick added a comment - See  JENKINS-49169 for follow-up tasks.
            Hide
            danielbeck Daniel Beck added a comment -

            This is in 2.103, so any reasonable upcoming LTS baseline will include this.

            Show
            danielbeck Daniel Beck added a comment - This is in 2.103, so any reasonable upcoming LTS baseline will include this.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: