Buggy code:
public class ResponseAssertion extends AbstractTestElement implements Serializable , Assertion { public static final String TEST_FIELD = "Assertion.test_field" ; public static final String SAMPLE_LABEL = "Assertion.sample_label" ; public static final String RESPONSE_DATA = "Assertion.response_data" ; public static final String RESPONSE_CODE = "Assertion.response_code" ; public static final String RESPONSE_MESSAGE = "Assertion.response_message" ; public static final String TEST_STRINGS = "Asserion.test_strings" ; public static final String TEST_TYPE = "Assertion.test_type" ; public static final int MATCH = 1 << 0 ; public static final int CONTAINS = 1 << 1 ; public static final int NOT = 1 << 2 ; private static ThreadLocal matcher = new ThreadLocal ( ) { protected Object initialValue ( ) { } } ; private static PatternCacheLRU patternCache = new PatternCacheLRU ( 1000 , new Perl5Compiler ( ) ) ; public ResponseAssertion ( ) { } public ResponseAssertion ( String field , int type , String string ) { } public void clear ( ) { } public void setTestField ( String testField ) { } public void setTestType ( int testType ) { } public void addTestString ( String testString ) { } public void setTestString ( String testString , int index ) { } public void removeTestString ( String testString ) { } public void removeTestString ( int index ) { } public void clearTestStrings ( ) { } public AssertionResult getResult ( SampleResult response ) { } public String getTestField ( ) { } public int getTestType ( ) { } public CollectionProperty getTestStrings ( ) { } public boolean isContainsType ( ) { } public boolean isMatchType ( ) { } public boolean isNotType ( ) { } public void setToContainsType ( ) { } public void setToMatchType ( ) { } public void setToNotType ( ) { } public void unsetNotType ( ) { } private AssertionResult evaluateResponse ( SampleResult response ) { boolean pass = true ; boolean not = ( ( ResponseAssertion . NOT ) & ( getTestType ( ) ) ) > 0 ; AssertionResult result = new AssertionResult ( ) ; String toCheck = "" ; if ( ResponseAssertion . RESPONSE_DATA . equals ( getTestField ( ) ) ) { <START_BUG> toCheck = new String ( response . responseDataAsBA ( ) ) ; <END_BUG> } else if ( ResponseAssertion . RESPONSE_CODE . equals ( getTestField ( ) ) ) { toCheck = response . getResponseCode ( ) ; } else if ( ResponseAssertion . RESPONSE_MESSAGE . equals ( getTestField ( ) ) ) { toCheck = response . getResponseMessage ( ) ; } else { toCheck = response . getSamplerData ( ) ; if ( toCheck == null ) toCheck = "" ; } if ( ( toCheck . length ( ) ) == 0 ) { return setResultForNull ( result ) ; } try { Perl5Matcher localMatcher = ( ( Perl5Matcher ) ( ResponseAssertion . matcher . get ( ) ) ) ; PropertyIterator iter = getTestStrings ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { String stringPattern = iter . next ( ) . getStringValue ( ) ; Pattern pattern = ResponseAssertion . patternCache . getPattern ( stringPattern , READ_ONLY_MASK ) ; boolean found ; if ( ( ( ResponseAssertion . CONTAINS ) & ( getTestType ( ) ) ) > 0 ) { found = localMatcher . contains ( toCheck , pattern ) ; } else { found = localMatcher . matches ( toCheck , pattern ) ; } pass = ( not ) ? ! found : found ; if ( ! pass ) { result . setFailure ( true ) ; result . setFailureMessage ( getFailText ( stringPattern ) ) ; break ; } } if ( pass ) { result . setFailure ( false ) ; } result . setError ( false ) ; } catch ( MalformedCachePatternException e ) { result . setError ( true ) ; result . setFailure ( false ) ; result . setFailureMessage ( ( "Bad<seq2seq4repair_space>test<seq2seq4repair_space>configuration" + e ) ) ; } return result ; } private String getFailText ( String stringPattern ) { } protected AssertionResult setResultForNull ( AssertionResult result ) { } public static class Test extends TestCase { int threadsRunning ; int failed ; public Test ( String name ) { } public void testThreadSafety ( ) throws Exception { } class TestThread extends Thread { static final String TEST_STRING = "DAbale<seq2seq4repair_space>arroz<seq2seq4repair_space>a<seq2seq4repair_space>la<seq2seq4repair_space>zorra<seq2seq4repair_space>el<seq2seq4repair_space>abad." ; static final String TEST_PATTERN = ".*A.*\\." ; public void run ( ) { } } } }

Fix:
toCheck = new StringBuffer ( response . getResponseHeaders ( ) ) . append ( new String ( response . responseDataAsBA ( ) ) ) . toString ( ) ;