-
Bug
-
Resolution: Unresolved
-
P4
-
8
-
None
The DeflaterOutputStream specifies that it will create a Deflater of its own when the stream is constructed without any given Deflater. It further specifies that this Deflater, that it created, will be closed when the stream is closed (i.e. close() is called on the DeflaterOutputStream).
However, in the current implementation of DeflaterOutputStream.finish() method, such a Deflater instance is also closed if finish() throws an IOException:
public void finish() throws IOException {
if (!def.finished()) {
try{
def.finish();
while (!def.finished()) {
deflate();
}
} catch(IOException e) {
if (usesDefaultDeflater)
def.end();
throw e;
}
}
}
This needs to be reviewed to either specify this behaviour or change the implementation to not close the Deflater instance.
However, in the current implementation of DeflaterOutputStream.finish() method, such a Deflater instance is also closed if finish() throws an IOException:
public void finish() throws IOException {
if (!def.finished()) {
try{
def.finish();
while (!def.finished()) {
deflate();
}
} catch(IOException e) {
if (usesDefaultDeflater)
def.end();
throw e;
}
}
}
This needs to be reviewed to either specify this behaviour or change the implementation to not close the Deflater instance.