29
29
import java .net .URISyntaxException ;
30
30
import java .net .URL ;
31
31
import java .net .http .HttpResponse ;
32
+ import java .nio .file .Files ;
32
33
import java .nio .file .Path ;
33
34
import java .util .ArrayList ;
34
35
import java .util .Collections ;
@@ -135,8 +136,10 @@ protected String call() throws TSSException {
135
136
136
137
private void saveFor (Utils .IOSVersion iosVersion , ArrayList <String > args ) throws TSSException {
137
138
final int urlIndex = args .size () - 1 ;
139
+ Path manifest ;
138
140
try {
139
- args .set (urlIndex , extractBuildManifest (iosVersion .ipswURL ()).toString ());
141
+ manifest = extractBuildManifest (iosVersion .ipswURL ());
142
+ args .set (urlIndex , manifest .toString ());
140
143
} catch (IOException e ) {
141
144
throw new TSSException ("Unable to extract BuildManifest." , true , e );
142
145
}
@@ -146,6 +149,15 @@ private void saveFor(Utils.IOSVersion iosVersion, ArrayList<String> args) throws
146
149
parseTSSLog (tssLog );
147
150
} catch (IOException e ) {
148
151
throw new TSSException ("There was an error starting tsschecker." , true , e );
152
+ } finally {
153
+ deleteIfPossible (manifest );
154
+ }
155
+ }
156
+
157
+ private void deleteIfPossible (Path file ) {
158
+ try {
159
+ Files .deleteIfExists (file );
160
+ } catch (IOException ignored ) {
149
161
}
150
162
}
151
163
@@ -232,7 +244,6 @@ private String getBoardConfig() {
232
244
return Utils .defaultIfNull (boardConfig , Devices .getBoardConfig (deviceIdentifier ));
233
245
}
234
246
235
- @ SuppressWarnings ("TextBlockMigration" )
236
247
private void parseTSSLog (String tsscheckerLog ) throws TSSException {
237
248
if (containsIgnoreCase (tsscheckerLog , "Saved shsh blobs" )) {
238
249
return ; // success
0 commit comments