Text Search causes a NullPointerException when running a group by query in a list view (shows "0 total Records" at top of list)


Description

In a list query with group by, the NullPointerException error below comes from attempting to populate the "# total records" to the top right of the list. The aggregate is generated differently and needs to be handled in Text Search code. At the same time, invalid user preferences sys_user_group.db.order=zztextsearchyy are generated.

Example stack trace:
2014-07-01 16:30:56 (982) Default-thread-4 BB2941139F2121008415308DC67FCF11 *** ERROR *** java.lang.NullPointerException
2014-07-01 16:30:56 (982) Default-thread-4 BB2941139F2121008415308DC67FCF11 SEVERE *** ERROR *** java.lang.NullPointerException
java.lang.NullPointerException
at com.glide.ts.query.TSRelevancySortStrategy.buildPopper(TSRelevancySortStrategy.java:45)
at com.glide.ts.query.TSAbstractSortStrategy.addReturnFields(TSAbstractSortStrategy.java:105)
at com.glide.ts.query.TSRelevancySortStrategy.addReturnFields(TSRelevancySortStrategy.java:59)
at com.glide.ts.service.TSQueryContext.addReturnFields(TSQueryContext.java:23)
at com.glide.db.DBAggregateQuery.toSQL(DBAggregateQuery.java:97)
at com.glide.db.DBQuery.getSelectStmt(DBQuery.java:596)
at com.glide.db.DBQuery.executeAsResultSet0(DBQuery.java:235)
at com.glide.db.DBQuery.executeAsResultSet(DBQuery.java:208)
at com.glide.db.access.DBTable.query(DBTable.java:91)
at com.glide.db.DBAggregateUtil.count(DBAggregateUtil.java:179)
at com.glide.script.GlideAggregate.getTotalRecordCount(GlideAggregate.java:724)
at com.glide.script.GlideAggregate.getTotalFromAggregates(GlideAggregate.java:568)
at com.glide.list_v2.ListRecordGroupedTag.setRowCounts(ListRecordGroupedTag.java:129)
at com.glide.list_v2.ListRecordDefaultTag.doTag(ListRecordDefaultTag.java:77)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:291)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:146)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:232)
at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:111)
at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:94)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:146)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:232)
at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:111)
at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:94)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:146)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:232)
at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:111)
at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:94)
at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:146)
at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:232)
at org.apache.commons.jelly.tags.core.JellyTag.doTag(JellyTag.java:84)
at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:291)
at com.glide.ui.jelly.GlideJellyContext.run(GlideJellyContext.java:727)
at com.glide.ui.jelly.GlideJellyContext.executeCompiledScript(GlideJellyContext.java:792)
at com.glide.ui.GlideFormPhase2.generate(GlideFormPhase2.java:49)
at com.glide.ui.GlideForm.generatePopulatedForm(GlideForm.java:610)
at com.glide.ui.GlideForm.quickExit(GlideForm.java:247)
at com.glide.ui.GlideForm.getRenderedPage(GlideForm.java:161)
at com.glide.ui.NavigationTransaction.writeOutput(NavigationTransaction.java:154)
at com.glide.ui.NavigationTransaction.process(NavigationTransaction.java:123)
at com.glide.ui.GlideServletUITransaction.process(GlideServletUITransaction.java:89)
at com.glide.processors.Processor.runProcessor(Processor.java:370)
at com.glide.processors.Processor.processTransaction(Processor.java:160)
at com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:146)
at com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:36)
at com.glide.ui.GlideServlet$1.run(GlideServlet.java:412)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)

Steps to Reproduce

 

  1. Navigate to Incident > All.
  2. Add a Keywords filter.
  3. Click the menu icon  and select Group By > Category.
    Note the stack trace in the log.

Workaround

After carefully considering the severity and frequency of the issue, and risk of attempting a fix, ServiceNow has decided to not address this issue in a future release. We do not make this decision lightly and we apologize for any inconvenience. If you have any questions regarding this problem contact ServiceNow Customer Support.

Despite the error being present, the behavior works as expected. The invalid generated user preferences sys_user_group.db.order=zztextsearchyy can be removed with no consequences.


Related Problem: PRB603400