Buggy code:
public class JMSSampler extends AbstractSampler implements ThreadListener { private static final Logger LOGGER = LoggingManager . getLoggerForClass ( ) ; private static final long serialVersionUID = 233L ; private static final int DEFAULT_TIMEOUT = 2000 ; private static final String DEFAULT_TIMEOUT_STRING = Integer . toString ( JMSSampler . DEFAULT_TIMEOUT ) ; private static final String JNDI_INITIAL_CONTEXT_FACTORY = "JMSSampler.initialContextFactory" ; private static final String JNDI_CONTEXT_PROVIDER_URL = "JMSSampler.contextProviderUrl" ; private static final String JNDI_PROPERTIES = "JMSSampler.jndiProperties" ; private static final String TIMEOUT = "JMSSampler.timeout" ; private static final String JMS_SELECTOR = "JMSSampler.jmsSelector" ; private static final String JMS_SELECTOR_DEFAULT = "" ; private static final String IS_ONE_WAY = "JMSSampler.isFireAndForget" ; private static final String JMS_PROPERTIES = "arguments" ; private static final String RECEIVE_QUEUE = "JMSSampler.ReceiveQueue" ; private static final String XML_DATA = "HTTPSamper.xml_data" ; private static final String SEND_QUEUE = "JMSSampler.SendQueue" ; private static final String QUEUE_CONNECTION_FACTORY_JNDI = "JMSSampler.queueconnectionfactory" ; private static final String IS_NON_PERSISTENT = "JMSSampler.isNonPersistent" ; private static final String USE_REQ_MSGID_AS_CORRELID = "JMSSampler.useReqMsgIdAsCorrelId" ; private static final String USE_RES_MSGID_AS_CORRELID = "JMSSampler.useResMsgIdAsCorrelId" ; private static final boolean USE_RES_MSGID_AS_CORRELID_DEFAULT = false ; private static final boolean USE_SECURITY_PROPERTIES = JMeterUtils . getPropDefault ( "JMSSampler.useSecurity.properties" , true ) ; private transient Queue receiveQueue ; private transient QueueSession session ; private transient QueueConnection connection ; private transient QueueExecutor executor ; private transient QueueSender producer ; private transient Receiver receiverThread = null ; private transient Throwable thrown = null ; public SampleResult sample ( Entry entry ) { } private TextMessage createMessage ( ) throws JMSException { } private void addJMSProperties ( TextMessage msg ) throws JMSException { } public Arguments getJMSProperties ( ) { } public void setJMSProperties ( Arguments args ) { } public Arguments getJNDIProperties ( ) { } public void setJNDIProperties ( Arguments args ) { } public String getQueueConnectionFactory ( ) { } public void setQueueConnectionFactory ( String qcf ) { } public String getSendQueue ( ) { } public void setSendQueue ( String name ) { } public String getReceiveQueue ( ) { } public void setReceiveQueue ( String name ) { } public String getContent ( ) { } public void setContent ( String content ) { } public boolean isOneway ( ) { } public boolean isNonPersistent ( ) { } public boolean isUseReqMsgIdAsCorrelId ( ) { } public boolean isUseResMsgIdAsCorrelId ( ) { } public String getInitialContextFactory ( ) { } public String getContextProvider ( ) { } public void setIsOneway ( boolean isOneway ) { } public void setNonPersistent ( boolean value ) { } public void setUseReqMsgIdAsCorrelId ( boolean value ) { } public void setUseResMsgIdAsCorrelId ( boolean value ) { } @ Override public String toString ( ) { } public void threadStarted ( ) { logThreadStart ( ) ; Context context = null ; thrown = null ; try { context = getInitialContext ( ) ; Object obj = context . lookup ( getQueueConnectionFactory ( ) ) ; if ( ! ( obj instanceof QueueConnectionFactory ) ) { <START_BUG> String msg = "QueueConnectionFactory<seq2seq4repair_space>expected,<seq2seq4repair_space>but<seq2seq4repair_space>got<seq2seq4repair_space>" + ( obj . getClass ( ) . getName ( ) ) ; <END_BUG> JMSSampler . LOGGER . fatalError ( msg ) ; throw new IllegalStateException ( msg ) ; } QueueConnectionFactory factory = ( ( QueueConnectionFactory ) ( obj ) ) ; Queue sendQueue = ( ( Queue ) ( context . lookup ( getSendQueue ( ) ) ) ) ; if ( ! ( useTemporyQueue ( ) ) ) { receiveQueue = ( ( Queue ) ( context . lookup ( getReceiveQueue ( ) ) ) ) ; receiverThread = Receiver . createReceiver ( factory , receiveQueue , getPrincipal ( context ) , getCredentials ( context ) , isUseResMsgIdAsCorrelId ( ) , getJMSSelector ( ) ) ; } String principal = null ; String credentials = null ; if ( JMSSampler . USE_SECURITY_PROPERTIES ) { principal = getPrincipal ( context ) ; credentials = getCredentials ( context ) ; } if ( ( principal != null ) && ( credentials != null ) ) { connection = factory . createQueueConnection ( principal , credentials ) ; } else { connection = factory . createQueueConnection ( ) ; } session = connection . createQueueSession ( false , AUTO_ACKNOWLEDGE ) ; if ( JMSSampler . LOGGER . isDebugEnabled ( ) ) { JMSSampler . LOGGER . debug ( "Session<seq2seq4repair_space>created" ) ; } if ( getPropertyAsBoolean ( JMSSampler . IS_ONE_WAY ) ) { producer = session . createSender ( sendQueue ) ; if ( isNonPersistent ( ) ) { producer . setDeliveryMode ( NON_PERSISTENT ) ; } } else { if ( useTemporyQueue ( ) ) { executor = new TemporaryQueueExecutor ( session , sendQueue ) ; } else { producer = session . createSender ( sendQueue ) ; if ( isNonPersistent ( ) ) { producer . setDeliveryMode ( NON_PERSISTENT ) ; } executor = new FixedQueueExecutor ( producer , getTimeoutAsInt ( ) , isUseReqMsgIdAsCorrelId ( ) ) ; } } if ( JMSSampler . LOGGER . isDebugEnabled ( ) ) { JMSSampler . LOGGER . debug ( "Starting<seq2seq4repair_space>connection" ) ; } connection . start ( ) ; if ( JMSSampler . LOGGER . isDebugEnabled ( ) ) { JMSSampler . LOGGER . debug ( "Connection<seq2seq4repair_space>started" ) ; } } catch ( Exception e ) { thrown = e ; JMSSampler . LOGGER . error ( e . getLocalizedMessage ( ) , e ) ; } catch ( NoClassDefFoundError e ) { thrown = e ; JMSSampler . LOGGER . error ( e . getLocalizedMessage ( ) , e ) ; } finally { if ( context != null ) { try { context . close ( ) ; } catch ( NamingException ignored ) { } } } } private Context getInitialContext ( ) throws NamingException { } private void printEnvironment ( Context context ) throws NamingException { } private void logThreadStart ( ) { } private int getTimeoutAsInt ( ) { } public String getTimeout ( ) { } public void threadFinished ( ) { }

Fix:
String msg = "QueueConnectionFactory<seq2seq4repair_space>expected,<seq2seq4repair_space>but<seq2seq4repair_space>got<seq2seq4repair_space>" + ( obj != null ? obj . getClass ( ) . getName ( ) : "null" ) ;