Skip to content

Commit 13df798

Browse files
committed
PDFBOX-6104: close document
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929967 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2a5e3a9 commit 13df798

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pdfbox/src/test/java/org/apache/pdfbox/pdmodel/fdf/FDFAnnotationTest.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ void testAnnotationWidth() throws IOException
109109

110110
ByteArrayInputStream inputStream = new ByteArrayInputStream(xfdf.getBytes(StandardCharsets.UTF_8));
111111

112-
FDFDocument fdfDoc = Loader.loadXFDF(inputStream);
113-
List<FDFAnnotation> fdfAnnots = fdfDoc.getCatalog().getFDF().getAnnotations();
114-
assertEquals(1, fdfAnnots.size());
115-
116-
FDFAnnotation annot = fdfAnnots.get(0);
117-
assertNotNull(annot.getBorderStyle());
118-
assertEquals(0f, annot.getBorderStyle().getWidth(), 0.01f);
112+
try (FDFDocument fdfDoc = Loader.loadXFDF(inputStream))
113+
{
114+
List<FDFAnnotation> fdfAnnots = fdfDoc.getCatalog().getFDF().getAnnotations();
115+
assertEquals(1, fdfAnnots.size());
116+
117+
FDFAnnotation annot = fdfAnnots.get(0);
118+
assertNotNull(annot.getBorderStyle());
119+
assertEquals(0f, annot.getBorderStyle().getWidth(), 0.01f);
120+
}
119121
}
120122

121123
}

0 commit comments

Comments
 (0)