Skip to content

Commit 5f776e3

Browse files
committed
PDFBOX-6164: close input, as suggested by Valery Bokov
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1931689 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2b50074 commit 5f776e3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/CCITTFactoryTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.io.File;
2222
import java.io.IOException;
23+
import java.io.InputStream;
2324
import java.net.URI;
2425
import java.net.URISyntaxException;
2526

@@ -286,8 +287,11 @@ void testByteShortPaddedWithGarbage() throws IOException
286287
@Test
287288
void testFillOrder2() throws IOException, URISyntaxException
288289
{
289-
byte[] ba = new URI("https://issues.apache.org/jira/secure/attachment/12558110/Wing.tif").
290-
toURL().openStream().readAllBytes();
290+
byte[] ba;
291+
try (InputStream is = new URI("https://issues.apache.org/jira/secure/attachment/12558110/Wing.tif").toURL().openStream())
292+
{
293+
ba = is.readAllBytes();
294+
}
291295
PDDocument document = new PDDocument();
292296
PDImageXObject ximg = CCITTFactory.createFromByteArray(document, ba);
293297

0 commit comments

Comments
 (0)