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

Nested filters with dateCompare queries throw exceptions

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Done
    • Priority: High
    • Resolution: Obsolete
    • Affects Version/s: 5.1.8
    • Fix Version/s: None
    • Component/s: JQL Functions
    • Labels:
      None
    • Critical Points:
      0.6

      Description

      To reproduce

      Start by creating a base filter with a dateCompare query. For example

      project in ("Load Testing Project LOADPA", "Load Testing Project LOADPB", "Load Testing Project LOADPC", "Load Testing Project LOADPD") AND issuetype = Bug AND issueFunction in dateCompare("", "updated > created")

      Save this with a name like "Main Filter". Then create a few more saved filters...

      filter = "Main Filter" AND issueFunction in dateCompare("", "updated > First Date")
      filter = "Main Filter" AND issueFunction in dateCompare("", "created > First Date")
      filter = "Main Filter" AND issueFunction in dateCompare("", "created < First Date")

      Refresh them all in quick succession. Do this often enough, and eventually you'll one of the filters will display a 500 error. The logs should contain a stack trace like:

      2017-10-12 09:27:37,465 http-bio-8080-exec-10 ERROR admin [[Catalina].[localhost].[/jira].[action]] Servlet.service() for servlet action threw exception
      java.lang.NullPointerException: Cannot invoke method getTime() on null object
      at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      at java_sql_Timestamp$getTime.call(Unknown Source)
      at com.onresolve.jira.groovy.jql.DateCompare.getFieldCalendar(DateCompare.groovy:123)
      ... 2 filtered
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
      at com.onresolve.jira.groovy.jql.DateCompare$_getQuery_closure1.doCall(DateCompare.groovy:144)
      ... 2 filtered
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
      at groovy.lang.Closure.call(Closure.java:426)
      at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom(ConvertedMap.java:54)
      at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:124)
      at com.sun.proxy.$Proxy3975.apply(Unknown Source)
      at com.onresolve.jira.groovy.jql.FilterCollector$apply.call(Unknown Source)
      at com.onresolve.jira.groovy.jql.AbstractScriptedJqlFunction$_getIssues_closure1.doCall(AbstractScriptedJqlFunction.groovy:123)
      ... 2 filtered
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021)
      at groovy.lang.Closure.call(Closure.java:426)
      at groovy.lang.Closure.call(Closure.java:442)
      at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2030)
      at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2015)
      at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:2056)
      at org.codehaus.groovy.runtime.dgm$162.invoke(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:274)
      at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:56)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
      at com.onresolve.jira.groovy.jql.AbstractScriptedJqlFunction.getIssues(AbstractScriptedJqlFunction.groovy:122)
      at com.onresolve.jira.groovy.jql.AbstractScriptedJqlFunction$getIssues$3.callCurrent(Unknown Source)
      at com.onresolve.jira.groovy.jql.AbstractScriptedJqlFunction.getIssuesForDeterminedProjects(AbstractScriptedJqlFunction.groovy:79)
      ... 3 filtered
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSite.invoke(PogoMetaMethodSite.java:169)
      at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:190)
      at com.onresolve.jira.groovy.jql.DateCompare.getQuery(DateCompare.groovy:168)
      at com.onresolve.jira.groovy.jql.DateCompare$getQuery$1.call(Unknown Source)
      at com.onresolve.jira.groovy.jql.ScriptedJqlFunction.getQuery(ScriptedJqlFunction.groovy:117)
      at com.onresolve.jira.groovy.jql.ScriptedJqlFunction$getQuery.call(Unknown Source)
      at com.onresolve.jira.groovy.jql.ScriptedFunctionClauseFactory.getQuery(ScriptedFunctionClauseFactory.groovy:92)
      at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:97)
      at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:25)
      at com.atlassian.query.clause.TerminalClauseImpl.accept(TerminalClauseImpl.java:143)
      at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:55)
      at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:25)
      at com.atlassian.query.clause.AndClause.accept(AndClause.java:28)
      at com.atlassian.jira.jql.query.QueryVisitor.createQuery(QueryVisitor.java:51)
      at com.atlassian.jira.jql.query.SavedFilterClauseQueryFactory.getQueryFromSavedFilter(SavedFilterClauseQueryFactory.java:91)
      at com.atlassian.jira.jql.query.SavedFilterClauseQueryFactory.getQuery(SavedFilterClauseQueryFactory.java:64)
      at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:97)
      at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:25)
      at com.atlassian.query.clause.TerminalClauseImpl.accept(TerminalClauseImpl.java:143)
      at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:55)
      at com.atlassian.jira.jql.query.ContextAwareQueryVisitor.visit(ContextAwareQueryVisitor.java:25)
      at com.atlassian.query.clause.AndClause.accept(AndClause.java:28)
      at com.atlassian.jira.jql.query.QueryVisitor.createQuery(QueryVisitor.java:51)
      at com.atlassian.jira.jql.query.DefaultLuceneQueryBuilder.createLuceneQuery(DefaultLuceneQueryBuilder.java:29)
      at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.createLuceneQuery(LuceneSearchProvider.java:263)
      at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getHits(LuceneSearchProvider.java:206)
      at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.searchAndSort(LuceneSearchProvider.java:329)
      at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.searchAndSort(LuceneSearchProvider.java:140)
      ... 2 filtered
      at java.lang.reflect.Method.invoke(Method.java:498)
      at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26)
      at com.sun.proxy.$Proxy341.searchAndSort(Unknown Source)
      ... 2 filtered
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
      at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56)
      at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
      at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70)
      at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
      at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
      at com.sun.proxy.$Proxy2846.searchAndSort(Unknown Source)
      at com.atlassian.jira.plugin.issuenav.service.issuetable.AbstractIssueTableCreator.collectIssues(AbstractIssueTableCreator.java:159)
      at com.atlassian.jira.plugin.issuenav.service.issuetable.AbstractIssueTableCreator.executeNormalSearch(AbstractIssueTableCreator.java:221)
      at com.atlassian.jira.plugin.issuenav.service.issuetable.AbstractIssueTableCreator.create(AbstractIssueTableCreator.java:189)
      at com.atlassian.jira.plugin.issuenav.service.issuetable.DefaultIssueTableService.createIssueTableFromCreator(DefaultIssueTableService.java:170)
      at com.atlassian.jira.plugin.issuenav.service.issuetable.DefaultIssueTableService.getIssueTable(DefaultIssueTableService.java:268)
      at com.atlassian.jira.plugin.issuenav.service.issuetable.DefaultIssueTableService.getIssueTableFromFilterWithJql(DefaultIssueTableService.java:115)
      at com.atlassian.jira.plugin.issuenav.IssueNavAction.performSearch(IssueNavAction.java:1083)
      at com.atlassian.jira.plugin.issuenav.IssueNavAction.doNav(IssueNavAction.java:420)
      at com.atlassian.jira.plugin.issuenav.IssueNavAction.doDefault(IssueNavAction.java:279)
      ... 3 filtered
      at java.lang.reflect.Method.invoke(Method.java:498)
      at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(InjectionUtils.java:70)
      at webwork.util.InjectionUtils.invoke(InjectionUtils.java:56)
      ... 2 filtered
      at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63)
      ... 7 filtered
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      ... 52 filtered
      at com.atlassian.servicedesk.internal.web.ExternalCustomerLockoutFilter.doFilter(ExternalCustomerLockoutFilter.java:56)
      ... 4 filtered
      at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
      ... 41 filtered
      at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
      ... 1 filtered
      at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
      ... 20 filtered
      at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
      ... 5 filtered
      at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:116)
      ... 11 filtered
      at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
      ... 7 filtered
      at com.atlassian.jira.plugin.issuenav.IssueNavRewriteFilter.doFilter(IssueNavRewriteFilter.java:113)
      ... 4 filtered
      at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
      ... 70 filtered
      at com.atlassian.jira.security.JiraSecurityFilter.lambda$doFilter$0(JiraSecurityFilter.java:66)
      ... 1 filtered
      at com.atlassian.jira.security.JiraSecurityFilter.doFilter(JiraSecurityFilter.java:64)
      ... 32 filtered
      at com.atlassian.jira.servermetrics.CorrelationIdPopulatorFilter.doFilter(CorrelationIdPopulatorFilter.java:30)
      ... 5 filtered
      at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.lambda$invokeFilterChain$0(CustomerContextSettingFilter.java:181)
      at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.rteInvoke(ReentrantThreadLocalBasedCodeContext.java:137)
      at com.atlassian.servicedesk.internal.api.util.context.ReentrantThreadLocalBasedCodeContext.runOutOfContext(ReentrantThreadLocalBasedCodeContext.java:90)
      at com.atlassian.servicedesk.internal.utils.context.CustomerContextServiceImpl.runOutOfCustomerContext(CustomerContextServiceImpl.java:65)
      at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.outOfCustomerContext(CustomerContextSettingFilter.java:174)
      at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilterImpl(CustomerContextSettingFilter.java:130)
      at com.atlassian.servicedesk.internal.web.CustomerContextSettingFilter.doFilter(CustomerContextSettingFilter.java:121)
      ... 4 filtered
      at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32)
      ... 8 filtered
      at com.atlassian.web.servlet.plugin.request.RedirectInterceptingFilter.doFilter(RedirectInterceptingFilter.java:21)
      ... 4 filtered
      at com.atlassian.web.servlet.plugin.LocationCleanerFilter.doFilter(LocationCleanerFilter.java:36)
      ... 26 filtered
      at com.atlassian.jira.servermetrics.MetricsCollectorFilter.doFilter(MetricsCollectorFilter.java:25)
      ... 21 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)
      2017-10-12 09:27:37,590 http-bio-8080-exec-10 ERROR admin [jira.web.filters.CommittedResponseHtmlErrorRecoveryFilter] Exception occurred after HTTP response was already committed: java.lang.NullPointerException: Cannot invoke method getTime() on null object
      

       

      Impact

      If you have a Confluence page with several filters embedded in it, you can run into this error. Confusingly, Confluence will often deliver cached or otherwise incorrect results for the filter that receives a 500 error, so the problem can be hidden in this case.

      This could also impact Dashboard Gadgets or other pages that might consume several filters at once.

      Workarounds

      The most straightforward workaround is to decompose your filters. Instead of using a filter = "Some Filter" clause, simply copy and paste the JQL from the main filter into the sub-filters.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jcarter Jonny Carter
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: