@@ -213,7 +213,8 @@ private String requestNotarization( File notarizeFile ) {
213213 command .add ( notarizeFile .getName () );
214214 addDefaultOptionsToXCRunCommand ( command );
215215
216- String output = exec ( command .toArray ( new String [command .size ()] ) );
216+ ByteArrayOutputStream error = new ByteArrayOutputStream ();
217+ String output = exec ( true , error , command .toArray ( new String [command .size ()] ) );
217218 if ( isDebugOutput () ) {
218219 task .getProject ().getLogger ().debug ( output );
219220 }
@@ -231,15 +232,23 @@ private String requestNotarization( File notarizeFile ) {
231232 return (String )plist .computeIfPresent ( "notarization-upload" , ( String key , Object value ) -> ((Map <String , String >)value ).get ( "RequestUUID" ) );
232233
233234 } catch ( ClassCastException | XmlParseException e ) {
235+ task .getProject ().getLogger ().error ( "An error occured while checking the noraization response." );
234236 if ( !isDebugOutput () ) {
235237 // Debug in addition
238+ task .getProject ().getLogger ().error ( "Debug output START:" );
236239 task .getProject ().getLogger ().error ( output );
240+ task .getProject ().getLogger ().error ( "Debug output END" );
237241 }
238242
243+ task .getProject ().getLogger ().debug ( "The Error stream produced:" );
244+ task .getProject ().getLogger ().debug ( error .toString () );
245+
239246 ByteArrayOutputStream bos = new ByteArrayOutputStream ();
240247 PrintStream stream = new PrintStream ( bos );
241248 e .printStackTrace ( stream );
249+ task .getProject ().getLogger ().debug ( "This is the exception it produced:" );
242250 task .getProject ().getLogger ().debug ( bos .toString () );
251+ task .getProject ().getLogger ().debug ( "End of Output." );
243252 }
244253
245254 return null ;
@@ -273,6 +282,8 @@ private boolean waitForNotarization( String UUID ) {
273282 List <String > lastErrors = new ArrayList <>();
274283
275284 while ( true && acceptedFailureCount > 0 ) {
285+
286+ ByteArrayOutputStream error = new ByteArrayOutputStream ();
276287 try {
277288
278289 ArrayList <String > command = new ArrayList <>();
@@ -282,7 +293,7 @@ private boolean waitForNotarization( String UUID ) {
282293 command .add ( UUID );
283294 addDefaultOptionsToXCRunCommand ( command );
284295
285- output = exec ( command .toArray ( new String [command .size ()] ) );
296+ output = exec ( true , error , command .toArray ( new String [command .size ()] ) );
286297 task .getProject ().getLogger ().debug ( output );
287298
288299 Map <String , Object > plist = Plist .fromXml ( output );
@@ -314,6 +325,11 @@ private boolean waitForNotarization( String UUID ) {
314325 waitWithStatus ( status );
315326 } catch ( ClassCastException | XmlParseException | InterruptedException e ) {
316327 lastErrors .add ( e .getMessage () );
328+
329+ lastErrors .add ( "The Error stream produced:\n " );
330+ lastErrors .add ( error .toString () + "\n " );
331+
332+ lastErrors .add ( "Output:\n " );
317333 lastErrors .add ( output + "\n \n " );
318334 try {
319335 waitWithStatus ( null );
0 commit comments