Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

NullPointerException while saving an issue with updated Custom picker field if no records selected

Lukáš Koleno February 23, 2023

Hello,

I have implemented a Custom picker script field. The field works correctly until I try to remove all records from field (does not matter how many records were previously selected) and submit.

Then a popup shows: Saving of "issue" failed! ...

Screenshot_20230222_234316.png 

Configuration script of the field:

import com.onresolve.scriptrunner.canned.jira.fields.model.PickerOption

search = { String inputValue ->
[
"value1",
"value2",
"value3"

]
}

toOption = { String val, Closure<String> highlight ->
new PickerOption(
value: val,
label: val
)
}

getItemFromId = { String id ->
return id
}

maxRecordsForSearch = 30
multiValueDelimiter = ', '

 

Full exception from log:

2023-02-22 23:14:54,946+0100 http-nio-8080-exec-17 ERROR kolenol 1394x16644x1 ucl7c2 10.10.16.5,127.0.0.1 /secure/AjaxIssueAction.jspa [c.a.j.bc.issue.DefaultIssueService] Exception occurred editing issue: java.lang.NullPointerException
: Cannot invoke method collectEntries() on null object
java.lang.NullPointerException: Cannot invoke method collectEntries() on null object
       at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
       at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:44)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
       at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:34)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
       at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:58)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.custom.CustomPickerImpl.getViewHtml(CustomPickerImpl.groovy:99)
       at jdk.internal.reflect.GeneratedMethodAccessor5146.invoke(Unknown Source)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.base/java.lang.reflect.Method.invoke(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:43)
       at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:193)
       at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:61)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
       at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:66)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.picker.AbstractGenericPicker.getTextOnlyValue(AbstractGenericPicker.groovy:131)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.picker.GenericPicker$getTextOnlyValue$0.call(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.picker.GenericPicker$getTextOnlyValue$0.call(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.AbstractConfigurablePickerHelper.getTextOnlyValue(AbstractConfigurablePickerHelper.groovy:68)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.AbstractConfigurablePickerHelper$getTextOnlyValue$1.call(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.AbstractConfigurablePickerHelper$getTextOnlyValue$1.call(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker.getTextOnlyHtml(MultiValuePicker.groovy:119)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker$getTextOnlyHtml.callCurrent(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker$getTextOnlyHtml.callCurrent(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker.getChangelogString(MultiValuePicker.groovy:181)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker.getChangelogString(MultiValuePicker.groovy)
       at com.atlassian.jira.issue.fields.ImmutableCustomField.getChangelogString(ImmutableCustomField.java:395)
       at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(ImmutableCustomField.java:433)
       at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(ImmutableCustomField.java:400)
       at com.atlassian.jira.issue.fields.OrderableField$updateValue$7.call(Unknown Source)
       at com.onresolve.scriptrunner.runner.field.IssueParametersCapturingImmutableCustomField.updateValue(IssueParametersCapturingImmutableCustomField.groovy:34)
       at com.atlassian.jira.issue.managers.DefaultIssueManager.updateFieldValues(DefaultIssueManager.java:716)
       at com.atlassian.jira.issue.managers.DefaultIssueManager.updateIssue(DefaultIssueManager.java:667)
       at com.atlassian.jira.issue.managers.RequestCachingIssueManager.updateIssue(RequestCachingIssueManager.java:222)
       at com.atlassian.jira.bc.issue.DefaultIssueService.update(DefaultIssueService.java:366)
       at com.atlassian.jira.bc.issue.DefaultIssueService.update(DefaultIssueService.java:339)
       at jdk.internal.reflect.GeneratedMethodAccessor1769.invoke(Unknown Source)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.base/java.lang.reflect.Method.invoke(Unknown Source)
       at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
       at com.sun.proxy.$Proxy348.update(Unknown Source)
       at jdk.internal.reflect.GeneratedMethodAccessor6527.invoke(Unknown Source)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.base/java.lang.reflect.Method.invoke(Unknown Source)
       at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
       at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
       at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
       at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
       at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:137)
       at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:124)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
       at com.sun.proxy.$Proxy9521.update(Unknown Source)
       at com.atlassian.jira.components.issueviewer.action.AjaxIssueAction.doExecute(AjaxIssueAction.java:227)
       ... 1 filtered
       at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63)
       ... 7 filtered
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:765)
       ... 48 filtered
       at com.atlassian.servicedesk.internal.web.ExternalCustomerLockoutFilter.doFilter(ExternalCustomerLockoutFilter.java:55)
       ... 4 filtered
       at com.atlassian.greenhopper.jira.filters.ClassicBoardRouter.doFilter(ClassicBoardRouter.java:56)
       ... 3 filtered
       at com.atlassian.jira.plugin.mobile.web.filter.MobileAppRequestFilter.doFilter(MobileAppRequestFilter.java:59)
       ... 4 filtered
       at com.atlassian.jira.plugin.mobile.login.MobileLoginSuccessFilter.doFilter(MobileLoginSuccessFilter.java:54)
       ... 7 filtered
       at com.atlassian.diagnostics.internal.platform.monitor.http.HttpRequestMonitoringFilter.doFilter(HttpRequestMonitoringFilter.java:55)
       ... 8 filtered
       at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
       ... 46 filtered
       at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
       ... 17 filtered
       at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
       ... 1 filtered
       at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
       ... 16 filtered
       at com.atlassian.pats.web.filter.TokenBasedAuthenticationFilter.doFilter(TokenBasedAuthenticationFilter.java:82)
       ... 26 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:215)
       at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:136)
       at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.runOutOfContext(ReentrantThreadLocalBasedCodeContext.java:89)
       at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runOutOfCustomerContext(CustomerContextServiceImpl.java:47)
       at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.outOfCustomerContext(CustomerContextSettingFilter.java:206)
       at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:134)
       at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:123)
       ... 4 filtered
       at com.atlassian.plugins.authentication.impl.basicauth.filter.DisableBasicAuthFilter.doFilter(DisableBasicAuthFilter.java:70)
       ... 3 filtered
       at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37)
       ... 8 filtered
       at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
       ... 4 filtered
       at com.atlassian.troubleshooting.thready.filter.AbstractThreadNamingFilter.doFilter(AbstractThreadNamingFilter.java:46)
       ... 3 filtered
       at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
       ... 29 filtered
       at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
       ... 25 filtered
       at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
       at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
       at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
       at java.base/java.lang.Thread.run(Unknown Source)

 

