[#9856] - Exception in itext2.1.7.js6 when using PDF 508 tags

Category:
Bug report
Priority:
Normal
Status:
Feedback Requested
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:
0

When using certain PDF 508 Tags (e.g. TABLE or TR tags) in combination with an empty Text Field, we receive an IndexOutOfBoundsException from the underlying itext (itext2.1.7.js6) library:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.lowagie.text.pdf.PdfStructureTreeRoot.nodeProcess(PdfStructureTreeRoot.java:121)
at com.lowagie.text.pdf.PdfStructureTreeRoot.nodeProcess(PdfStructureTreeRoot.java:127)
at com.lowagie.text.pdf.PdfStructureTreeRoot.nodeProcess(PdfStructureTreeRoot.java:127)
at com.lowagie.text.pdf.PdfStructureTreeRoot.buildTree(PdfStructureTreeRoot.java:145)
at com.lowagie.text.pdf.PdfWriter.getCatalog(PdfWriter.java:896)
at com.lowagie.text.pdf.PdfWriter.close(PdfWriter.java:1176)
at com.lowagie.text.pdf.PdfDocument.close(PdfDocument.java:831)
at com.lowagie.text.Document.close(Document.java:496)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:931)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:537)

This is due to the fact, that the code in itext is not checking for an empty array:
if (obj != null && obj.isArray() && !((PdfObject)((PdfArray)obj).getArrayList().get(0)).isNumber()) {
but maybe this should be addressed already in the Jasperreports library!

Thanks!

v6.4
net.sf.jasperreports.exporte
karin.schellner's picture
Joined: Mar 5 2013 - 9:23am
Last seen: 2 weeks 5 days ago

3 Comments:

#1
  • Status:New» Feedback Requested
  • Assigned:» teodord

Hi,

Do you have a little sample at hand, that would help us reproduce the problem? I guess we can create one ourselves, but wanted to check with you first.

Thank you,
Teodor

#2
AttachmentSize
testpdf508tags.jrxml1.99 KB
#3

Hi Teodor,
I have just attached an example which does not make sense as a report, but which shows the problem with the last of the three textfields which is empty. It seems the problem only occurs with "container" tags like TABLE or TR, so it's maybe solved with the fix of the itext code (check for empty array) ...
Thanks,
Karin

Feedback