@@ -268,11 +268,12 @@ private void waitWithStatus( String status ) throws InterruptedException {
268268 @ SuppressWarnings ( "unchecked" )
269269 private boolean waitForNotarization ( String UUID ) {
270270
271+ String output = "" ;
271272 int acceptedFailureCount = 5 ;
272273 List <String > lastErrors = new ArrayList <>();
273274
274- try {
275- while ( true && acceptedFailureCount > 0 ) {
275+ while ( true && acceptedFailureCount > 0 ) {
276+ try {
276277
277278 ArrayList <String > command = new ArrayList <>();
278279 command .add ( "xcrun" );
@@ -281,7 +282,7 @@ private boolean waitForNotarization( String UUID ) {
281282 command .add ( UUID );
282283 addDefaultOptionsToXCRunCommand ( command );
283284
284- String output = exec ( command .toArray ( new String [command .size ()] ) );
285+ output = exec ( command .toArray ( new String [command .size ()] ) );
285286 task .getProject ().getLogger ().debug ( output );
286287
287288 Map <String , Object > plist = Plist .fromXml ( output );
@@ -311,9 +312,15 @@ private boolean waitForNotarization( String UUID ) {
311312 }
312313
313314 waitWithStatus ( status );
315+ } catch ( ClassCastException | XmlParseException | InterruptedException e ) {
316+ lastErrors .add ( e .getMessage () );
317+ lastErrors .add ( output + "\n \n " );
318+ try {
319+ waitWithStatus ( null );
320+ } catch ( InterruptedException ie ) {
321+ // ignore
322+ }
314323 }
315- } catch ( ClassCastException | XmlParseException | InterruptedException e ) {
316- throw new IllegalArgumentException ( e );
317324 }
318325
319326 throw new IllegalArgumentException ( String .join ( "\n " , lastErrors ) );
0 commit comments