Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-3678

Mutableissue for some reason Groovy is not able to retrieve the class definition

    Details

    • Type: Bug
    • Status: Triage (View Workflow)
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 5.5.7
    • Fix Version/s: None
    • Component/s: Scripted Fields
    • Labels:
      None
    • Critical Points:
      0.5

      Description

      Steps to reproduce it:

      1. Create a new Scripted Field
      2. Add the code below:
        if (issue.getIssueType().name == "Requirement" || issue.getIssueType().name == "Epic"){
        (issue as MutableIssue).setOriginalEstimate(originalEstimateSum)
        (issue as MutableIssue).setTimeSpent(timeSpentSum)
        if (originalEstimateSum-timeSpentSum < 0)
        
        { (issue as MutableIssue).setEstimate(0 as Long) }
        else
        
        { (issue as MutableIssue).setEstimate(originalEstimateSum-timeSpentSum) }
        issue.store()
        }
        
      3. Error is shown in the log:
        2019-07-23 16:54:40,949 ERROR [customfield.GroovyCustomField]: *************************************************************************************
        Script field failed on issue: AA-1, field: Aggregation of Est
        java.lang.NullPointerException: Cannot invoke method setOriginalEstimate() on null object
        at Script1155.run(Script1155.groovy:113)
        

      I suspect the specific source of the error is the coercion as MutableIssue: for some reason Groovy is not able to retrieve all the requisite class definitions needed to perform this operation. This is almost certainly an error on the part of the Groovy runtime - or on our part as the developers of ScriptRunner - rather than an end-user error: ordinarily I would have expected something like this to work fine.

        Attachments

          Structure

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              jloong John Chin Loong
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:

                  Structure Helper Panel