File tree Expand file tree Collapse file tree 1 file changed +22
-11
lines changed
spring-boot-cli/src/it/java/org/springframework/boot/cli/infrastructure Expand file tree Collapse file tree 1 file changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -80,20 +80,31 @@ public boolean accept(File pathname) {
80
80
81
81
})[0 ];
82
82
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
+ }
94
102
}
95
103
}
96
104
}
105
+ finally {
106
+ input .close ();
107
+ }
97
108
}
98
109
File bin = new File (unpacked .listFiles ()[0 ], "bin" );
99
110
File launchScript = new File (bin , isWindows () ? "spring.bat" : "spring" );
You can’t perform that action at this time.
0 commit comments