Skip to content

Commit 16fb93d

Browse files
committed
1 parent a2d10ad commit 16fb93d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,23 @@ private void lazyInitializeDrivers() {
276276
}
277277

278278
protected Properties environmentProperties() {
279+
FileInputStream fileInputStream = null;
279280
try {
280281
File file = existingEnvironmentFile();
281282
Properties props = new Properties();
282-
props.load(new FileInputStream(file));
283+
fileInputStream = new FileInputStream(file);
284+
props.load(fileInputStream);
283285
return props;
284286
} catch (IOException e) {
285287
throw new MigrationException("Error loading environment properties. Cause: " + e, e);
288+
} finally {
289+
if (fileInputStream != null) {
290+
try {
291+
fileInputStream.close();
292+
} catch (IOException e) {
293+
//Nothing to do here
294+
}
295+
}
286296
}
287297
}
288298

src/test/java/org/apache/ibatis/migration/MigratorTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public void write(int b) throws IOException {
194194
// out.write(b);
195195
}
196196

197+
@Override
197198
public String toString() {
198199
return builder.toString();
199200
}

0 commit comments

Comments
 (0)