[
https://issues.apache.org/jira/browse/PDFBOX-6357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155069#comment-18155069
]
ASF subversion and git services commented on PDFBOX-6357:
---------------------------------------------------------
Commit 1941236 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1941236 ]
PDFBOX-6357: remove unneeded code
> Loader.loadPDF should close a file it opened if a stream-cache factory throws
> -----------------------------------------------------------------------------
>
> Key: PDFBOX-6357
> URL: https://issues.apache.org/jira/browse/PDFBOX-6357
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 3.0.8 PDFBox
> Reporter: Qiuye Wang
> Priority: Minor
>
> Version reviewed: pdfbox 3.0.8
> The file overload opens a random-access source before parsing. Its failure
> cleanup handles IOException. A user-supplied stream-cache factory can throw
> an unchecked exception during document construction, before a PDDocument is
> returned, leaving the file source without a matching close.
> Apply the same ownership rule when parsing exits with an unchecked exception.
> This concerns files opened by the loader and a failing custom cache factory.
> https://github.com/apache/pdfbox/blob/9286e47d89d6877005c9d2d0f2fd38793a62519a/pdfbox/src/main/java/org/apache/pdfbox/Loader.java#L351-L366
> https://github.com/apache/pdfbox/blob/9286e47d89d6877005c9d2d0f2fd38793a62519a/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java#L140-L155
> Based on source inspection. This report was drafted with AI assistance.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]