Details
Description
Some event types can not be found when the event handler is registered resulting in the following stacktrace:
java.lang.ClassNotFoundException: com.atlassian.bitbucket.event.watch.WatcherAddedEvent not found by com.onresolve.stash.groovy.groovyrunner [125] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at com.onresolve.scriptrunner.bitbucket.DynamicEventListenerInvoker$_supportedEventTypes_closure1.doCall(BitbucketEventListener.groovy:268) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021) at groovy.lang.Closure.call(Closure.java:426) at groovy.lang.Closure.call(Closure.java:442)
It's because we need to use the Bitbucket class loader rather than our own to load the classes for the supported event types.