Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-60722

Two Dimensional Filter Statistics Gadget fails when YAxis is a Custom Field restricted to certain issue types

    XMLWordPrintable

Details

    Description

      Issue Summary

      Two dimensional filter statistics gadget fails when YAxis is a Custom Field restricted to certain issue types

      Steps to Reproduce

      1. Have a custom field restricted to certain Issue Types (using the "Configure" action on the custom field).
      2. Configure a Two Dimensional Filter Statistics Gadget to display on its YAxis a custom field

      Expected Results

      The gadget shows the data represented in 2 dimensions.

      Actual Results

      The gadget displays an error and the following is found in the logs:

      2016-03-30 08:55:25,931 ERROR /rest/gadget/1.0/statistics [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue
      java.lang.ClassCastException: com.atlassian.jira.issue.issuetype.IssueTypeImpl cannot be cast to org.ofbiz.core.entity.GenericValue
      	at com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIds(GenericValueUtils.java:67)
      	at com.atlassian.jira.util.ofbiz.GenericValueUtils.transformToStringIdsList(GenericValueUtils.java:86)
      	at com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper.getSearchContextFromValue(AbstractCustomFieldStatisticsMapper.java:94)
      	at com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper.getSearchUrlSuffix(AbstractCustomFieldStatisticsMapper.java:50)
      	at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher$StatisticMapperWrappingSearchRequestAppender.appendInclusiveSingleValueClause(StatisticsSearcher.java:173)
      	at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher.completeOneDimensionalSearch(StatisticsSearcher.java:132)
      	at com.atlassian.jira.dashboarditem.statistics.service.statistics.searcher.StatisticsSearcher.completeOneDimensionalSearch(StatisticsSearcher.java:81)
      	at com.atlassian.jira.dashboarditem.statistics.service.statistics.StatisticsServiceImpl.aggregateOneDimensionalStats(StatisticsServiceImpl.java:98)
      	at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearchWithJql(StatisticsResource.java:130)
      	at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearchForFilter(StatisticsResource.java:109)
      	at com.atlassian.jira.dashboarditem.statistics.rest.StatisticsResource.oneDimensionalSearch(StatisticsResource.java:77)
      	... 2 filtered
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	... 18 filtered
      	at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:178)
      	... 1 filtered
      	at com.atlassian.plugins.rest.module.RestDelegatingServletFilter.doFilter(RestDelegatingServletFilter.java:73)
      	... 110 filtered
      	at com.atlassian.plugins.rest.module.servlet.RestSeraphFilter.doFilter(RestSeraphFilter.java:40)
      	... 72 filtered
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:745)
      

      This is due to a bug in com.atlassian.jira.issue.customfields.statistics.AbstractCustomFieldStatisticsMapper#getSearchContextFromValue:

          protected SearchContext getSearchContextFromValue(Object value) {
              [...]
      
              List associatedIssueTypes = customField.getAssociatedIssueTypes();  // <-- notice the generic List?
              if (associatedIssueTypes != null && !associatedIssueTypes.isEmpty() && associatedIssueTypes.get(0) != null) {
                  issueTypeIds = GenericValueUtils.transformToStringIdsList(associatedIssueTypes);  //  <-- Oops! customField.getAssociatedIssueTypes now returns a List<IssueType>, not a List<GenericValue> anymore. So you cannot call GenericValueUtils.transformToStringIdsList on it. But since associatedIssueTypes is a List and not a List<GenericValue>, you don't see the error at compilation time...
              }
      
              [...]
          }
      

      Notes

      Some customers experience this in the XAxis as well.

      Workaround

      Set the customfield to global context.

      Attachments

        Issue Links

          Activity

            People

              drauf Daniel Rauf
              4a730f41f408 David [old account]
              Votes:
              13 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: