Buggy code:
public class ResultSaver extends AbstractTestElement implements Serializable , SampleListener { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; private static final long serialVersionUID = 240L ; private static final Object LOCK = new Object ( ) ; private static long sequenceNumber = 0 ; private static String timeStamp ; private static final String TIMESTAMP_FORMAT = "yyyyMMdd-HHmm_" ; private static int numberPadLength ; public static final String FILENAME = "FileSaver.filename" ; public static final String VARIABLE_NAME = "FileSaver.variablename" ; public static final String ERRORS_ONLY = "FileSaver.errorsonly" ; public static final String SUCCESS_ONLY = "FileSaver.successonly" ; public static final String SKIP_AUTO_NUMBER = "FileSaver.skipautonumber" ; public static final String SKIP_SUFFIX = "FileSaver.skipsuffix" ; public static final String ADD_TIMESTAMP = "FileSaver.addTimstamp" ; public static final String NUMBER_PAD_LENGTH = "FileSaver.numberPadLen" ; private synchronized long nextNumber ( ) { } public ResultSaver ( ) { } public ResultSaver ( String name ) { } @ Override public void clear ( ) { } @ Override public void sampleOccurred ( SampleEvent e ) { } private void processSample ( SampleResult s , ResultSaver . Counter c ) { } private void saveSample ( SampleResult s , int num ) { if ( s . isSuccessful ( ) ) { if ( getErrorsOnly ( ) ) { return ; } } else { if ( getSuccessOnly ( ) ) { return ; } } String fileName = makeFileName ( s . getContentType ( ) , getSkipAutoNumber ( ) , getSkipSuffix ( ) ) ; ResultSaver . log . debug ( ( ( ( "Saving<seq2seq4repair_space>" + ( s . getSampleLabel ( ) ) ) + "<seq2seq4repair_space>in<seq2seq4repair_space>" ) + fileName ) ) ; s . setResultFileName ( fileName ) ; String variable = getVariableName ( ) ; if ( ( variable . length ( ) ) > 0 ) { if ( num > 0 ) { StringBuilder sb = new StringBuilder ( variable ) ; sb . append ( num ) ; variable = sb . toString ( ) ; } JMeterContextService . getContext ( ) . getVariables ( ) . put ( variable , fileName ) ; } File out = new File ( fileName ) ; FileOutputStream pw = null ; try { pw = new FileOutputStream ( out ) ; <START_BUG> pw . write ( s . getResponseData ( ) ) ; <END_BUG> } catch ( FileNotFoundException e1 ) { ResultSaver . log . error ( ( "Error<seq2seq4repair_space>creating<seq2seq4repair_space>sample<seq2seq4repair_space>file<seq2seq4repair_space>for<seq2seq4repair_space>" + ( s . getSampleLabel ( ) ) ) , e1 ) ; } catch ( IOException e1 ) { ResultSaver . log . error ( ( "Error<seq2seq4repair_space>saving<seq2seq4repair_space>sample<seq2seq4repair_space>" + ( s . getSampleLabel ( ) ) ) , e1 ) ; } finally { JOrphanUtils . closeQuietly ( pw ) ; } } private String makeFileName ( String contentType , boolean skipAutoNumber , boolean skipSuffix ) { } @ Override public void sampleStarted ( SampleEvent e ) { } @ Override public void sampleStopped ( SampleEvent e ) { } private String getFilename ( ) { } private String getVariableName ( ) { } private boolean getErrorsOnly ( ) { } private boolean getSkipAutoNumber ( ) { } private boolean getSkipSuffix ( ) { } private boolean getSuccessOnly ( ) { } private boolean getAddTimeStamp ( ) { } private int getNumberPadLen ( ) { } private static class Counter { int num ; } }

Fix:
JOrphanUtils . write ( s . getResponseData ( ) , pw ) ;