Skip to content

Commit 89d27e5

Browse files
committed
Close input stream after adding entry to jar in DevTools tests
Closes gh-11089
1 parent 85dc89e commit 89d27e5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ private void addToJar(JarOutputStream output, File root, File current)
7272
file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1)
7373
.replace("\\", "/") + (file.isDirectory() ? "/" : "")));
7474
if (file.isFile()) {
75-
StreamUtils.copy(new FileInputStream(file), output);
75+
FileInputStream input = new FileInputStream(file);
76+
try {
77+
StreamUtils.copy(input, output);
78+
}
79+
finally {
80+
input.close();
81+
}
7682
}
7783
output.closeEntry();
7884
}

0 commit comments

Comments
 (0)