From 89d27e58d3c59459b1f19d57b88bb675c8c46b53 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 20 Nov 2017 14:14:48 +0000 Subject: [PATCH] Close input stream after adding entry to jar in DevTools tests Closes gh-11089 --- .../devtools/tests/JarFileRemoteApplicationLauncher.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java index 8007298ed5c..2ee627b7a2a 100644 --- a/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java +++ b/spring-boot-integration-tests/spring-boot-devtools-tests/src/test/java/org/springframework/boot/devtools/tests/JarFileRemoteApplicationLauncher.java @@ -72,7 +72,13 @@ public class JarFileRemoteApplicationLauncher extends RemoteApplicationLauncher file.getAbsolutePath().substring(root.getAbsolutePath().length() + 1) .replace("\\", "/") + (file.isDirectory() ? "/" : ""))); if (file.isFile()) { - StreamUtils.copy(new FileInputStream(file), output); + FileInputStream input = new FileInputStream(file); + try { + StreamUtils.copy(input, output); + } + finally { + input.close(); + } } output.closeEntry(); }