stapler/stapler — pull request #31 by HedAurabesh (2014-01-27 18:47:51+00:00)
Title: Fixed a nasty NullPointerException on Groovy Tag File loading.

The object stored in the MetaClassLoader field can consist of multiple chained ClassLoaders. An example would be the classloader of a Jenkins Plug-In, that is a child of the Jenkins-Core classloader.

In such a situation, it can happen, that the outermost classloader does not contain the TearOff of a particular groovy
script, but that a parent contains it.

The current implementation will fail with a NullPointerException, since it tries to retrieve the GroovyClassLoaderTearOff" and calls a method on it, without checking if it is null.

This prevents ALL Jenkins plugins from defining Groovy instead of Jelly TagLibs. See also:
http://jenkins-ci.361315.n4.nabble.com/Groovy-Taglibs-td4662779.html

This commit fixes the issue by
1) Avoiding throwing an NPE when the "gcl" field is null.
2) Actually querying the MetaClassLoader's parents for gcl values.