You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Peter_Lenahan@ibi.com (JIRA)" <ji...@apache.org> on 2010/04/30 04:08:54 UTC
[jira] Created: (PDFBOX-713) PDFont fails to close Font File.
PDFont fails to close Font File.
--------------------------------
Key: PDFBOX-713
URL: https://issues.apache.org/jira/browse/PDFBOX-713
Project: PDFBox
Issue Type: Bug
Components: FontBox
Affects Versions: 1.1.0
Reporter: Peter_Lenahan@ibi.com
Findbugs Reported this problem.
I have include a patch which closes the file.
BufferedReader in = new BufferedReader(new InputStreamReader(fontFile.getUnfilteredStream()));
Bug: org.apache.pdfbox.pdmodel.font.PDFont.getEncodingFromFont() may fail to close stream
Pattern id: OS_OPEN_STREAM, type: OS, category: BAD_PRACTICE
The method creates an IO stream object, does not assign it to any fields, pass it to other methods that might close it, or return it, and does not appear to close the stream on all paths out of the method. This may result in a file descriptor leak. It is generally a good idea to use a finally block to ensure that streams are closed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Assigned: (PDFBOX-713) PDFont fails to close Font File.
Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Lehmkühler reassigned PDFBOX-713:
-----------------------------------------
Assignee: Andreas Lehmkühler
> PDFont fails to close Font File.
> --------------------------------
>
> Key: PDFBOX-713
> URL: https://issues.apache.org/jira/browse/PDFBOX-713
> Project: PDFBox
> Issue Type: Bug
> Components: FontBox
> Affects Versions: 1.1.0
> Reporter: Peter_Lenahan@ibi.com
> Assignee: Andreas Lehmkühler
> Attachments: PDFont-Fails-toCloseFontFile.txt, PDFont.java
>
>
> Findbugs Reported this problem.
> I have include a patch which closes the file.
> BufferedReader in = new BufferedReader(new InputStreamReader(fontFile.getUnfilteredStream()));
> Bug: org.apache.pdfbox.pdmodel.font.PDFont.getEncodingFromFont() may fail to close stream
> Pattern id: OS_OPEN_STREAM, type: OS, category: BAD_PRACTICE
> The method creates an IO stream object, does not assign it to any fields, pass it to other methods that might close it, or return it, and does not appear to close the stream on all paths out of the method. This may result in a file descriptor leak. It is generally a good idea to use a finally block to ensure that streams are closed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (PDFBOX-713) PDFont fails to close Font File.
Posted by "Peter_Lenahan@ibi.com (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PDFBOX-713?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Peter_Lenahan@ibi.com updated PDFBOX-713:
-----------------------------------------
Attachment: PDFont-Fails-toCloseFontFile.txt
PDFont.java
The patch looks bigger than it really is, I corrected the indentation.
It really just adds a try { } finally { in.close() }
to the code.
> PDFont fails to close Font File.
> --------------------------------
>
> Key: PDFBOX-713
> URL: https://issues.apache.org/jira/browse/PDFBOX-713
> Project: PDFBox
> Issue Type: Bug
> Components: FontBox
> Affects Versions: 1.1.0
> Reporter: Peter_Lenahan@ibi.com
> Attachments: PDFont-Fails-toCloseFontFile.txt, PDFont.java
>
>
> Findbugs Reported this problem.
> I have include a patch which closes the file.
> BufferedReader in = new BufferedReader(new InputStreamReader(fontFile.getUnfilteredStream()));
> Bug: org.apache.pdfbox.pdmodel.font.PDFont.getEncodingFromFont() may fail to close stream
> Pattern id: OS_OPEN_STREAM, type: OS, category: BAD_PRACTICE
> The method creates an IO stream object, does not assign it to any fields, pass it to other methods that might close it, or return it, and does not appear to close the stream on all paths out of the method. This may result in a file descriptor leak. It is generally a good idea to use a finally block to ensure that streams are closed.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.