Skip to content

Commit 922232e

Browse files
authored
Merge pull request #1808 from PascalSchumacher/ExternalResources_getConfiguredTemplate_close_FileInputStream
ExternalResources#getConfiguredTemplate: Close FileInputStream.
2 parents 05bcce6 + 2f922a8 commit 922232e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/apache/ibatis/io/ExternalResources.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.io.FileNotFoundException;
2121
import java.io.FileOutputStream;
2222
import java.io.IOException;
23+
import java.io.InputStream;
2324
import java.util.Properties;
2425

2526
import org.apache.ibatis.logging.Log;
@@ -53,8 +54,8 @@ public static String getConfiguredTemplate(String templatePath, String templateP
5354
String templateName = "";
5455
Properties migrationProperties = new Properties();
5556

56-
try {
57-
migrationProperties.load(new FileInputStream(templatePath));
57+
try (InputStream is = new FileInputStream(templatePath)) {
58+
migrationProperties.load(is);
5859
templateName = migrationProperties.getProperty(templateProperty);
5960
} catch (FileNotFoundException e) {
6061
throw e;

0 commit comments

Comments
 (0)