2525import static org .junit .jupiter .api .Assertions .assertFalse ;
2626import static org .junit .jupiter .api .Assertions .assertEquals ;
2727
28-
28+ import java . io . IOException ;
2929import java .io .InputStream ;
3030import java .util .stream .Stream ;
31- import org .apache .xmpbox .type .BadFieldValueException ;
32-
3331
32+ import org .apache .xmpbox .type .BadFieldValueException ;
3433import org .apache .xmpbox .xml .DomXmpParser ;
3534import org .apache .xmpbox .xml .XmpParsingException ;
3635import org .junit .jupiter .params .ParameterizedTest ;
@@ -49,13 +48,15 @@ static Stream<Arguments> initializeParameters()
4948 @ ParameterizedTest
5049 @ MethodSource ("initializeParameters" )
5150 void main (String path , String namespace , String propertyName , String propertyValue )
52- throws XmpParsingException , BadFieldValueException
51+ throws XmpParsingException , BadFieldValueException , IOException
5352 {
54- InputStream is = this .getClass ().getResourceAsStream (path );
55-
5653 DomXmpParser builder = new DomXmpParser ();
5754 builder .setStrictParsing (false );
58- XMPMetadata rxmp = builder .parse (is );
55+ XMPMetadata rxmp ;
56+ try (InputStream is = this .getClass ().getResourceAsStream (path ))
57+ {
58+ rxmp = builder .parse (is );
59+ }
5960 // ensure basic parsing was OK
6061 assertFalse (rxmp .getAllSchemas ().isEmpty (), "There should be a least one schema" );
6162 assertNotNull (rxmp .getSchema (namespace ), "The schema for {" + namespace + "} should be available" );
0 commit comments