Skip to content

Commit edd7b0d

Browse files
committed
PDFBOX-5660: close input, as suggested by Valery Bokov
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1929842 13f79535-47bb-0310-9956-ffa450edef68
1 parent 35c02df commit edd7b0d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pdfbox/src/main/java/org/apache/pdfbox/Loader.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static FDFDocument loadFDF(InputStream input) throws IOException
119119
*/
120120
public static FDFDocument loadXFDF(String filename) throws IOException
121121
{
122-
return Loader.loadXFDF(new BufferedInputStream(new FileInputStream(filename)));
122+
return Loader.loadXFDF(new File(filename));
123123
}
124124

125125
/**
@@ -133,7 +133,10 @@ public static FDFDocument loadXFDF(String filename) throws IOException
133133
*/
134134
public static FDFDocument loadXFDF(File file) throws IOException
135135
{
136-
return Loader.loadXFDF(new BufferedInputStream(new FileInputStream(file)));
136+
try (InputStream is = new BufferedInputStream(new FileInputStream(file)))
137+
{
138+
return Loader.loadXFDF(is);
139+
}
137140
}
138141

139142
/**

0 commit comments

Comments
 (0)