avoid resource leak in test of
/**
* See https://sourceware.org/ml/bzip2-devel/2019-q3/msg00007.html
*/
- @Test()
+ @Test
public void shouldDecompressBlockWithNSelectorOverflow() throws Exception {
final File toDecompress = getFile("lbzip2_32767.bz2");
- final InputStream is = new FileInputStream(toDecompress);
- final BZip2CompressorInputStream in = new BZip2CompressorInputStream(is);
+ try (final InputStream is = new FileInputStream(toDecompress);
+ final BZip2CompressorInputStream in = new BZip2CompressorInputStream(is)) {
int l = 0;
while (in.read() != -1) {
l++;
@@ -44,3 +44,4 @@ public void shouldDecompressBlockWithNSelectorOverflow() throws Exception {
assertEquals(5, l);
}
}
+}
