Skip to content

Commit 0fbe903

Browse files
committed
Merge branch '1.5.x'
2 parents 9ea4612 + 832b3d1 commit 0fbe903

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure/CommandLineInvoker.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,31 @@ public boolean accept(File pathname) {
8080

8181
})[0];
8282
ZipInputStream input = new ZipInputStream(new FileInputStream(zip));
83-
ZipEntry entry;
84-
while ((entry = input.getNextEntry()) != null) {
85-
File file = new File(unpacked, entry.getName());
86-
if (entry.isDirectory()) {
87-
file.mkdirs();
88-
}
89-
else {
90-
file.getParentFile().mkdirs();
91-
StreamUtils.copy(input, new FileOutputStream(file));
92-
if (entry.getName().endsWith("/bin/spring")) {
93-
file.setExecutable(true);
83+
try {
84+
ZipEntry entry;
85+
while ((entry = input.getNextEntry()) != null) {
86+
File file = new File(unpacked, entry.getName());
87+
if (entry.isDirectory()) {
88+
file.mkdirs();
89+
}
90+
else {
91+
file.getParentFile().mkdirs();
92+
FileOutputStream output = new FileOutputStream(file);
93+
try {
94+
StreamUtils.copy(input, output);
95+
if (entry.getName().endsWith("/bin/spring")) {
96+
file.setExecutable(true);
97+
}
98+
}
99+
finally {
100+
output.close();
101+
}
94102
}
95103
}
96104
}
105+
finally {
106+
input.close();
107+
}
97108
}
98109
File bin = new File(unpacked.listFiles()[0], "bin");
99110
File launchScript = new File(bin, isWindows() ? "spring.bat" : "spring");

0 commit comments

Comments
 (0)