Steven McDermott created PDFBOX-3760:
----------------------------------------
Summary: PDFStreamEngine swallows errors and should throw
exceptions when pdf cannot be read
Key: PDFBOX-3760
URL: https://issues.apache.org/jira/browse/PDFBOX-3760
Project: PDFBox
Issue Type: Improvement
Affects Versions: 2.0.5, 2.0.4, 2.0.3, 2.0.2, 2.0.1, 2.0.0
Reporter: Steven McDermott
Priority: Minor
The PDFStreamEngine class has the method below. Trying to convert a PDF
without the jbig2-imageio dependency installed, the following error message
shows in the logs:
{code}
Cannot read JBIG2 image: jbig2-imageio is not installed
{code}
This message shows in the logs and no error is thrown back to the implementing
class. Therefore actual errors are not communicated to the client attempting
to convert a PDF. This should throw an error and print the stack trace to the
console so that debugging can occur quickly and resolution to misconfiguration
can be made.
Another alternative option is to include the jbig2-imageio dependency with
PDFBox so that this exception would never occur.
Method for reference:
{code}
protected void operatorException(Operator operator, List<COSBase> operands,
IOException e)
throws IOException
{
if (e instanceof MissingOperandException ||
e instanceof MissingResourceException ||
e instanceof MissingImageReaderException)
{
LOG.error(e.getMessage());
}
else if (e instanceof EmptyGraphicsStackException)
{
LOG.warn(e.getMessage());
}
else if (operator.getName().equals("Do"))
{
// todo: this too forgiving, but PDFBox has always worked this way
for DrawObject
// some careful refactoring is needed
LOG.warn(e.getMessage());
}
else
{
throw e;
}
}{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]