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

Prepare SLOCCount for removal of JAXB and Java 11 requirement

    XMLWordPrintable

Details

    • 1.26

    Description

      As described in Dependencies and Class Loading:

      Java defines a Thread.getContextClassLoader(). Jenkins does not use this much; it will normally be set by the servlet container to the Jenkins core loader.

      Unfortunately, JAXB has a design flaw in that JAXBContext#newInstance expects JAXB to be available in the thread's context class loader. With JAXB being detached to a separate plugin as of recent Java 11 changes, JAXB is no longer available in the Jenkins core loader. This causes a failure to load JAXB.

      This plugin has been identified as containing such a call to JAXBContext#newInstance The suggested solution is to wrap calls to JAXBContext#newInstance with a try/finally block to set the thread's context class loader to that of the plugin, which (by virtue of a plugin-to-plugin dependency on JAXB API plugin) enables JAXB to be loaded. See the following PR for an example:

      https://github.com/jenkinsci/xcode-plugin/pull/113/files

      Attachments

        Issue Links

          Activity

            basil Basil Crow created issue -
            basil Basil Crow made changes -
            Field Original Value New Value
            Link This issue is duplicated by JENKINS-55620 [ JENKINS-55620 ]
            alecharp Adrien Lecharpentier made changes -
            Assignee npiguet [ npiguet ] Adrien Lecharpentier [ alecharp ]
            alecharp Adrien Lecharpentier made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            alecharp Adrien Lecharpentier made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            alecharp Adrien Lecharpentier made changes -
            Remote Link This issue links to "sloccount-plugin#62 (Web Link)" [ 27759 ]
            basil Basil Crow made changes -
            Released As 1.26
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Closed [ 6 ]
            varshithas Varshitha s made changes -
            Attachment image-2022-08-22-13-46-29-576.png [ 58801 ]

            People

              alecharp Adrien Lecharpentier
              basil Basil Crow
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: