[#13841] - Evaluation Time in Lists causes NullPointerException

Category:
Bug report
Priority:
High
Status:
New
Project: Severity:
Critical
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

Using some Evaluation Time different to "now" (like "band") at Text Fields in List elements always causes a NullPointerException at runtime (independent of actual expression).

java.lang.NullPointerException
at net.sf.jasperreports.engine.fill.DelayedFillActions.addDelayedAction(DelayedFillActions.java:196)
at net.sf.jasperreports.engine.fill.DelayedFillActions.addDelayedAction(DelayedFillActions.java:150)
at net.sf.jasperreports.engine.fill.BaseReportFiller.addBoundElement(BaseReportFiller.java:802)
at net.sf.jasperreports.engine.fill.JRBaseFiller.addBoundElement(JRBaseFiller.java:1539)
at net.sf.jasperreports.engine.fill.JRBaseFiller.addBoundElement(JRBaseFiller.java:1530)
at net.sf.jasperreports.engine.fill.JRFillTextField.fill(JRFillTextField.java:924)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.fillElements(JRFillElementContainer.java:1040)
at net.sf.jasperreports.components.list.VerticalFillList.fillContents(VerticalFillList.java:166)
at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:111)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:152)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:542)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:453)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:428)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:327)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:258)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:621)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
at java.base/java.lang.Thread.run(Thread.java:834)

The same setup with a Table element works as expected, so this is currently a workaround.

Simple example report is attached.

Some background info: The return value (like a sum) of a nested List in List should be displayed at the next higher level. Using default evaluation time "now" leads only to "null" being displayed. Evaluation type "band" should display the correct value after nested list is completed. Works as intended with subreports or table elements.

AttachmentSize
Binary Data evaluationtimeexception.jrxml3.19 KB
v6
List
oh's picture
oh
9
Joined: Sep 6 2016 - 2:52am
Last seen: 6 months 1 week ago

1 Comment:

#1

The same situation still creates a null pointer exception, but stack trace is slightly different:

java.lang.NullPointerException
at net.sf.jasperreports.engine.fill.JRFillElement.autogetVariableEvaluationTime(JRFillElement.java:1416)
at net.sf.jasperreports.engine.fill.JRFillElement.collectDelayedEvaluations(JRFillElement.java:1335)
at net.sf.jasperreports.engine.fill.JRFillTextField.collectDelayedEvaluations(JRFillTextField.java:1085)
at net.sf.jasperreports.engine.fill.JRFillElement.initDelayedEvaluations(JRFillElement.java:1266)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:528)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:383)
at net.sf.jasperreports.components.list.FillListContents.evaluateContents(FillListContents.java:85)
at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:110)
at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:152)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:542)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:453)
at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:428)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2602)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:825)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:266)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:621)
at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
at java.base/java.lang.Thread.run(Unknown Source)

Wheras Line 1416 in JRFillElement.java is
band.isNowEvaluationTime(evaluationTime)

Seems like object variable "band" is never assigned to subelements within lists and thus null, causing the NullPointerException.

Feedback