Why am I getting NPE in com.adweb.estimations.Utilities.validateTimeTrackingByRole

Stan Huang September 24, 2016

Hi,

I'm getting the following NPE when calling IssueService.validateUpdate from a ScriptRunner custom post function in a project configured with ADWEB JIRA Ultimate Role Tracking & Estimation: 

 

java.lang.NullPointerException
	at com.adweb.estimations.Utilities.validateTimeTrackingByRole(Utilities.java:1773)
	at com.adweb.estimations.customFields.timeTrackingByRole.TimeTrackingByRoleCFType.validateFromParams(TimeTrackingByRoleCFType.java:421)
	at com.atlassian.jira.issue.fields.CustomFieldImpl.validateParams(CustomFieldImpl.java:741)
	at com.atlassian.jira.bc.issue.DefaultIssueService.validateAndPopulateParamsWithScreenCheck(DefaultIssueService.java:897)
	at com.atlassian.jira.bc.issue.DefaultIssueService.validateAndPopulateParams(DefaultIssueService.java:858)
	at com.atlassian.jira.bc.issue.DefaultIssueService.validateAndUpdateIssueFromFields(DefaultIssueService.java:660)
	at com.atlassian.jira.bc.issue.DefaultIssueService.validateUpdate(DefaultIssueService.java:278)

 

My IssueInputParameters only contains a simple new Summary. It has RetainExistingValuesWhenParameterNotProvided set to true.

I'm running:

  • Atlassian JIRA Project Management Software v7.1.1 
  • Adaptavist ScriptRunner for JIRA v4.3
  • ADWEB JIRA Role Based Estimations and Tracking v1.7

It works fine on projects that do not have ADWEB configured.

thanks.

stan.

1 answer

1 vote
Abhinav Ojha September 26, 2016

Hi Stan,

From the information provided by you, it seems that you are using an older version of the JIRA Ultimate Role Tracking & Estimation add-on. Just to make sure, we have tested our add-on with all the configuration provided by you, with the latest version of the add-on. I think, the latest version should not have this NPE.

Please take the latest update from here : https://marketplace.atlassian.com/plugins/com.adweb.estimations.estimationUpdate/versions 

for your JIRA version, latest will be v1.8.3.

Please keep checking for the updates, as we are adding cool new features on a regular basis.

Let us know, if you have any other issues or queries.

Thanks,

Abhinav.

Stan Huang October 2, 2016

Hi Abhinav,

I'm still getting the error with v1.8.3, unfortunately.

  • I created a new, simple project (BUG) using the "Basic software development" template.
  • ADWEB is NOT configured for this project.
  • I created one issue in that project, using all default values except for the Summary, which I set to "Summary"
  • I added a workflow transition that loops from TO DO -> TO DO and associated that transition with a post function script:
package com.onresolve.jira.groovy.test.scriptfields.scripts

import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.transform.CompileStatic
import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.bc.issue.IssueService.IssueResult
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.user.ApplicationUser

@CompileStatic
private static void testBug(Issue issue, Logger log)
{
    log.debug 'Entered testBug'
    String issueKey = 'BUG-1'
    IssueService issueSvc = ComponentAccessor.getIssueService()
    IssueInputParameters issueInParams = issueSvc.newIssueInputParameters()
    ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
    log.debug 'Initialization complete'

    IssueService.IssueResult issueRslt = issueSvc.getIssue(user, issueKey)
    Issue theIssue = issueRslt.getIssue()
    log.debug issueKey + ' retrieved'
    issueInParams.setRetainExistingValuesWhenParameterNotProvided(true)
    issueInParams.setSkipScreenCheck(true)

    log.debug 'IssueInputParameters configured'
    IssueService.UpdateValidationResult updateValidRslt = issueSvc.validateUpdate(user, theIssue.getId(), issueInParams)

    log.debug 'validUpdate completed'
    if (!updateValidRslt.isValid())
        return

    log.debug 'IIP validated'
    return
}

log.setLevel(Level.DEBUG)


testBug(this.issue, this.log)
return

 

When executing this code, I get this error in the log:

2016-10-02 23:46:42,483 DEBUG [workflow.ScriptWorkflowFunction]: Entered testBug
2016-10-02 23:46:42,484 DEBUG [workflow.ScriptWorkflowFunction]: Initialization complete
2016-10-02 23:46:42,484 DEBUG [workflow.ScriptWorkflowFunction]: BUG-1 retrieved
2016-10-02 23:46:42,485 DEBUG [workflow.ScriptWorkflowFunction]: IssueInputParameters configured
2016-10-02 23:46:42,525 DEBUG [osgi.ActiveObjectsServiceFactory]: getService bundle [com.adweb.estimations.estimationUpdate]
2016-10-02 23:46:42,550 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2016-10-02 23:46:42,553 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: BUG-1, actionId: 71, file: <inline script>
java.lang.NullPointerException
	at com.adweb.estimations.customFields.logWorkByRole.LogWorkByRoleCFType.validateFromParams(LogWorkByRoleCFType.java:206)
	at com.atlassian.jira.issue.fields.CustomFieldImpl.validateParams(CustomFieldImpl.java:741)
	at com.atlassian.jira.bc.issue.DefaultIssueService.validateAndPopulateParamsWithoutScreenCheck(DefaultIssueService.java:947)
	at com.atlassian.jira.bc.issue.DefaultIssueService.validateAndPopulateParams(DefaultIssueService.java:860)
	at com.atlassian.jira.bc.issue.DefaultIssueService.validateAndUpdateIssueFromFields(DefaultIssueService.java:660)
	at com.atlassian.jira.bc.issue.DefaultIssueService.validateUpdate(DefaultIssueService.java:278)
	at com.onresolve.jira.groovy.test.scriptfields.scripts.Script584.testBug(Script584.groovy:32)
	at com.onresolve.jira.groovy.test.scriptfields.scripts.Script584.run(Script584.groovy:44)

Additional observations:

  • If I disable the ADWEB add on (across the entire JIRA instance), the error does not occur, even though ADWEB is not even setup for this project.
  • If I re-enable ADWEB, the error occurs.
  • If I do not call setSkipScreenCheck(true) in the script above, this error does not happen.

Let me know if I can provide any more information.

 

thanks.

stan.

Stan Huang October 5, 2016

Hi Abhinav, I just wanted to confirm that you saw my last reply with a reproducible test case for you.

 

thanks.

stan.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events