Skip to content

Commit

Permalink
print notarize errors to the error stream and not to the debug stream
Browse files Browse the repository at this point in the history
  • Loading branch information
volker committed Jun 21, 2023
1 parent 582f961 commit e73e51a
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/com/inet/gradle/appbundler/OSXNotarize.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.gradle.api.internal.file.FileResolver;
import org.gradle.api.logging.Logger;

import com.inet.gradle.appbundler.utils.xmlwise.Plist;
import com.inet.gradle.appbundler.utils.xmlwise.XmlParseException;
Expand Down Expand Up @@ -167,30 +167,31 @@ private String requestNotarization( File notarizeFile ) {
ByteArrayOutputStream error = new ByteArrayOutputStream();
String output = exec( true, error, command.toArray( new String[command.size()] ) );
if( isDebugOutput() ) {
task.getProject().getLogger().debug( output );
task.getProject().getLogger().lifecycle( output );
}

try {
Map<String, Object> plist = Plist.fromXml( output );
return (String)plist.get( "id" );
} catch( ClassCastException | XmlParseException e ) {
task.getProject().getLogger().error( "An error occured while checking the noraization response." );
Logger logger = task.getProject().getLogger();
logger.error( "An error occured while checking the noraization response." );
if( !isDebugOutput() ) {
// Debug in addition
task.getProject().getLogger().error( "Debug output START:" );
task.getProject().getLogger().error( output );
task.getProject().getLogger().error( "Debug output END" );
logger.error( "Debug output START:" );
logger.error( output );
logger.error( "Debug output END" );
}

task.getProject().getLogger().debug( "The Error stream produced:" );
task.getProject().getLogger().debug( error.toString() );
logger.error( "The Error stream produced:" );
logger.error( error.toString() );

ByteArrayOutputStream bos = new ByteArrayOutputStream();
PrintStream stream = new PrintStream( bos );
e.printStackTrace( stream );
task.getProject().getLogger().debug( "This is the exception it produced:" );
task.getProject().getLogger().debug( bos.toString() );
task.getProject().getLogger().debug( "End of Output." );
logger.error( "This is the exception it produced:" );
logger.error( bos.toString() );
logger.error( "End of Output." );
}

return null;
Expand Down

0 comments on commit e73e51a

Please sign in to comment.