Buggy code:
public final class OldSaveService { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; static final String PRESERVE = "preserve" ; static final String XML_SPACE = "xml:space" ; private static final String ASSERTION_RESULT_TAG_NAME = "assertionResult" ; private static final String BINARY = "binary" ; private static final String DATA_TYPE = "dataType" ; private static final String ERROR = "error" ; private static final String FAILURE = "failure" ; private static final String FAILURE_MESSAGE = "failureMessage" ; private static final String LABEL = "label" ; private static final String RESPONSE_CODE = "responseCode" ; private static final String RESPONSE_MESSAGE = "responseMessage" ; private static final String SAMPLE_RESULT_TAG_NAME = "sampleResult" ; private static final String SUCCESSFUL = "success" ; private static final String THREAD_NAME = "threadName" ; private static final String TIME = "time" ; private static final String TIME_STAMP = "timeStamp" ; private static final String CSV_TIME = "elapsed" ; private static final String CSV_BYTES = "bytes" ; private static final String CSV_THREAD_COUNT1 = "grpThreads" ; private static final String CSV_THREAD_COUNT2 = "allThreads" ; private static final String CSV_URL = "URL" ; private static final String CSV_FILENAME = "Filename" ; private static final SampleSaveConfiguration _saveConfig = SampleSaveConfiguration . staticConfig ( ) ; private static DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder ( ) ; private OldSaveService ( ) { } public static SampleResult makeResultFromDelimitedString ( String inputLine ) { } public static SampleResult makeResultFromDelimitedString ( String inputLine , SampleSaveConfiguration saveConfig ) { } public static String printableFieldNamesToString ( ) { } public static String printableFieldNamesToString ( SampleSaveConfiguration saveConfig ) { } public static void saveCSVStats ( Vector data , FileWriter writer ) throws IOException { } public static String resultToDelimitedString ( SampleResult sample ) { } public static String resultToDelimitedString ( SampleResult sample , String delimiter ) { } public static void saveSubTree ( HashTree subTree , OutputStream writer ) throws IOException { } public static SampleResult getSampleResult ( Configuration config ) { SampleResult result = new SampleResult ( config . getAttributeAsLong ( OldSaveService . TIME_STAMP , 0L ) , config . getAttributeAsLong ( OldSaveService . TIME , 0L ) ) ; result . setThreadName ( config . getAttribute ( OldSaveService . THREAD_NAME , "" ) ) ; result . setDataType ( config . getAttribute ( OldSaveService . DATA_TYPE , "" ) ) ; result . setResponseCode ( config . getAttribute ( OldSaveService . RESPONSE_CODE , "" ) ) ; result . setResponseMessage ( config . getAttribute ( OldSaveService . RESPONSE_MESSAGE , "" ) ) ; result . setSuccessful ( config . getAttributeAsBoolean ( OldSaveService . SUCCESSFUL , false ) ) ; result . setSampleLabel ( config . getAttribute ( OldSaveService . LABEL , "" ) ) ; result . setResponseData ( OldSaveService . getBinaryData ( config . getChild ( OldSaveService . BINARY ) ) ) ; Configuration [ ] subResults = config . getChildren ( OldSaveService . SAMPLE_RESULT_TAG_NAME ) ; for ( int i = 0 ; i < ( subResults . length ) ; i ++ ) { <START_BUG> result . addSubResult ( OldSaveService . getSampleResult ( subResults [ i ] ) ) ; <END_BUG> } Configuration [ ] assResults = config . getChildren ( OldSaveService . ASSERTION_RESULT_TAG_NAME ) ; for ( int i = 0 ; i < ( assResults . length ) ; i ++ ) { result . addAssertionResult ( OldSaveService . getAssertionResult ( assResults [ i ] ) ) ; } Configuration [ ] samplerData = config . getChildren ( "property" ) ; for ( int i = 0 ; i < ( samplerData . length ) ; i ++ ) { result . setSamplerData ( samplerData [ i ] . getValue ( "" ) ) ; } return result ; } private static List getConfigsFromTree ( HashTree subTree ) { } public static Configuration getConfiguration ( byte [ ] bin ) { } public static byte [ ] getBinaryData ( Configuration config ) { } public static AssertionResult getAssertionResult ( Configuration config ) { } public static Configuration getConfiguration ( AssertionResult assResult ) { } public static Configuration getConfiguration ( SampleResult result , SampleSaveConfiguration saveConfig ) { } public static Configuration getConfigForTestElement ( String named , TestElement item ) { } private static Configuration createConfigForString ( String name , String value ) { } public static synchronized HashTree loadSubTree ( InputStream in ) throws IOException { } public static TestElement createTestElement ( Configuration config ) throws ClassNotFoundException , IllegalAccessException , InstantiationException , ConfigurationException { } private static Collection createCollection ( Configuration config , String testClass ) throws ClassNotFoundException , IllegalAccessException , InstantiationException , ConfigurationException { } private static JMeterProperty createProperty ( Configuration config , String testClass ) throws ClassNotFoundException , IllegalAccessException , InstantiationException { } private static Map createMap ( Configuration config , String testClass ) throws ClassNotFoundException , IllegalAccessException , InstantiationException , ConfigurationException { } private static HashTree generateNode ( Configuration config ) { } }

Fix:
result . storeSubResult ( OldSaveService . getSampleResult ( subResults [ i ] ) ) ;