Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.6
-
None
Description
When parsing corrupt PDF file, PDFBox crashed:
Caused by: java.io.IOException: Error reading stream, expected='endstream' actual='' at offset 116070
at org.apache.pdfbox.pdfparser.COSParser.parseCOSStream(COSParser.java:1013)
at org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:781)
at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:742)
at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:673)
at org.apache.pdfbox.pdfparser.COSParser.parseDictObjects(COSParser.java:633)
at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:241)
at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:276)
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1132)
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1066)
at org.apache.tika.parser.pdf.PDFParser.parse(PDFParser.java:141)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:280)
... 23 more
Can you thrown a specific exception to allow better error handling? Something like BadInputException, CorruptFileException or similar.
See related Tika issue: https://issues.apache.org/jira/browse/TIKA-2407