You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/02/27 00:11:23 UTC
[jira] [Closed] (PDFBOX-411) Could possibly be missing a close()
the case where the output was open, but the writer was not
[ https://issues.apache.org/jira/browse/PDFBOX-411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr closed PDFBOX-411.
----------------------------------
> Could possibly be missing a close() the case where the output was open, but the writer was not
> -----------------------------------------------------------------------------------------------
>
> Key: PDFBOX-411
> URL: https://issues.apache.org/jira/browse/PDFBOX-411
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 0.8.0-incubator
> Reporter: Peter_Lenahan@ibi.com
> Priority: Minor
>
> package org.apache.pdfbox.pdmodel;
> public class PDDocument
> And the same code in this class
> package org.apache.pdfbox.pdmodel.fdf;
> public class FDFDocument
> Subject:
> // could possibly be missing the case where the output was open, but the writer was not
> // be sure to close output of it is not possible to close the writer.
> public void save( OutputStream output ) throws IOException, COSVisitorException
> {
> //update the count in case any pages have been added behind the scenes.
> getDocumentCatalog().getPages().updateCount();
> COSWriter writer = null;
> try
> {
> writer = new COSWriter( output );
> writer.write( this );
> writer.close();
> }
> finally
> {
> if( writer != null )
> {
> writer.close();
> }
> else if (output != null) {
> output.close(); // This may happen of you don't have disk space or write access to the file.
> }
> }
> }
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)