[ 
https://issues.apache.org/jira/browse/PDFBOX-3760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15973385#comment-15973385
 ] 

Tilman Hausherr commented on PDFBOX-3760:
-----------------------------------------

Yes it is swallowed... users want it like that. But in your case, it is clearly 
a configuration error. It's described in the dependency page. And although it 
doesn't throw an exception, it puts an ERROR in the logfile.

Re "include the jbig2-imageio dependency with PDFBox" we can't because of an 
incompatible license.

> 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.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5
>            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]

Reply via email to