Jump to content
We've recently updated our Privacy Statement, available here ×

Export to Text givesArrayIndexOutOfBoundsException


gshahri

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 15
  • Created
  • Last Reply

Top Posters In This Topic

Thanks for reply.

 

Initially I was using JasperReports-2.0.0.jar. But then using similar input, I switched to

JasperReports-2.0.4.jar.

 

But still problem persists.

 

I will be grateful I you can help me here.

 

Thanks,

 

Girish S.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Attached are the jrxml files as required by you. I am using Java program to export to text. I am calling callJasperReports method which actually invokes the exportReport()

Regards,

Girish [file name=jrxmls-aa5875a0160ecb5726c58573b7c16626.zip size=5949]

Link to comment
Share on other sites

Hi Lucian

 

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

Link to comment
Share on other sites

Link to comment
Share on other sites

Hi 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.

Link to comment
Share on other sites

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:
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

Link to comment
Share on other sites

Hi Lucian,

 

I downloaded the fix for artf3271, but I was not able to compile that. It fails at line 104

 

filter = createFilter(TXT_EXPORTER_PROPERTIES_PREFIX);

 

This method doesn't exists.

 

I hope this patch was applied on JasperReports2.0.4

 

Regards,

 

Girish S.

Link to comment
Share on other sites

The fix was applied to the JasperReports SVN trunk, and not to JR 2.0.4. Getting the JRTextExporter.java file from the SVN trunk and trying to use it in JR 2.0.4 would not work due to other code changes that occurred after the 2.0.4 release.

 

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...