[#10451] - NullPointerException at parentElement.getBand().isSplitTypePreventInhibited(isTopLevelCall);

Category:
Bug report
Priority:
High
Status:
Confirmed
Project: Severity:
Major
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

I am getting a Nullpointer exception when generating report, which used to work in version 6.4 but now fail in 6.5.1.

It fails when there is a tables inside of a band and one cell overflows, so that a page breaks because of this.

2018-02-15 17:36:06.447 ERROR --- [nio-8080-exec-1] n.s.j.engine.fill.JRFillSubreport : Fill 1: exception

java.lang.NullPointerException: null
at net.sf.jasperreports.engine.fill.FillerSubreportParent.isSplitTypePreventInhibited(FillerSubreportParent.java:109)
at net.sf.jasperreports.engine.fill.JRFillBand.isSplitTypePreventInhibited(JRFillBand.java:618)
at net.sf.jasperreports.engine.fill.JRFillBand.isSplitTypePreventInhibited(JRFillBand.java:597)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2555)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:791)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:252)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:99)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:609)
at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:405)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:740)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221)

The report is generated and has about 2 pages usually, sometimes up to 10. The reports failing have 2 and 5 pages.

AttachmentSize
Binary Data closing_detail.jrxml44.3 KB
Binary Data closing_detail_3.jrxml8.9 KB
jasper library
cr_1's picture
2
Joined: Feb 15 2018 - 9:05am
Last seen: 2 months 1 day ago

19 Comments:

#1

It looks like isSplitTypePreventInhibited is called on null. Seems to happen when a table is located in a detail band and the cell of the table is overflowing, that is generating a page break.

#2
  • Reproducibility:Random» Always
#3
  • Severity:Minor» Major
#4

Hi,

does it also fail if you set:

net.sf.jasperreports.legacy.band.evaluation.enabled=true

#5

The same error seems to occur, when

JRPdfExporter exporter = new JRPdfExporter();
[..]
exporter.setParameter(JRCalculator.PROPERTY_LEGACY_BAND_EVALUATION_ENABLED, true)
exporter.exportReport();

Is set. Is it the right way to activate this configuration?

#6

Fails also using system environment property

net.sf.jasperreports.legacy.band.evaluation.enabled=true

#7

To give you a better impression: I appended a PDF file which was successfully created with 6.4.0 but fails with 6.5.1. It seems to only happen when the left sub table overflows and a page break is created.

AttachmentSize
PDF icon abschluss-15-02-2018_26.pdf31.14 KB
#8

I was able to reduce the jrxml file to a more core variant. See attachment. This file fails for a given input.

AttachmentSize
Binary Data closing_detail_3.jrxml8.9 KB
#9

The following file is the most simple jrxml file I could produce, where there is still the mentioned error.

AttachmentSize
Binary Data closing_detail_4.jrxml4.09 KB
#10

No, that's not the correct way to set this configuration since it is not an export parameter.
It has to be active before report filling starts.
To achive this, set this property in the your global jasperreports.properties file (in the root of your classpath).

#11

We have the same issue. Setting 'net.sf.jasperreports.legacy.band.evaluation.enabled=true' in 'jasperreports.properties' doesn't help.

For our tests it works to prevent the NPE in 'FillerSubreportParent' with a null-pointer check: 'return parentElement.getBand() != null && parentElement.getBand().isSplitTypePreventInhibited(isTopLevelCall)'.

But I don't know if that is just a workaround or if it is intended that the band on JRFillSubreport (the 'parentElement') is null. In my tests the 'setBand' method is never called on JRFillSubreport, neither with working reports or with reports that produce the NPE.

With the latter in mind, the method could probably always just return false...

#12

It would be awesome to add a NP check to this function, otherwise we cannot upgrade.

#13

A self contained test case would help with reproducing the problem. E.g. some data to run the report from comment #9.

Adding a null check would be easy, but we need to understand how the problem occurs and decide if the null check is the proper way to fix it.

Regards,
Lucian

#14

See appended JRXML file. If you open it in Jaspersoft Studio and try to compile it you will see the mentioned NPE.

#15

Sorry forgot to mention, that the example is using any datasource with at least 6 items. The content of the datasource is not used in the file.

#16
  • Status:New» Confirmed

Thank you for the details, we reproduced the problem.

#17

Great, thank you very much! Can you give me an estimate about when the release is going to happen? The release is great because a bunch of things were sorted out.

If it is weeks, I will patch this file by myself. If its days, then I probably wait for the release.

Thanks for the effort.

#18

We might come up with a fix in a few days/a week, but it will take longer until the next release (6.6) will be out.

#19
  • Priority:Normal» High

Hello, can we get an update on this bug please? Starting to heavily affect my customers.

Thanks

Feedback
randomness