mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Close streams when unpacking the CLI
See gh-9080
This commit is contained in:
parent
2f26088800
commit
08143edf19
@ -80,20 +80,31 @@ public final class CommandLineInvoker {
|
|||||||
|
|
||||||
})[0];
|
})[0];
|
||||||
ZipInputStream input = new ZipInputStream(new FileInputStream(zip));
|
ZipInputStream input = new ZipInputStream(new FileInputStream(zip));
|
||||||
ZipEntry entry;
|
try {
|
||||||
while ((entry = input.getNextEntry()) != null) {
|
ZipEntry entry;
|
||||||
File file = new File(unpacked, entry.getName());
|
while ((entry = input.getNextEntry()) != null) {
|
||||||
if (entry.isDirectory()) {
|
File file = new File(unpacked, entry.getName());
|
||||||
file.mkdirs();
|
if (entry.isDirectory()) {
|
||||||
}
|
file.mkdirs();
|
||||||
else {
|
}
|
||||||
file.getParentFile().mkdirs();
|
else {
|
||||||
StreamUtils.copy(input, new FileOutputStream(file));
|
file.getParentFile().mkdirs();
|
||||||
if (entry.getName().endsWith("/bin/spring")) {
|
FileOutputStream output = new FileOutputStream(file);
|
||||||
file.setExecutable(true);
|
try {
|
||||||
|
StreamUtils.copy(input, output);
|
||||||
|
if (entry.getName().endsWith("/bin/spring")) {
|
||||||
|
file.setExecutable(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
output.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
input.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File bin = new File(unpacked.listFiles()[0], "bin");
|
File bin = new File(unpacked.listFiles()[0], "bin");
|
||||||
File launchScript = new File(bin, isWindows() ? "spring.bat" : "spring");
|
File launchScript = new File(bin, isWindows() ? "spring.bat" : "spring");
|
||||||
|
Loading…
Reference in New Issue
Block a user