What I have tried:

- disabling all listeners (this should not have any impact anyway as it seems that no listeners are triggered, probably because the update event is not dispatched)

- googling for many hours

- updating the field value via a groovy script - this is interesting. If the field value is set to [] (empty list), issue is updated correctly. If set to null, a similar exception is thrown.

 

Exception when setting the field value to null via groovy script:

2023-02-23 00:09:27,327+0100 http-nio-8080-exec-19 ERROR kolenol 9x17201x1 ucl7c2 10.10.16.5,127.0.0.1 /secure/QuickEditIssue.jspa [c.o.scriptrunner.runner.AbstractScriptListener] Script function failed on event: com.atlassian.jira.even
t.issue.IssueEvent, file: null
java.lang.NullPointerException: Cannot invoke method collectEntries() on null object
       at com.onresolve.scriptrunner.canned.jira.fields.editable.custom.CustomPickerImpl.getViewHtml(CustomPickerImpl.groovy:99)
       at jdk.internal.reflect.GeneratedMethodAccessor5146.invoke(Unknown Source)
       at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.picker.AbstractGenericPicker.getTextOnlyValue(AbstractGenericPicker.groovy:131)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.picker.GenericPicker$getTextOnlyValue$0.call(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.picker.GenericPicker$getTextOnlyValue$0.call(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.AbstractConfigurablePickerHelper.getTextOnlyValue(AbstractConfigurablePickerHelper.groovy:68)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.AbstractConfigurablePickerHelper$getTextOnlyValue$1.call(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.AbstractConfigurablePickerHelper$getTextOnlyValue$1.call(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker.getTextOnlyHtml(MultiValuePicker.groovy:119)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker$getTextOnlyHtml.callCurrent(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker$getTextOnlyHtml.callCurrent(Unknown Source)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker.getChangelogString(MultiValuePicker.groovy:181)
       at com.onresolve.scriptrunner.canned.jira.fields.editable.database.MultiValuePicker.getChangelogString(MultiValuePicker.groovy)
       at com.atlassian.jira.issue.fields.ImmutableCustomField.getChangelogString(ImmutableCustomField.java:395)
       at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(ImmutableCustomField.java:433)
       at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(ImmutableCustomField.java:400)
       at com.atlassian.jira.issue.fields.OrderableField$updateValue$7.call(Unknown Source)
       at com.onresolve.scriptrunner.runner.field.IssueParametersCapturingImmutableCustomField.updateValue(IssueParametersCapturingImmutableCustomField.groovy:34)
       at com.atlassian.jira.issue.managers.DefaultIssueManager.updateFieldValues(DefaultIssueManager.java:716)
       at com.atlassian.jira.issue.managers.DefaultIssueManager.updateIssue(DefaultIssueManager.java:667)
       at com.atlassian.jira.issue.managers.DefaultIssueManager.updateIssue(DefaultIssueManager.java:653)
       at com.atlassian.jira.issue.managers.RequestCachingIssueManager.updateIssue(RequestCachingIssueManager.java:217)
       at com.atlassian.jira.issue.IssueManager$updateIssue$5.call(Unknown Source)
       at Script27.run(Script27.groovy:25)

 

Versions

Jira software: 8.20.18

Adaptavist ScriptRunner for JIRA: 7.11.0

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Lukáš Koleno February 24, 2023
0 votes
Peter-Dave Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2023

I think you should report this as a bug on https://productsupport.adaptavist.com/servicedesk

Lukáš Koleno February 23, 2023

Reported, thank you

TAGS
AUG Leaders

Atlassian Community Events