[ 
https://issues.apache.org/jira/browse/COMPRESS-64?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697845#action_12697845
 ] 

Christian Grobmeier commented on COMPRESS-64:
---------------------------------------------

Can you explain a bit more please?

As far as I could see in the code at most times finish() should be called 
flush().
In ZipOutputStream finish() additionally writes the central directory end. If 
one would write after the CD, wouldn't the Zipfile be corrupted?

Same goes for the other archives. Wouldn't writing arbitary data which is not 
an Entry corrupt the archive?

However, behaviour of finish() differs from Zip to the other streams. Ar 
doesn't have a finish() method. Jar behaves like Zip (of course).


> Are the public finish() methods ArchiveOutputStream implementations necessary 
> and safe?
> ---------------------------------------------------------------------------------------
>
>                 Key: COMPRESS-64
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-64
>             Project: Commons Compress
>          Issue Type: Bug
>            Reporter: Sebb
>
> Some of the ArchiveOutputStream implementations have public finish() methods. 
> These are currently only called from the close() methods.
> Seems to me that there is no need to allow the finish() methods to be called 
> externally, and the user can corrupt the output if they do.
> Surely the close() method is all that is needed?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to