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

[STAPLER] NullPointerException thrown when trying to use/define a Groovy Taglib

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • N/A

      Due to a bug in Stapler-Groovy, it is impossible for plugins to define/use custom Taglibs that are written in Groovy. Jelly taglibs work fine, but groovy taglibs always throw an NPE as can be seen here:

      http://jenkins-ci.361315.n4.nabble.com/Groovy-Taglibs-td4662779.html

      The reason is a bug in Stapler, that causes the Groovy File resolution to fail with an NPE. Additionally, it also does not search the entire ClassLoader tree, and thus is incapable of finding the Groovy files (which causes the above NPE in the first place).

      Replication of this issue is simple, by trying to create an empty Groovy taglib inside of a Plugin and then trying to use its tag from either a Groovy or Jelly UI file.

      DO NOTE: This issue does not appear for Jenkins-Core, because the core uses a different ClassLoader than the plugins. As such, Stapler will find the Groovy files in the outermost ClassLoader and thus not throw the NPE.

      The bug will be fixed as soon as the following patch is merged into the stapler source code and the Jenkins dependency to stapler updated:
      https://github.com/stapler/stapler/pull/31

            Unassigned Unassigned
            mhschroe Martin Schröder
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: