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

0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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()})"

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events