NullPointerException error on Groovy Script

Sandhya Muthukumar April 1, 2024

I am a Jira Admin and I am trying to add users to project roles using Groovy Script

But it is throwing an error Null Pointer Exception on addActorsToProjectRole, eventhough all the inputs have values except for error collection

 

projectRoleService.addActorsToProjectRole(currentUser,usersToAdd as Collection,projectRoles,projectKey,userRoleActor,errorCollection)
ERROR:
Script console script failed: java.lang.NullPointerException at com.atlassian.jira.bc.projectroles.DefaultProjectRoleService.createRoleActors(DefaultProjectRoleService.java:891) at com.atlassian.jira.bc.projectroles.DefaultProjectRoleService.updateActorsToProjectRole(DefaultProjectRoleService.java:715) at com.atlassian.jira.bc.projectroles.DefaultProjectRoleService.addActorsToProjectRole(DefaultProjectRoleService.java:1073) at Script96.run(Script96.groovy:56)

1 answer

1 accepted

0 votes
Answer accepted
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.
April 19, 2024

Did you initialize the error collection?

Like this:

def errorCollection = ErrorCollections.empty()

If you've already done that, try adding some debug output and share the output?

log.info "currentUser=$currentUser (${currentUser.getClass()})"
log.info "usersToAdd=$usersToAdd (${usersToAdd.getClass()})"
log.info "projectRoles=$projectRoles (${projectRoles.getClass()})"
log.info "projectKey=$projectKey (${projectKey.getClass()})"
log.info "userRoleActor=$userRoleActor (${userRoleActor.getClass()})"
Sandhya Muthukumar July 10, 2024

Thank you. Let me try if this works!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events