Skip to content

Commit 47ed5a7

Browse files
committed
GifTest: close file stream
RND-708
1 parent 4da87ce commit 47ed5a7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

io/src/test/java/com/itextpdf/io/image/GifTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ This file is part of the iText (R) project.
4040
For more information, please contact iText Software Corp. at this
4141
4242
*/
43-
4443
package com.itextpdf.io.image;
4544

4645
import com.itextpdf.io.util.StreamUtil;
@@ -51,16 +50,18 @@ This file is part of the iText (R) project.
5150

5251
import java.io.FileInputStream;
5352
import java.io.IOException;
53+
5454
@Category(UnitTest.class)
5555
public class GifTest {
5656
public static final String sourceFolder = "./src/test/resources/com/itextpdf/io/image/";
5757

5858
@Test
5959
public void gifImageTest() throws IOException {
60-
byte[] fileContent = StreamUtil.inputStreamToArray( new FileInputStream( sourceFolder+"WP_20140410_001.gif" ) );
61-
ImageData img = ImageDataFactory.create( fileContent, false );
62-
Assert.assertTrue( img.isRawImage() );
63-
Assert.assertEquals( ImageType.GIF, img.getOriginalType() );
64-
60+
try (FileInputStream file = new FileInputStream(sourceFolder + "WP_20140410_001.gif")) {
61+
byte[] fileContent = StreamUtil.inputStreamToArray(file);
62+
ImageData img = ImageDataFactory.create(fileContent, false);
63+
Assert.assertTrue(img.isRawImage());
64+
Assert.assertEquals(ImageType.GIF, img.getOriginalType());
65+
}
6566
}
6667
}

0 commit comments

Comments
 (0)