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

json for custom fields doesn't handle durations properly

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 4.3.19
    • Fix Version/s: 5.2.1
    • Component/s: Scripted Fields
    • Labels:
      None
    • Sprint:
      Sprint 35 - Ends Oct 10
    • Critical Points:
      0.6

      Description

      AFAICT. Given a duration of zero, this causes

      org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '0' with class 'java.lang.Long' to class 'java.util.Date'
      	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405)
      	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319)
      	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:232)
      ...
      	at com.onresolve.scriptrunner.customfield.GroovyCustomField.getJsonFromIssue(GroovyCustomField.groovy:549)
      

      I don;t think a duration should be converted to a date as we are doing it.

      This example causes the problem: https://scriptrunner.adaptavist.com/latest/jira/recipes/scriptfields/workRemainingInLinkedIssues.html

        Attachments

          Activity

            People

            Assignee:
            tbatagiannis Thanos Batagiannis
            Reporter:
            jechlin Jamie Echlin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: