Hi
We use scriptrunner listener service to clone an issue (bulidt in script) when a comment is added on a closed issue. This works fine if we Comment the issue inside Jira, but when a mail is processed by jira (JEHM) and a comment i added to a closed issue from mail. Scriptrunner buidlt in script fails with Nullpointer exception from com.onresolve.jira.groovy.canned.workflow.postfunctions.AbstractCloneIssue.getUser().
Hope someone can helt / fix the bug.
Full stacktrace:
from the invoker 'SingleParameterMethodListenerInvoker{method=public void com.onresolve.jira.groovy.listener.ScriptRunnerUber
Listener.workflowEvent(com.atlassian.jira.event.issue.IssueEvent), listener=com.onresolve.jira.groovy.listener.ScriptRunnerUberListener@3d1d623a}'.
java.lang.RuntimeException: Cannot invoke method getName() on null object
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:66)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1.execute(AsynchronousAbleEventDispatcher.java:32)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:60)
at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)
at com.atlassian.event.internal.EventPublisherImpl.publish(EventPublisherImpl.java:79)
at com.atlassian.multitenant.event.DefaultPeeringEventPublisherManager.publish(DefaultPeeringEventPublisherManager.java:17)
at com.atlassian.multitenant.event.PeeringEventPublisher.publish(PeeringEventPublisher.java:23)
at com.atlassian.jira.event.issue.DefaultIssueEventManager.publishEvent(DefaultIssueEventManager.java:124)
at com.atlassian.jira.event.issue.DefaultIssueEventManager.dispatchEvent(DefaultIssueEventManager.java:102)
at com.atlassian.jira.issue.util.DefaultIssueUpdater.doUpdate(DefaultIssueUpdater.java:88)
at com.javahollic.jira.emh.service.ProcessorRunner.sendUpdates(ProcessorRunner.java:1101)
at com.javahollic.jira.emh.service.ProcessorRunner.runProcessor(ProcessorRunner.java:902)
at com.javahollic.jira.emh.service.ProcessorRunner.execute(ProcessorRunner.java:202)
at com.javahollic.jira.emh.service.EnterpriseMessageHandlerImpl.handleMessage(EnterpriseMessageHandlerImpl.java:237)
at com.javahollic.jira.emh.service.EnterpriseMessageHandlerProxy.handleMessage(EnterpriseMessageHandlerProxy.java:45)
at com.atlassian.jira.service.services.mail.MailFetcherService$1.process(MailFetcherService.java:368)
at com.atlassian.jira.service.services.mail.MailFetcherService$MessageProviderImpl.getAndProcessMail(MailFetcherService.java:271)
at com.atlassian.jira.service.services.mail.MailFetcherService.runImpl(MailFetcherService.java:356)
at com.atlassian.jira.service.services.file.AbstractMessageHandlingService.run(AbstractMessageHandlingService.java:252)
at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61)
at com.atlassian.jira.service.ServiceRunner.execute(ServiceRunner.java:47)
at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
at com.atlassian.multitenant.quartz.MultiTenantThreadPool$MultiTenantRunnable.run(MultiTenantThreadPool.java:72)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: java.lang.NullPointerException: Cannot invoke method getName() on null object
at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:77)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.AbstractCloneIssue.getUser(AbstractCloneIssue.groovy:87) <+3>
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:267)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.AbstractCloneIssue.doScript(AbstractCloneIssue.groovy:44)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.CopyIssueWithAttachments.super$2$doScript(CopyIssueWithAttachments.groovy) <+3>
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.CopyIssueWithAttachments.doScript(CopyIssueWithAttachments.groovy:19)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.CloneIssue.super$3$doScript(CloneIssue.groovy) <+3>
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1054)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)
at com.onresolve.jira.groovy.canned.workflow.postfunctions.CloneIssue.doScript(CloneIssue.groovy:81)
at com.onresolve.jira.groovy.canned.CannedScript$doScript.call(Unknown Source)
at com.onresolve.jira.groovy.CannedScriptRunner.runCannedScript(CannedScriptRunner.groovy:60)
at com.onresolve.jira.groovy.GroovyRunner.run(GroovyRunner.java:52) <+2>
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite.invoke(PojoMetaMethodSite.java:189)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at com.onresolve.jira.groovy.listener.ScriptRunnerUberListener$_workflowEvent_closure1.doCall(ScriptRunnerUberListener.groovy:48) <+2>
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:884)
at groovy.lang.Closure.call(Closure.java:412)
at groovy.lang.Closure.call(Closure.java:425)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1377)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1349)
at org.codehaus.groovy.runtime.dgm$149.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at com.onresolve.jira.groovy.listener.ScriptRunnerUberListener.workflowEvent(ScriptRunnerUberListener.groovy:35) <+2>
at java.lang.reflect.Method.invoke(Unknown Source)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
... 24 more
I feel like the calling code should be setting a user...
When JEMH does a transition or something does it do it as a particular user?
Hi
No it does not look like that - a user in adding the commet, but this is not a registred Jira user (not a user in the jira-user group), so mayby this is why scriptrunner fails. The error comes from QuartzWorker-0 ERROR anonymous. I think this has worked with a previous version of scriptrunner so I hope you can provide a fix for this. Scriptrunner listen for Issue updated events on issues where status=Closed (not a workflow transition)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Done som more testing and the same happen for "Creste subtask", I am sure this has worked for "email issues" before. Hope you can provide a fix
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I could fix it so that it doesn't fall over, but if there is no user I don't see how the cloned issue can be created. Maybe I can get it from the event... can you create a bug pointing to this q at https://jamieechlin.atlassian.net/browse/GRV.
Who shows as the comment author ?
Maybe you want to put a condition on this so that it doesn't run if there is no user.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Done som more testing and the same happen for "Creste subtask", I am sure this has worked for "email issues" before. Hope you can provide a fix
I don't believe anything has changed in this area recently. Have you upgraded the plugin or JEMH?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I will do. Reporter of the issue is the person who sent the mail. (JEHM creates the user if it does not exist). I think the error occurs where your plugin tries to get the logged in user - since there is no logged in user the nullpointer accurs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just made a change but haven't tested that exact circumstance, but should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
nice! I can test it at our Jira server if you tell me where to find the executabels files (and the rollback / old file)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is in 2.1, available now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.