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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Done
    • High
    • Resolution: Fixed
    • 4.3.19
    • 5.2.1
    • Script Fields
    • None
    • Sprint 35 - Ends Oct 10
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: