You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Ivan Mushketyk (JIRA)" <ji...@apache.org> on 2016/06/27 21:19:17 UTC

[jira] [Comment Edited] (FLINK-4096) Nested FileOutputStream is not closed in JarFileCreator

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

Ivan Mushketyk edited comment on FLINK-4096 at 6/27/16 9:18 PM:
----------------------------------------------------------------

It seems that JarOutputStream closes the FileOutputStream.
JarOutputStream inherits DeflaterOutputStream that has the following close() methods:
{quote}
/**
     * Writes remaining compressed data to the output stream and closes the
     * underlying stream.
     * @exception IOException if an I/O error has occurred
     */
    public void close() throws IOException {
        if (!closed) {
            finish();
            if (usesDefaultDeflater)
                def.end();
            out.close();
            closed = true;
        }
    }
{quote}

Where out is an underlying OutputStream.


was (Author: ivan.mushketyk):
It seems that JarOutputStream closes the FileOutputStream.
JarOutputStream inherits DeflaterOutputStream that has the following close() methods:

/**
     * Writes remaining compressed data to the output stream and closes the
     * underlying stream.
     * @exception IOException if an I/O error has occurred
     */
    public void close() throws IOException {
        if (!closed) {
            finish();
            if (usesDefaultDeflater)
                def.end();
            out.close();
            closed = true;
        }
    }

Where out is an underlying OutputStream.

> Nested FileOutputStream is not closed in JarFileCreator
> -------------------------------------------------------
>
>                 Key: FLINK-4096
>                 URL: https://issues.apache.org/jira/browse/FLINK-4096
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: Ivan Mushketyk
>            Priority: Minor
>
> {code}
>     final JarOutputStream jos = new JarOutputStream(new FileOutputStream(this.outputFile), new Manifest());
> {code}
> When jos is closed, the FileOutputStream is not automatically closed.
> FileOutputStream should be closed explicitly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)