Buggy code:
public class SampleResult implements Serializable { static final Logger log = LoggingManager . getLoggerForClass ( ) ; private static final String DEFAULT_ENCODING = JMeterUtils . getPropDefault ( "sampleresult.default.encoding" , "ISO-8859-1" ) ; public static final String TEXT = "text" ; public static final String BINARY = "bin" ; private static final byte [ ] EMPTY_BA = new byte [ 0 ] ; private static final SampleResult [ ] EMPTY_SR = new SampleResult [ 0 ] ; private static final AssertionResult [ ] EMPTY_AR = new AssertionResult [ 0 ] ; private SampleSaveConfiguration saveConfig ; private SampleResult parent = null ; public void setSaveConfig ( SampleSaveConfiguration propertiesToSave ) { } public SampleSaveConfiguration getSaveConfig ( ) { } private byte [ ] responseData = SampleResult . EMPTY_BA ; private String responseCode ; private String label ; private String samplerData ; private String threadName = "" ; private String responseMessage = "" ; private String responseHeaders = "" ; private String contentType = "" ; private String requestHeaders = "" ; private long timeStamp = 0 ; private long startTime = 0 ; private long endTime = 0 ; private long idleTime = 0 ; private long pauseTime = 0 ; private List assertionResults ; private List subResults ; private String dataType = "" ; private boolean success ; private Set files ; private String dataEncoding ; private long time = 0 ; private long latency = 0 ; private boolean stopThread = false ; private boolean stopTest = false ; private boolean isMonitor = false ; private int sampleCount = 1 ; private int bytes = 0 ; private static final String TOTAL_TIME = "totalTime" ; private static final boolean startTimeStamp = JMeterUtils . getPropDefault ( "sampleresult.timestamp.start" , false ) ; public SampleResult ( ) { } public SampleResult ( SampleResult res ) { } public boolean isStampedAtStart ( ) { } protected SampleResult ( long elapsed , boolean atend ) { } public static SampleResult createTestSample ( long start , long end ) { } public static SampleResult createTestSample ( long elapsed ) { } public SampleResult ( long stamp , long elapsed ) { } public void setTime ( long elapsed ) { } private void setElapsed ( long elapsed ) { } public void setMarked ( String filename ) { } public boolean isMarked ( String filename ) { } public String getResponseCode ( ) { } private static final String OK = Integer . toString ( HttpURLConnection . HTTP_OK ) ; public void setResponseCodeOK ( ) { } public void setResponseCode ( String code ) { } public boolean isResponseCodeOK ( ) { } public String getResponseMessage ( ) { } public void setResponseMessage ( String msg ) { } public String getThreadName ( ) { } public void setThreadName ( String threadName ) { } public long getTimeStamp ( ) { } public String getSampleLabel ( ) { } public void setSampleLabel ( String label ) { } public void addAssertionResult ( AssertionResult assertResult ) { } public AssertionResult [ ] getAssertionResults ( ) { } public void addSubResult ( SampleResult subResult ) { } public SampleResult [ ] getSubResults ( ) { } public void configure ( Configuration info ) { } public void setResponseData ( byte [ ] response ) { } public void setResponseData ( String response ) { } public byte [ ] getResponseData ( ) { } public String getResponseDataAsString ( ) { } public byte [ ] getResponseDataAsBA ( ) { } public void setSamplerData ( String s ) { } public String getSamplerData ( ) { } public long getTime ( ) { } public boolean isSuccessful ( ) { } public void setDataType ( String dataType ) { } public String getDataType ( ) { } public void setSuccessful ( boolean success ) { } public String toString ( ) { } public String getDataEncoding ( ) { } public void setDataEncoding ( String dataEncoding ) { } public boolean isStopTest ( ) { } public boolean isStopThread ( ) { } public void setStopTest ( boolean b ) { } public void setStopThread ( boolean b ) { } public String getRequestHeaders ( ) { } public String getResponseHeaders ( ) { } public void setRequestHeaders ( String string ) { } public void setResponseHeaders ( String string ) { } public String getContentType ( ) { } public void setContentType ( String string ) { } public long getIdleTime ( ) { } public long getEndTime ( ) { } public long getStartTime ( ) { } protected final void setStartTime ( long start ) { } protected void setEndTime ( long end ) { } private void setTimes ( long start , long end ) { } public void sampleStart ( ) { } public void sampleEnd ( ) { } public void samplePause ( ) { } public void sampleResume ( ) { } public void setMonitor ( boolean monitor ) { } public boolean isMonitor ( ) { } public void setSampleCount ( int count ) { } public int getSampleCount ( ) { } public void setBytes ( int length ) { } public int getBytes ( ) { <START_BUG> return bytes ; <END_BUG> } public long getLatency ( ) { } public void latencyEnd ( ) { } public void setLatency ( long latency ) { } public void setTimeStamp ( long timeStamp ) { } private URL location ; public void setURL ( URL location ) { } public URL getURL ( ) { } public SampleResult getParent ( ) { } public void setParent ( SampleResult parent ) { } }

Fix:
return ( bytes ) == 0 ? responseData . length : bytes ;