commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <>
Subject [jira] Created: (COMPRESS-119) TarArchiveOutputStream#finish doesn't flush content to underlying stream
Date Mon, 04 Oct 2010 12:29:32 GMT
TarArchiveOutputStream#finish doesn't flush content to underlying stream

                 Key: COMPRESS-119
             Project: Commons Compress
          Issue Type: Bug
    Affects Versions: 1.1
            Reporter: Stefan Bodewig
             Fix For: 1.2

Originally reported against Ant []

The finish() method of TarOutputStream does not flush the TarBuffer to the
underlying output stream. A subsequent flush() on the TarOutputStream
unexpectedly does not flush all written data to the underlying stream.

Case: If an outputStream is tied to a Socket OutputStream, the receiving server
can be notified that the stream has finished by calling the
Socket.shutdownOutput() method while still allowing the server to respond to
the client e.g. for sending a status report of the finished data transfer. This
is in particular usefull if the size of the stream is not known in advance such
as for a tar stream generated on the fly at the client side.

The above case relies on all data being sent to the server before invoking
Socket.shutdownOutput(). The TarOutputStream finish() method suggests to be
doing just this but in practice does not send any remaining data in the
TarBuffer. Calling the TarOutputStream close() method is not an option in this
case since this also closes the Socket connection.

Quick fix: insert a buffer.flushBlock() statement at the end of the
TarOutputStream.finish() method.

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

View raw message