I have huge data for this report. It fails with a below exception. Does anybody has a resolution to this problem or any idea why this exception occurs while exporting report in text format.
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at net.sf.jasperreports.engine.export.JRTextExporter.exportText(JRTextExporter.java:476)
at net.sf.jasperreports.engine.export.JRTextExporter.exportElements(JRTextExporter.java:345)
at net.sf.jasperreports.engine.export.JRTextExporter.exportPage(JRTextExporter.java:322)
at net.sf.jasperreports.engine.export.JRTextExporter.exportReportToWriter(JRTextExporter.java:298)
at net.sf.jasperreports.engine.export.JRTextExporter.exportReport(JRTextExporter.java:240)
at com.db.longarch.steps.CreateJasperReportSteps.callJasperReport(CreateJasperReportSteps.java:132)
at com.db.longarch.steps.CreateJasperReportSteps.step(CreateJasperReportSteps.java:78)
at com.db.servicemanagement.TransactionDispatchService.startDispatch(TransactionDispatchService.java:303)
at com.db.servicemanagement.TransactionDispatchService.run(TransactionDispatchService.java:103)
at com.db.servicemanagement.ServiceThread.run(ServiceThread.java:68)
at java.lang.Thread.run(Thread.java:595)
Regards,
Gary
Post edited by: gshahri, at: 2008/06/05 16:18
15 Answers:
Here is what all u need to further investigate the problem.
To briefly describe the scenario that is causing problem.
a. It has a subreport within a master report.
b. Subreport exception class is InputStream as a parameter
c. I am attaching the document pointing the jar being used and reportDesign.
d. Is is something to do with Parameter setting before export ? Currently, we are just setting these
exporter.setParameter(JRExporterParameter.JASPER_PRINT, reportPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE, destFile);
exporter.setParameter(JRTextExporterParameter.CHARACTER_WIDTH,new Integer(10));
exporter.setParameter(JRTextExporterParameter.CHARACTER_HEIGHT,new Integer(10));
e. Below is the stacktrace of exception with 2.0.4
2008-06-06 13:29:04,799 ERROR [com.db.longarch.steps.CreateJasperReportSteps] - Error in callJasperReport() while creating report for generatedReports/AXSPoint/EXCEPTIONREPORT.rpt
java.lang.ArrayIndexOutOfBoundsException: -9107
at net.sf.jasperreports.engine.export.JRTextExporter.exportText(JRTextExporter.java:475)
at net.sf.jasperreports.engine.export.JRTextExporter.exportElements(JRTextExporter.java:339)
at net.sf.jasperreports.engine.export.JRTextExporter.exportPage(JRTextExporter.java:316)
at net.sf.jasperreports.engine.export.JRTextExporter.exportReportToWriter(JRTextExporter.java:292)
at net.sf.jasperreports.engine.export.JRTextExporter.exportReport(JRTextExporter.java:234)
at com.db.longarch.steps.CreateJasperReportSteps.callJasperReport(CreateJasperReportSteps.java:132)
at com.db.longarch.steps.CreateJasperReportSteps.step(CreateJasperReportSteps.java:78)
at com.db.servicemanagement.TransactionDispatchService.startDispatch(TransactionDispatchService.java:303)
at com.db.servicemanagement.TransactionDispatchService.run(TransactionDispatchService.java:103)
at com.db.servicemanagement.ServiceThread.run(ServiceThread.java:68)
at java.lang.Thread.run(Thread.java:595)
regards,
Girish. [file name=JasperReportException.doc size=199680]
Post edited by: gshahri, at: 2008/06/06 17:46
Sorry I did not understand your last reply. Do u want me to change something in the code ?
Can you please elaborate more on this. I don't have any XML apart from jrxmls that I have already sent.
My objective is to generate the report in Text Format. But currently , It generates 0 byte file after throwing following exception
java.lang.ArrayIndexOutOfBoundsException: -9107
at net.sf.jasperreports.engine.export.JRTextExporter.exportText(JRTextExporter.java:475)
at net.sf.jasperreports.engine.export.JRTextExporter.exportElements(JRTextExporter.java:339)
at net.sf.jasperreports.engine.export.JRTextExporter.exportPage(JRTextExporter.java:316)
at net.sf.jasperreports.engine.export.JRTextExporter.exportReportToWriter(JRTextExporter.java:292)
at net.sf.jasperreports.engine.export.JRTextExporter.exportReport(JRTextExporter.java:234)
at com.db.longarch.steps.CreateJasperReportSteps.callJasperReport(CreateJasperReportSteps.java:132)
at com.db.longarch.steps.CreateJasperReportSteps.step(CreateJasperReportSteps.java:78)
at com.db.servicemanagement.TransactionDispatchService.startDispatch(TransactionDispatchService.java:303)
at com.db.servicemanagement.TransactionDispatchService.run(TransactionDispatchService.java:103)
at com.db.servicemanagement.ServiceThread.run(ServiceThread.java:68)
at java.lang.Thread.run(Thread.java:595)
Regards,
Girish.
Post edited by: gshahri, at: 2008/06/10 15:23
Sorry I did not understand your last reply. Do u want me to change something in the code ? |
I was asking whether you could export the JasperPrint object (that fails when exported to text) to XML (using [url=http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/exp...) and post the XML export file here.
I tried replicating your issue by feeding some dummy data to the JRXMLs you posted, but the text export worked fine. Since I do not have access to the data you use to fill the reports, the only way to reproduce the problem is to get a filled report (as an XML export) from you.
Regards,
Lucian
Could you please post this as a bug [url=http://jasperforge.org/sf/tracker/do/listArtifacts/projects.jasperreport..., so that we can properly track it?
Regards,
Lucian
Thanks for the prompt response. I will certainly report this as a bug. But I would appreciate if you can reply to following queries
a. How long it may take to get a fix for this bug ? so that I can plan accordingly.
b. Can you suggest any work-around for resolving this problem ? Such as using other versions (latest) of the JasperReports or some Tweaking in the java code
c. It would be helpful, if you provide more insight into this bug. Is this a data issue? or Is this pertaining to particular sequence of characters ? or any other setting/parameter or something else
Thanks again for your cooperation
Regards,
Girish S.
gshahri wrote:
a. How long it may take to get a fix for this bug ? so that I can plan accordingly. |
We've already analyzed the bug, and a fix for it will be checked-in very shortly on the JasperReports SVN trunk.
b. Can you suggest any work-around for resolving this problem ? Such as using other versions (latest) of the JasperReports or some Tweaking in the java code |
You can workaround the bug by extending JRTextExporter and overriding a method (and using this extended exporter in your code):
Code: |
//extend the JR text exporter public class PatchedTextExporeter extends JRTextExporter { //overriding to fix the bug protected int calculateYCoord(int y) { return (int) (((long) pageHeight * y) / jasperPrint.getPageHeight()); } } Ā //then use the extended exporter: JRTextExporter exporter = new PatchedTextExporeter(); ... |
c. It would be helpful, if you provide more insight into this bug. Is this a data issue? or Is this pertaining to particular sequence of characters ? or any other setting/parameter or something else |
The bug occurs when reports containing very tall pages are exported to text. Such reports are usually produced by filling a report with pagination ignored (which I assume is what you did).
Regards,
Lucian
If you want to fix the issue in 2.0.4, either extend the 2.0.4 JRTextExporter as I've explained below, or get the 2.0.4 sources and apply the fix to the 2.0.4 JRTextExporter.java.
Regards,
Lucian