Buggy code:
public class LDAPSampler extends AbstractSampler { private static transient Logger log = LoggingManager . getLoggerForClass ( ) ; public static final String SERVERNAME = "servername" ; public static final String PORT = "port" ; public static final String ROOTDN = "rootdn" ; public static final String TEST = "test" ; public static final String ADD = "add" ; public static final String MODIFY = "modify" ; public static final String DELETE = "delete" ; public static final String SEARCHBASE = "search" ; public static final String SEARCHFILTER = "searchfilter" ; public static final String USER_DEFINED = "user_defined" ; public static final String ARGUMENTS = "arguments" ; public static final String BASE_ENTRY_DN = "base_entry_dn" ; private static int counter = 0 ; private boolean searchFoundEntries ; public LDAPSampler ( ) { } public String getUsername ( ) { } public String getPassword ( ) { } public void setServername ( String servername ) { } public void setPort ( String port ) { } public String getServername ( ) { } public String getPort ( ) { } public void setRootdn ( String newRootdn ) { } public String getRootdn ( ) { } public void setTest ( String newTest ) { } public String getTest ( ) { } public void setUserDefinedTest ( boolean value ) { } public boolean getUserDefinedTest ( ) { } public void setBaseEntryDN ( String newbaseentry ) { } public String getBaseEntryDN ( ) { } public void setArguments ( Arguments value ) { } public Arguments getArguments ( ) { } private BasicAttributes getUserAttributes ( ) { } private ModificationItem [ ] getUserModAttributes ( ) { } private ModificationItem [ ] getModificationItem ( ) { } private BasicAttributes getBasicAttributes ( ) { } private BasicAttribute getBasicAttribute ( String name , String value ) { } public String getLabel ( ) { } private void addTest ( LdapClient ldap , SampleResult res ) throws NamingException { } private void deleteTest ( LdapClient ldap , SampleResult res ) throws NamingException { } private void searchTest ( LdapClient ldap , SampleResult res ) throws NamingException { } private void modifyTest ( LdapClient ldap , SampleResult res ) throws NamingException { } public SampleResult sample ( Entry e ) { SampleResult res = new SampleResult ( ) ; boolean isSuccessful = false ; res . setSampleLabel ( getName ( ) ) ; res . setSamplerData ( getPropertyAsString ( LDAPSampler . TEST ) ) ; LdapClient ldap = new LdapClient ( ) ; try { ldap . connect ( getServername ( ) , getPort ( ) , getRootdn ( ) , getUsername ( ) , getPassword ( ) ) ; if ( getPropertyAsString ( LDAPSampler . TEST ) . equals ( "add" ) ) { addTest ( ldap , res ) ; } else if ( getPropertyAsString ( LDAPSampler . TEST ) . equals ( "delete" ) ) { deleteTest ( ldap , res ) ; } else if ( getPropertyAsString ( LDAPSampler . TEST ) . equals ( "modify" ) ) { modifyTest ( ldap , res ) ; } else if ( getPropertyAsString ( LDAPSampler . TEST ) . equals ( "search" ) ) { searchTest ( ldap , res ) ; } if ( ( getPropertyAsString ( LDAPSampler . TEST ) . equals ( "search" ) ) && ( ! ( searchFoundEntries ) ) ) { res . setResponseCode ( "201" ) ; res . setResponseMessage ( "OK<seq2seq4repair_space>-<seq2seq4repair_space>no<seq2seq4repair_space>results" ) ; res . setResponseData ( "successful<seq2seq4repair_space>-<seq2seq4repair_space>no<seq2seq4repair_space>results" . getBytes ( ) ) ; } else { <START_BUG> res . setResponseCodeOK ( ) ; <END_BUG> res . setResponseMessage ( "OK" ) ; res . setResponseData ( "successful" . getBytes ( ) ) ; } res . setDataType ( TEXT ) ; isSuccessful = true ; ldap . disconnect ( ) ; } catch ( Exception ex ) { LDAPSampler . log . error ( "Ldap<seq2seq4repair_space>client<seq2seq4repair_space>-<seq2seq4repair_space>" , ex ) ; res . setResponseCode ( "500" ) ; res . setResponseMessage ( ex . toString ( ) ) ; ldap . disconnect ( ) ; isSuccessful = false ; } res . setSuccessful ( isSuccessful ) ; return res ; } }

Fix:
res . setResponseCode ( "200" ) ;