2929import java .net .URISyntaxException ;
3030import java .net .URL ;
3131import java .net .http .HttpResponse ;
32+ import java .nio .file .Files ;
3233import java .nio .file .Path ;
3334import java .util .ArrayList ;
3435import java .util .Collections ;
@@ -135,8 +136,10 @@ protected String call() throws TSSException {
135136
136137 private void saveFor (Utils .IOSVersion iosVersion , ArrayList <String > args ) throws TSSException {
137138 final int urlIndex = args .size () - 1 ;
139+ Path manifest ;
138140 try {
139- args .set (urlIndex , extractBuildManifest (iosVersion .ipswURL ()).toString ());
141+ manifest = extractBuildManifest (iosVersion .ipswURL ());
142+ args .set (urlIndex , manifest .toString ());
140143 } catch (IOException e ) {
141144 throw new TSSException ("Unable to extract BuildManifest." , true , e );
142145 }
@@ -146,6 +149,15 @@ private void saveFor(Utils.IOSVersion iosVersion, ArrayList<String> args) throws
146149 parseTSSLog (tssLog );
147150 } catch (IOException e ) {
148151 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 ) {
149161 }
150162 }
151163
@@ -232,7 +244,6 @@ private String getBoardConfig() {
232244 return Utils .defaultIfNull (boardConfig , Devices .getBoardConfig (deviceIdentifier ));
233245 }
234246
235- @ SuppressWarnings ("TextBlockMigration" )
236247 private void parseTSSLog (String tsscheckerLog ) throws TSSException {
237248 if (containsIgnoreCase (tsscheckerLog , "Saved shsh blobs" )) {
238249 return ; // success
0 commit comments