Fields in CSV Reports are truncated since library version 6.4.3

Hi,

We have a CSV report where we set the property „net.sf.jasperreports.print.keep.full.text” to true, but since library version 6.4.3 none of the set properties are taken into account anymore.
The result is that now some fields are truncated. As a workaround we increased the width of the fields (<reportElement>). 
The jrxml looks something like this:

<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="reportName" pageWidth="3300" pageHeight="602" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="3300" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isIgnorePagination="true" uuid="14c3bf30-038f-4fab-8d41-b9a696b37cc3">
<property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <property name="net.sf.jasperreports.export.csv.field.delimiter" value=";"/>
    <property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
 
...
...
</jasperReport>

I debugged the report generation (version 6.4.3) and saw that on line 140 of net.sf.jasperreports.engine.fill.JRFillTextElement.JRFillTextElement it tries to read the said property from the main data set of the filler which is null at that point.

I had a look at the stack and saw that it is actually just in the process of building this main data set when trying to read properties from it.

Here is the stack:

JRFillStaticText(JRFillTextElement).<init>(JRBaseFiller, JRTextElement, JRFillObjectFactory) line: 140    <-- Here the instance variable mainDataset of the filler is read 
JRFillStaticText.<init>(JRBaseFiller, JRStaticText, JRFillObjectFactory) line: 49    
JRFillObjectFactory.visitStaticText(JRStaticText) line: 650    
JRBaseStaticText.visit(JRVisitor) line: 86    
JRFillObjectFactory(JRAbstractObjectFactory).getVisitResult(JRVisitable) line: 88    
JRFillBand(JRFillElementGroup).<init>(JRElementGroup, JRFillObjectFactory) line: 82    
JRFillBand(JRFillElementContainer).<init>(JRBaseFiller, JRElementGroup, JRFillObjectFactory) line: 95    
JRFillBand.<init>(JRBaseFiller, JRBand, JRFillObjectFactory) line: 121    
JRFillObjectFactory.getBand(JRBand) line: 524    
JRFillSection.<init>(JRBaseFiller, JRSection, JRFillObjectFactory) line: 74    
JRFillObjectFactory.getSection(JRSection) line: 500    
JRFillGroup.<init>(JRGroup, JRFillObjectFactory) line: 86    
JRFillObjectFactory.getGroup(JRGroup) line: 476    
JRFillVariable.<init>(JRVariable, JRFillObjectFactory) line: 83    
JRFillObjectFactory.getVariable(JRVariable) line: 456    
JRFillDataset.addVariable(JRVariable, List<JRFillVariable>, JRFillObjectFactory) line: 362    
JRFillDataset.setVariables(JRDataset, JRFillObjectFactory) line: 352    
JRFillDataset.<init>(BaseReportFiller, JRDataset, JRFillObjectFactory) line: 297    
JRFillObjectFactory.getDataset(JRDataset) line: 1341    
JRVerticalFiller(BaseReportFiller).<init>(JasperReportsContext, JasperReport, FillerParent) line: 166    <-- Here the instance variable mainDataset of the filler is set
JRVerticalFiller(JRBaseFiller).<init>(JasperReportsContext, JasperReport, BandReportFillerParent) line: 266    
JRVerticalFiller.<init>(JasperReportsContext, JasperReport, BandReportFillerParent) line: 69    
JRVerticalFiller.<init>(JasperReportsContext, JasperReport) line: 57    
JRFiller.createBandReportFiller(JasperReportsContext, JasperReport) line: 219    
JRFiller.createReportFiller(JasperReportsContext, JasperReport) line: 234    
JRFiller.fill(JasperReportsContext, JasperReport, Map<String,Object>) line: 178    
JasperFillManager.fill(JasperReport, Map<String,Object>) line: 474 


I found the following commit on github which changes the source where the properties are read from: https://github.com/TIBCOSoftware/jasperreports/commit/ab16d66354b890047e...
In my opinion this commit breaks our reports and I don't understand how this mainDataset can ever be non-null after this change. But maybe someone can enlighten me and tell me what we need to do different so it's not null?

Thanks for your help.

Regards
Thomas

thomas.aregger's picture
Joined: Nov 15 2018 - 1:25am
Last seen: 4 years 10 months ago

0 Answers:

No answers yet
Feedback
randomness