Exception on between "Issue Commented" Event and its listener and how can I learn read it?

Hi,

I use ScriptRunner and fire the "Issue Commented" event on transitions. I also have a Script  Listener that listens to the "Issue Commented" event that copies comments to linked issues and transitions them if needed.

The Log shows the following output. I guess it is after the "Issue Commented" event is fired on the transition that is done by the script.

I do not understand where the Exception happens because the log output is all Greek to me. Is there any Tutorial on how to read this exceptions? Can anybody tell me where the problem is?

[c.a.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.jira.event.issue.IssueEvent@35bbf[issue=EXP-697,comment=<null>,worklog=<null>,changelog=[GenericEntity:ChangeGroup][issue,12846][author,helpdesk][created,2017-03-03 15:58:05.718][id,26851],eventTypeId=6,sendMail=true,params={args={FIELD_FUNCTION_ID=dfe40b9b9ea7ea8e2eb47c18186b50a3f54bb5fa, full.module.key=com.onresolve.jira.groovy.groovyrunnerrungroovy-function, canned-script=com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FireEventWhen, FIELD_CONDITION=, class.name=com.onresolve.jira.groovy.GroovyFunctionPlugin, FIELD_EVENT_ID=6}, FIELD_FUNCTION_ID=dfe40b9b9ea7ea8e2eb47c18186b50a3f54bb5fa, baseurl=https://jira.nextbike.net, issue=EXP-697, log=org.apache.log4j.Logger@61e0df77, full.module.key=com.onresolve.jira.groovy.groovyrunnerrungroovy-function, passesCondition=true, canned-script=com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FireEventWhen, transientVars={changeGroup=[GenericEntity:ChangeGroup][issue,12846][author,helpdesk][created,2017-03-03 15:58:05.718][id,26851], issue=EXP-697, configuration=com.opensymphony.workflow.config.DefaultConfiguration@2dd0318b, proj=Project: EXP, project=[GenericEntity:Project][name,Fastlane][assigneetype,3][description,][projecttype,software][id,10006][counter,694][avatar,10324][originalkey,EXP][url,null][lead,arndt][key,EXP], currentSteps=[SimpleStep@1[owner=, actionId=111, status=null]], store=com.opensymphony.workflow.spi.ofbiz.OfbizWorkflowStore@54ecc17e, descriptor=com.atlassian.jira.workflow.ImmutableWorkflowDescriptor@16df3805, userKey=helpdesk, originalAssigneeId=null, entry=com.opensymphony.workflow.spi.SimpleWorkflowEntry@7186567b, oldStatus=IssueConstantImpl[[GenericEntity:Status][sequence,1][statuscategory,2][name,Open][iconurl,/images/icons/statuses/open.png][description,The issue is open and ready for the assignee to start work on it.][id,1]], context=com.opensymphony.workflow.basic.BasicWorkflowContext@24860d3, createdStep=SimpleStep@6[owner=, actionId=0, status=null], originalissueobject=EXP-697, actionId=111, pkey=EXP, changeItems=[com.atlassian.jira.issue.history.ChangeItemBean@410cfd94[fieldType=jira,field=status,from=1,fromString=Open,to=10002,toString=Feedback,created=<null>]], transaction=com.atlassian.jira.transaction.TransactionSupportImpl$JoinedTransaction@43f5e834}, FIELD_CONDITION=, class.name=com.onresolve.jira.groovy.GroovyFunctionPlugin, FIELD_EVENT_ID=6},subtasksUpdated=false]] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.mywork.providers.jira.JiraEventListener.onIssueEvent(com.atlassian.jira.event.issue.IssueEvent) throws java.lang.Exception, listener=com.atlassian.mywork.providers.jira.JiraEventListener@552f850e}]
java.lang.RuntimeException: java.lang.NullPointerException
    at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:50)
    at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
    at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107)
    at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)
    at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79)
    at com.atlassian.jira.event.issue.IssueEventDispatcher.dispatchEvent(IssueEventDispatcher.java:161)
    at com.atlassian.jira.event.issue.IssueEventDispatcher.dispatchEvent(IssueEventDispatcher.java:117)
    ... 3 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:46)
    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:91)
    at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FireEventWhen.doScript(FireEventWhen.groovy:99)
    at com.onresolve.scriptrunner.canned.CannedScript$doScript$3.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at com.onresolve.scriptrunner.canned.CannedScript$doScript.call(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.validateAndRunCannedInternal(ScriptRunnerImpl.groovy:430)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runCanned(ScriptRunnerImpl.groovy:376)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runCanned$2.call(Unknown Source)
    at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction.run(ScriptWorkflowFunction.groovy:161)
    at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction$run$0.callCurrent(Unknown Source)
    at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction.execute(ScriptWorkflowFunction.groovy:90)
    at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1014)
    at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1407)
    at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:557)
    at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:829)
    at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:786)
    at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:492)
    at com.atlassian.jira.bc.issue.IssueService$transition$1.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
    at Script11$_run_closure1.doCall(Script11.groovy:64)
    ... 3 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
    at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at Script11.run(Script11.groovy:56)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:352)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:153)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
    at javax.script.ScriptEngine$eval.call(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runScriptAndGetContext(ScriptRunnerImpl.groovy:156)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$3.callCurrent(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$3.callCurrent(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runStringAsScript(ScriptRunnerImpl.groovy:144)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runStringAsScript$4.call(Unknown Source)
    at com.onresolve.scriptrunner.canned.jira.workflow.listeners.CustomListener.doScript(CustomListener.groovy:118)
    at com.onresolve.scriptrunner.canned.CannedScript$doScript.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at com.onresolve.scriptrunner.canned.CannedScript$doScript$0.call(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.validateAndRunCannedInternal(ScriptRunnerImpl.groovy:430)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runCanned(ScriptRunnerImpl.groovy:376)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runCanned$2.call(Unknown Source)
    at com.onresolve.scriptrunner.runner.AbstractScriptListener.run(ListenerManagerImpl.groovy:213)
    at com.onresolve.scriptrunner.runner.AbstractScriptListener$run$0.callCurrent(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptListener.handleEventOrBundle(ListenerManagerImpl.groovy:281)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    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:384)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
    at com.onresolve.scriptrunner.runner.ScriptListener$_workflowEventBundle_closure1.doCall(ListenerManagerImpl.groovy:290)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
    at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
    at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
    at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    at com.onresolve.scriptrunner.runner.ScriptListener.workflowEventBundle(ListenerManagerImpl.groovy:288)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
    at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
    at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107)
    at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)
    at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79)
    at com.atlassian.jira.event.issue.DefaultIssueEventManager.publishEvent(DefaultIssueEventManager.java:120)
    at com.atlassian.jira.event.issue.DefaultIssueEventManager.dispatchEvent(DefaultIssueEventManager.java:111)
    at com.atlassian.jira.issue.comments.CommentEventPublisherImpl.publishCommentCreatedEvent(CommentEventPublisherImpl.java:51)
    at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:278)
    at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:229)
    at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:219)
    at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:203)
    at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:192)
    at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:181)
    at com.atlassian.jira.issue.comments.CommentManager$create$7.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:149)
    at Script4.run(Script4.groovy:71)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:352)
    at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:153)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
    at javax.script.ScriptEngine$eval.call(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runScriptAndGetContext(ScriptRunnerImpl.groovy:156)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$3.callCurrent(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runScriptAndGetContext$3.callCurrent(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runStringAsScript(ScriptRunnerImpl.groovy:144)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runStringAsScript$4.call(Unknown Source)
    at com.onresolve.scriptrunner.canned.jira.workflow.listeners.CustomListener.doScript(CustomListener.groovy:118)
    at com.onresolve.scriptrunner.canned.CannedScript$doScript.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at com.onresolve.scriptrunner.canned.CannedScript$doScript$3.call(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.validateAndRunCannedInternal(ScriptRunnerImpl.groovy:430)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runCanned(ScriptRunnerImpl.groovy:376)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runCanned$2.call(Unknown Source)
    at com.onresolve.scriptrunner.runner.AbstractScriptListener.run(ListenerManagerImpl.groovy:213)
    at com.onresolve.scriptrunner.runner.AbstractScriptListener$run$0.callCurrent(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptListener.handleEventOrBundle(ListenerManagerImpl.groovy:281)
    at com.onresolve.scriptrunner.runner.ScriptListener$handleEventOrBundle.callCurrent(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptListener.workflowEvent(ListenerManagerImpl.groovy:252)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
    at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48)
    at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
    at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107)
    at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)
    at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79)
    at com.atlassian.jira.event.issue.IssueEventDispatcher.dispatchEvent(IssueEventDispatcher.java:161)
    at com.atlassian.jira.event.issue.IssueEventDispatcher.dispatchEvent(IssueEventDispatcher.java:117)
    ... 3 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:46)
    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:91)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.FireEventWhen.doScript(FireEventWhen.groovy:99)
    at com.onresolve.scriptrunner.canned.CannedScript$doScript$3.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    at com.onresolve.scriptrunner.canned.CannedScript$doScript$3.call(Unknown Source)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.validateAndRunCannedInternal(ScriptRunnerImpl.groovy:430)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    at com.onresolve.scriptrunner.runner.ScriptRunnerImpl.runCanned(ScriptRunnerImpl.groovy:376)
    at com.onresolve.scriptrunner.runner.ScriptRunner$runCanned$2.call(Unknown Source)
    at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction.run(ScriptWorkflowFunction.groovy:161)
    at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction$run$0.callCurrent(Unknown Source)
    at com.onresolve.scriptrunner.jira.workflow.ScriptWorkflowFunction.execute(ScriptWorkflowFunction.groovy:90)
    at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:1014)
    at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1407)
    at com.opensymphony.workflow.AbstractWorkflow.doAction(AbstractWorkflow.java:557)
    at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowActionInsideTxn(OSWorkflowManager.java:829)
    at com.atlassian.jira.workflow.OSWorkflowManager.doWorkflowAction(OSWorkflowManager.java:786)
    at com.atlassian.jira.bc.issue.DefaultIssueService.transition(DefaultIssueService.java:492)
    at com.atlassian.jira.web.action.issue.CommentAssignIssue.doExecute(CommentAssignIssue.java:162)
    ... 1 filtered
    at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63)
    ... 7 filtered
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    ... 52 filtered
    at com.atlassian.servicedesk.internal.web.ExternalCustomerLockoutFilter.doFilter(ExternalCustomerLockoutFilter.java:56)
    ... 4 filtered
    at com.atlassian.greenhopper.jira.filters.ClassicBoardRouter.doFilter(ClassicBoardRouter.java:62)
    ... 7 filtered
    at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
    ... 47 filtered
    at com.xiplink.jira.git.action.GitThreadCacheDestroyFilter.doFilter(GitThreadCacheDestroyFilter.java:35)
    ... 14 filtered
    at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:80)
    ... 1 filtered
    at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:78)
    ... 36 filtered
    at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
    ... 5 filtered
    at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.lambda$invokeFilterChain$0(CustomerContextSettingFilter.java:181)
    at com.atlassian.servicedesk.internal.utils.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:139)
    at com.atlassian.servicedesk.internal.utils.context.ReentrantThreadLocalBasedCodeContext.runOutOfContext(ReentrantThreadLocalBasedCodeContext.java:92)
    at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runOutOfCustomerContext(CustomerContextServiceImpl.java:64)
    at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.outOfCustomerContext(CustomerContextSettingFilter.java:174)
    at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:130)
    at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:121)
    ... 4 filtered
    at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32)
    ... 8 filtered
    at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
    ... 4 filtered
    at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
    ... 29 filtered
    at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
    ... 28 filtered
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
    at com.atlassian.mywork.providers.jira.JiraEventListener.commentedOnItem(JiraEventListener.java:394)
    at com.atlassian.mywork.providers.jira.JiraEventListener.access$200(JiraEventListener.java:46)
    at com.atlassian.mywork.providers.jira.JiraEventListener$2.handle(JiraEventListener.java:79)
    at com.atlassian.mywork.providers.jira.JiraEventListener$4.run(JiraEventListener.java:182)
    at com.atlassian.mywork.providers.jira.JiraEventListener.handleEventWithTargetServiceCheck(JiraEventListener.java:225)
    ... 2 filtered
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
    ... 483 more

