Skip to content

Commit 2c960ff

Browse files
committed
PDFBOX-5660: close input, as suggested by Valery Bokov; closes #299
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929420 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9c817e5 commit 2c960ff

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

pdfbox/src/test/java/org/apache/pdfbox/filter/TestFilters.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.io.IOException;
2323
import java.io.InputStream;
2424
import java.util.ArrayList;
25-
2625
import java.util.Random;
2726

2827
import org.apache.pdfbox.Loader;
@@ -148,10 +147,12 @@ void testPDFBOX4517() throws IOException
148147
@Test
149148
void testPDFBOX1977() throws IOException
150149
{
151-
Filter lzwFilter = FilterFactory.INSTANCE.getFilter(COSName.LZW_DECODE);
152-
InputStream in = this.getClass().getResourceAsStream("PDFBOX-1977.bin");
153-
byte[] byteArray = in.readAllBytes();
154-
checkEncodeDecode(lzwFilter, byteArray);
150+
try (InputStream is = this.getClass().getResourceAsStream("PDFBOX-1977.bin"))
151+
{
152+
Filter lzwFilter = FilterFactory.INSTANCE.getFilter(COSName.LZW_DECODE);
153+
byte[] byteArray = is.readAllBytes();
154+
checkEncodeDecode(lzwFilter, byteArray);
155+
}
155156
}
156157

157158
/**

0 commit comments

Comments
 (0)