Buggy code:
public class BeanShellSampler extends BeanShellTestElement implements Sampler { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; private static final long serialVersionUID = 3 ; public static final String FILENAME = "BeanShellSampler.filename" ; public static final String SCRIPT = "BeanShellSampler.query" ; public static final String PARAMETERS = "BeanShellSampler.parameters" ; public static final String INIT_FILE = "beanshell.sampler.init" ; public static final String RESET_INTERPRETER = "BeanShellSampler.resetInterpreter" ; @ Override protected String getInitFileProperty ( ) { } public String getLabel ( ) { } @ Override public String getScript ( ) { } @ Override public String getFilename ( ) { } @ Override public String getParameters ( ) { } @ Override public boolean isResetInterpreter ( ) { } public SampleResult sample ( Entry e ) { SampleResult res = new SampleResult ( ) ; boolean isSuccessful = false ; res . setSampleLabel ( getLabel ( ) ) ; res . sampleStart ( ) ; final BeanShellInterpreter bshInterpreter = getBeanShellInterpreter ( ) ; if ( bshInterpreter == null ) { res . sampleEnd ( ) ; res . setResponseCode ( "503" ) ; res . setResponseMessage ( "BeanShell<seq2seq4repair_space>Interpreter<seq2seq4repair_space>not<seq2seq4repair_space>found" ) ; res . setSuccessful ( false ) ; return res ; } try { String request = getScript ( ) ; String fileName = getFilename ( ) ; if ( ( fileName . length ( ) ) == 0 ) { res . setSamplerData ( request ) ; } else { res . setSamplerData ( fileName ) ; } bshInterpreter . set ( "Label" , getLabel ( ) ) ; bshInterpreter . set ( "FileName" , getFilename ( ) ) ; bshInterpreter . set ( "SampleResult" , res ) ; bshInterpreter . set ( "Parameters" , getParameters ( ) ) ; bshInterpreter . set ( "bsh.args" , JOrphanUtils . split ( getParameters ( ) , "<seq2seq4repair_space>" ) ) ; bshInterpreter . set ( "ResponseCode" , "200" ) ; bshInterpreter . set ( "ResponseMessage" , "OK" ) ; bshInterpreter . set ( "IsSuccess" , true ) ; JMeterContext jmctx = JMeterContextService . getContext ( ) ; JMeterVariables vars = jmctx . getVariables ( ) ; bshInterpreter . set ( "ctx" , jmctx ) ; bshInterpreter . set ( "vars" , vars ) ; res . setDataType ( TEXT ) ; Object bshOut ; if ( ( fileName . length ( ) ) == 0 ) { bshOut = bshInterpreter . eval ( request ) ; } else { bshOut = bshInterpreter . source ( fileName ) ; } if ( bshOut != null ) { String out = bshOut . toString ( ) ; <START_BUG> res . setResponseData ( out . getBytes ( ) ) ; <END_BUG> } res . setResponseCode ( bshInterpreter . get ( "ResponseCode" ) . toString ( ) ) ; res . setResponseMessage ( bshInterpreter . get ( "ResponseMessage" ) . toString ( ) ) ; isSuccessful = Boolean . valueOf ( bshInterpreter . get ( "IsSuccess" ) . toString ( ) ) . booleanValue ( ) ; } catch ( NoClassDefFoundError ex ) { BeanShellSampler . log . error ( ( "BeanShell<seq2seq4repair_space>Jar<seq2seq4repair_space>missing?<seq2seq4repair_space>" + ( ex . toString ( ) ) ) ) ; res . setResponseCode ( "501" ) ; res . setResponseMessage ( ex . toString ( ) ) ; res . setStopThread ( true ) ; } catch ( Exception ex ) { BeanShellSampler . log . warn ( ex . toString ( ) ) ; res . setResponseCode ( "500" ) ; res . setResponseMessage ( ex . toString ( ) ) ; } res . sampleEnd ( ) ; res . setSuccessful ( isSuccessful ) ; return res ; } }

Fix:
res . setResponseData ( out , null ) ;