private void encodeAndWriteToTarget( String string ) { byte[] encodeBytes = encodeStringForForkCommunication( string ); synchronized ( target ) // See notes about synchronization/thread safety in class javadoc { target.write( encodeBytes, 0, encodeBytes.length ); target.flush(); if ( target.checkError() ) { // We MUST NOT throw any exception from this method; otherwise we are in loop and CPU goes up: // ForkingRunListener -> Exception -> JUnit Notifier and RunListener -> ForkingRunListener -> Exception DumpErrorSingleton.getSingleton().dumpStreamText( "Unexpected IOException: " + string ); } } }
private void encodeAndWriteToTarget( String string ) { byte[] encodeBytes = encodeStringForForkCommunication( string ); synchronized ( target ) // See notes about synchronization/thread safety in class javadoc { target.write( encodeBytes, 0, encodeBytes.length ); target.flush(); if ( target.checkError() ) { // We MUST NOT throw any exception from this method; otherwise we are in loop and CPU goes up: // ForkingRunListener -> Exception -> JUnit Notifier and RunListener -> ForkingRunListener -> Exception DumpErrorSingleton.getSingleton().dumpStreamText( "Unexpected IOException: " + string ); } } }
@Override public void writeTestOutput( byte[] buf, int off, int len, boolean stdout ) { EncodedArray encodedArray = escapeBytesToPrintable( stdout ? stdOutHeader : stdErrHeader, buf, off, len ); synchronized ( target ) // See notes about synchronization/thread safety in class javadoc { target.write( encodedArray.getArray(), 0, encodedArray.getSize() ); target.flush(); if ( target.checkError() ) { // We MUST NOT throw any exception from this method; otherwise we are in loop and CPU goes up: // ForkingRunListener -> Exception -> JUnit Notifier and RunListener -> ForkingRunListener -> Exception DumpErrorSingleton.getSingleton() .dumpStreamText( "Unexpected IOException with stream: " + new String( buf, off, len ) ); } } }
@Override public void writeTestOutput( byte[] buf, int off, int len, boolean stdout ) { EncodedArray encodedArray = escapeBytesToPrintable( stdout ? stdOutHeader : stdErrHeader, buf, off, len ); synchronized ( target ) // See notes about synchronization/thread safety in class javadoc { target.write( encodedArray.getArray(), 0, encodedArray.getSize() ); target.flush(); if ( target.checkError() ) { // We MUST NOT throw any exception from this method; otherwise we are in loop and CPU goes up: // ForkingRunListener -> Exception -> JUnit Notifier and RunListener -> ForkingRunListener -> Exception DumpErrorSingleton.getSingleton() .dumpStreamText( "Unexpected IOException with stream: " + new String( buf, off, len ) ); } } }
DumpErrorSingleton.getSingleton().dumpStreamText( errorMessage ); logger.error( errorMessage ); break;
DumpErrorSingleton.getSingleton().dumpStreamText( errorMessage ); logger.error( errorMessage ); break;