[#14116] - Report generation failed for large XLS report with '\n' linebreaks

Bug report
Project: Severity:
Component: Reproducibility:
Assigned to:

The problem occurred when generating a large (but not over XLS' 65k row limit) XLS report, where in one column, cells were filled with multiple URLs joined with linebreak '\n'. Report generation failed with no trace in logs (even DEBUG, which for single report is ~1.5GB!).

The problem is present only for sufficiently large data (i.e. date range, from which report was generated, around 18-20k rows). A hypothesis that some data in a single row caused error was ruled out by successfully running the same report twice, but with half of the problematic date range.

The data was fed into the report with query which concatenated URLs with '\n' linebreaks. Other escape characters did not work as a line break in shorter reports. Replacing '\n' with any other text like a plain word resulted in successful report generation, but the links were obviously concatenated into a single nonsense string.

Our current workaround is that we enabled HTML markup in the problematic column, and replaced '\n' with HTML <br> linebreaks.

The version used is 6.8.0, but it seems unavailable in the Version dropdown above.

rafal.szulejko's picture
Joined: Mar 22 2022 - 1:40am
Last seen: 12 months 3 days ago



Are you catching and logging exceptions in the code that calls the JasperReports API? Without seeing an exception stracktrace it's difficult to guess what could be the cause.



Dear Lucian, thank you for the reply. We manually intercept JRException and IOException, but those were not present in logs. The only exception present in logs (at DEBUG level logging) was a problem with Xerces setup. As mentioned before, the reports were generated correctly without any change of configuration, with only a smaller data range used.

2022-03-18 13:07:51,424 DEBUG [net.sf.jasperreports.engine.xml.BaseSaxParserFactory] (default task-2) Error setting Xerces grammar pool of type org.apache.xerces.util.XMLGrammarPoolImpl: net.sf.jasperreports.engine.JRRuntimeException: Could not load class org.apache.xerces.util.XMLGrammarPoolImpl.
at <war-file>//net.sf.jasperreports.engine.util.ClassUtils.instantiateClass(ClassUtils.java:72)
at <war-file>//net.sf.jasperreports.engine.xml.BaseSaxParserFactory.setGrammarPoolProperty(BaseSaxParserFactory.java:237)
at <war-file>//net.sf.jasperreports.engine.xml.BaseSaxParserFactory.enableSchemaCaching(BaseSaxParserFactory.java:196)
at <war-file>//net.sf.jasperreports.engine.xml.BaseSaxParserFactory.configureParser(BaseSaxParserFactory.java:172)
at <war-file>//net.sf.jasperreports.engine.xml.BaseSaxParserFactory.createParser(BaseSaxParserFactory.java:118)
at <war-file>//net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createParser(JRXmlDigesterFactory.java:1598)
at <war-file>//net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1567)
at <war-file>//net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:263)
at <war-file>//net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:248)
at <war-file>//net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:342)
at <war-file>//net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:609)
at <our logic>