LzmaFrameEncoderTest leak due to LzmaInputStream close behavior

Motivation:
c1932a8537 made an assumption that the LzmaInputStream which wraps a ByteBufInputStream would delegate the close operation to the wrapped stream. This assumption is not true and thus we still had a leak. An issue has been logged with our LZMA dependency https://github.com/jponge/lzma-java/issues/14.

Modifications:
- Force a close on the wrapped stream

Result:
No more leak.
This commit is contained in:
Scott Mitchell 2016-11-15 17:06:03 -08:00
parent c8575c42d0
commit 2c78902ebc

View File

@ -98,7 +98,11 @@ public class LzmaFrameEncoderTest extends AbstractEncoderTest {
} finally {
if (lzmaIs != null) {
lzmaIs.close();
} else {
}
// LzmaInputStream does not close the stream it wraps, so we should always close.
// The close operation should be safe to call multiple times anyways so lets just call it and be safe.
// https://github.com/jponge/lzma-java/issues/14
if (is != null) {
is.close();
}
}