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 2009/01/24 20:59:59 UTC

[jira] Created: (PDFBOX-411) Could possibly be missing a close() the case where the output was open, but the writer was not

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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.