Skip to content

Commit 3db0267

Browse files
committed
PDFBOX-5660: close input, as suggested by Valery Bokov; closes #341
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929846 13f79535-47bb-0310-9956-ffa450edef68
1 parent edd7b0d commit 3db0267

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

xmpbox/src/test/java/org/apache/xmpbox/schema/TestExifXmp.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import static org.junit.jupiter.api.Assertions.assertNotNull;
2626

2727
import java.io.ByteArrayOutputStream;
28+
import java.io.IOException;
2829
import org.apache.xmpbox.XMPMetadata;
2930
import org.apache.xmpbox.type.OECFType;
3031
import org.apache.xmpbox.type.TextType;
@@ -40,17 +41,18 @@
4041
class TestExifXmp
4142
{
4243
@Test
43-
void testNonStrict() throws XmpParsingException
44+
void testNonStrict() throws XmpParsingException, IOException
4445
{
45-
InputStream is = this.getClass().getResourceAsStream("/validxmp/exif.xmp");
46-
47-
DomXmpParser builder = new DomXmpParser();
48-
builder.setStrictParsing(false);
49-
XMPMetadata rxmp = builder.parse(is);
50-
ExifSchema schema = (ExifSchema)rxmp.getSchema(ExifSchema.class);
51-
TextType ss = (TextType)schema.getProperty(ExifSchema.SPECTRAL_SENSITIVITY);
52-
assertNotNull(ss);
53-
assertEquals("spectral sens value",ss.getValue());
46+
try (InputStream is = this.getClass().getResourceAsStream("/validxmp/exif.xmp"))
47+
{
48+
DomXmpParser builder = new DomXmpParser();
49+
builder.setStrictParsing(false);
50+
XMPMetadata rxmp = builder.parse(is);
51+
ExifSchema schema = (ExifSchema)rxmp.getSchema(ExifSchema.class);
52+
TextType ss = (TextType)schema.getProperty(ExifSchema.SPECTRAL_SENSITIVITY);
53+
assertNotNull(ss);
54+
assertEquals("spectral sens value",ss.getValue());
55+
}
5456
}
5557

5658
@Test

0 commit comments

Comments
 (0)