5 answers

This widget could not be displayed.

Hi Peter,

Thanks for the script. Below is a script that will return to you a the last comment and the comment added during the transition 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue

def issue = event.issue as Issue
def lastComment = ComponentAccessor.getCommentManager().getComments(issue).max {it.created}
def currentComment = event.params.transientVars.comment

log.debug "Last comment : ${lastComment.body}"
log.debug "Current comment : ${currentComment}"

I think this was the part that you were missing. Let me know if this does the trick.

regards, Thanos

This widget could not be displayed.

Hi Peter,

It happens to be part of the ScriptRunner team and also to be Greek cheeky

So hopefully I can help. Could you please tell me in which version of SR and JIRA you are ?

regards, Thanos

This widget could not be displayed.

JIRA 7.3.2 and Scriptrunner 4.3.16

This widget could not be displayed.

And you mention you do something with the comments ? Can you please paste the part of your script that retrieves the comment in the transition ?

This widget could not be displayed.

Hi Thanos,

here is the Script Listener that handles the "Issue Commented" event:

import com.atlassian.jira.issue.link.IssueLinkManager;
import com.atlassian.jira.issue.link.LinkCollection;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.UpdateIssueRequest;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.user.util.UserManager;
import org.apache.log4j.Category;
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.bc.issue.IssueService.TransitionValidationResult;
import com.atlassian.jira.issue.IssueInputParameters;
import com.atlassian.jira.issue.AttachmentManager;
import com.atlassian.jira.issue.comments.Comment;
import com.atlassian.jira.workflow.IssueWorkflowManager;
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction");
log.setLevel(org.apache.log4j.Level.DEBUG);
def IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager();
def IssueWorkflowManager issueWorkflowManager = ComponentAccessor.getComponentOfType(IssueWorkflowManager.class);
def IssueService issueService = ComponentAccessor.getIssueService();
def IssueInputParameters inputParameters = issueService.newIssueInputParameters();
def Issue thisIssue = event.issue;
def thisIssueId = thisIssue.getId();
def commentMgr = ComponentAccessor.getCommentManager();
def Collection<Comment> comments = commentMgr.getComments(thisIssue);
def Comment newComment = comments[-1];
def Comment previousComment;
if (comments.size() > 1){
    previousComment = comments[-2];
}
if(event){
if(event.comment){
if( event.comment.body && newComment ){    
    def ApplicationUser yourUser = event.user;
    def LinkCollection linkCollection = issueLinkManager.getLinkCollection(thisIssue, yourUser);
    def Collection<Issue> linkedIssues = linkCollection.getAllIssues();
       def ApplicationUser commentAuthor = ComponentAccessor.getUserManager().getUserByKey('helpdesk');
    def String lastComment = '';
    if( previousComment ){
        lastComment = previousComment.getBody();
    }            
    def comment = newComment.getBody();
    log.debug("newComment: " + comment + " oldComment: " + lastComment);
    if( comment && lastComment != comment ){
           def Collection<com.opensymphony.workflow.loader.ActionDescriptor> availableActions = issueWorkflowManager.getAvailableActions(thisIssue, commentAuthor);
        availableActions.each { availableAction -> 
            log.debug( "Action name: " + availableAction.getName() + " ID: " + availableAction.getId());
               if ( availableAction.getName() == "Provide feedback" 
                || availableAction.getName() == "Request Feedback"
                || availableAction.getName() == "Ask for feedback" ){
                   def actionId = availableAction.getId();            
                def IssueService.TransitionValidationResult transitionValidationResult = issueService.validateTransition(commentAuthor, thisIssueId, actionId, inputParameters);
                if (transitionValidationResult.isValid()){
                    def IssueService.IssueResult transitionResult = issueService.transition(commentAuthor, transitionValidationResult);
                }
               }
        }
    }
    for ( linkedIssue in linkedIssues) {
        if(linkedIssue.getProjectObject().getKey() == "EXP"){
            lastComment = '';
            def lastCommentObject = commentMgr.getLastComment(linkedIssue);
            if( lastCommentObject ){
                lastComment = lastCommentObject.getBody();
            }            
            comment = newComment.getBody();
            if( comment && lastComment != comment ){
                commentMgr.create( linkedIssue, commentAuthor, comment, true);
            }
            def AttachmentManager attachmentManager = ComponentAccessor.getAttachmentManager();
            attachmentManager.getAttachments(thisIssue).each {attachment ->
                if(attachment.created.getTime() >= lastCommentObject.created.getTime()){                              
                    attachmentManager.copyAttachment(attachment, commentAuthor, linkedIssue.getKey());
                }
            }
        } 
     }
}
}
}

Thank you in advance!

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

78 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you