Buggy code:
public class TestClient { public static void main ( String [ ] args ) throws Exception { try { System . out . println ( ) ; <START_BUG> TestClient . getUserInput ( ( "Testing<seq2seq4repair_space>JMX<seq2seq4repair_space>Connector<seq2seq4repair_space>from<seq2seq4repair_space>client<seq2seq4repair_space>to<seq2seq4repair_space>server\n" + ( ( ( "===========================================\n\n" + "1.<seq2seq4repair_space>Instantiate<seq2seq4repair_space>local<seq2seq4repair_space>MBeanServer<seq2seq4repair_space>and<seq2seq4repair_space>add<seq2seq4repair_space>connector<seq2seq4repair_space>" ) + "factory<seq2seq4repair_space>as<seq2seq4repair_space>first<seq2seq4repair_space>MBean<seq2seq4repair_space>to<seq2seq4repair_space>search<seq2seq4repair_space>your<seq2seq4repair_space>net\n" ) + "=><seq2seq4repair_space>hit<seq2seq4repair_space>any<seq2seq4repair_space>key<seq2seq4repair_space>to<seq2seq4repair_space>proceed" ) ) ) ; <END_BUG> final MBeanServer lLocalServer = MBeanServerFactory . createMBeanServer ( ) ; final ObjectInstance lFactoryInstance = lLocalServer . createMBean ( "org.jboss.jmx.connector.ConnectorFactoryService" , new ObjectName ( lLocalServer . getDefaultDomain ( ) , "name" , "ConnectorFactory" ) ) ; System . out . println ( ( "Found<seq2seq4repair_space>Factory:<seq2seq4repair_space>" + ( lFactoryInstance . getObjectName ( ) ) ) ) ; lLocalServer . invoke ( lFactoryInstance . getObjectName ( ) , "init" , new Object [ ] { } , new String [ ] { } ) ; lLocalServer . invoke ( lFactoryInstance . getObjectName ( ) , "start" , new Object [ ] { } , new String [ ] { } ) ; TestClient . getUserInput ( ( "\n" + ( "2.<seq2seq4repair_space>Lookup<seq2seq4repair_space>for<seq2seq4repair_space>all<seq2seq4repair_space>available<seq2seq4repair_space>connectors<seq2seq4repair_space>with<seq2seq4repair_space>the<seq2seq4repair_space>JNDI<seq2seq4repair_space>defined<seq2seq4repair_space>by<seq2seq4repair_space>jndi.properties\n" + "=><seq2seq4repair_space>hit<seq2seq4repair_space>any<seq2seq4repair_space>key<seq2seq4repair_space>to<seq2seq4repair_space>proceed" ) ) ) ; InitialContext lContext = null ; try { lContext = new InitialContext ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } Hashtable lProperties = lContext . getEnvironment ( ) ; ConnectorFactoryImpl . JBossConnectorTester lTester = new ConnectorFactoryImpl . JBossConnectorTester ( ) ; Iterator lConnectors = ( ( Iterator ) ( lLocalServer . invoke ( lFactoryInstance . getObjectName ( ) , "getConnectors" , new Object [ ] { lProperties , lTester } , new String [ ] { Hashtable . class . getName ( ) , IConnectorTester . class . getName ( ) } ) ) ) ; int lCount = 0 ; StringBuffer lMessage = new StringBuffer ( ) ; lMessage . append ( "List<seq2seq4repair_space>of<seq2seq4repair_space>all<seq2seq4repair_space>available<seq2seq4repair_space>connectors<seq2seq4repair_space>on<seq2seq4repair_space>your<seq2seq4repair_space>net\n" ) ; lMessage . append ( "=========================================\n" ) ; Vector lTemp = new Vector ( ) ; while ( lConnectors . hasNext ( ) ) { ConnectorFactoryImpl . ConnectorName lName = ( ( ConnectorFactoryImpl . ConnectorName ) ( lConnectors . next ( ) ) ) ; lTemp . addElement ( lName ) ; lMessage . append ( ( ( ( ( "<seq2seq4repair_space>-<seq2seq4repair_space>" + ( lCount ++ ) ) + ".<seq2seq4repair_space>connector<seq2seq4repair_space>is:<seq2seq4repair_space>" ) + lName ) + "\n" ) ) ; } lMessage . append ( "\n" ) ; lMessage . append ( "3.<seq2seq4repair_space>Select<seq2seq4repair_space>your<seq2seq4repair_space>connector<seq2seq4repair_space>by<seq2seq4repair_space>entering<seq2seq4repair_space>its<seq2seq4repair_space>number\n" ) ; lMessage . append ( "=><seq2seq4repair_space>hit<seq2seq4repair_space>any<seq2seq4repair_space>key<seq2seq4repair_space>to<seq2seq4repair_space>proceed" ) ; int lChoice = TestClient . getUserInput ( lMessage . toString ( ) ) ; Iterator i = lTemp . iterator ( ) ; lCount = 0 ; while ( i . hasNext ( ) ) { if ( ( lCount ++ ) == lChoice ) { break ; } } final ConnectorFactoryImpl . ConnectorName lConnectorName = ( ( ConnectorFactoryImpl . ConnectorName ) ( i . next ( ) ) ) ; lMessage . setLength ( 0 ) ; lMessage . append ( ( ( ( "\n" + "You<seq2seq4repair_space>selected<seq2seq4repair_space>connector:<seq2seq4repair_space>" ) + lConnectorName ) + "\n\n" ) ) ; TestClient . getUserInput ( ( "5.<seq2seq4repair_space>Connect<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>given<seq2seq4repair_space>connector\n" + "=><seq2seq4repair_space>hit<seq2seq4repair_space>any<seq2seq4repair_space>key<seq2seq4repair_space>to<seq2seq4repair_space>proceed" ) ) ; JMXConnector lConnector = ( ( JMXConnector ) ( lLocalServer . invoke ( lFactoryInstance . getObjectName ( ) , "createConnection" , new Object [ ] { lConnectorName } , new String [ ] { lConnectorName . getClass ( ) . getName ( ) } ) ) ) ; TestClient . getUserInput ( ( "\n" + ( "6.<seq2seq4repair_space>List<seq2seq4repair_space>all<seq2seq4repair_space>available<seq2seq4repair_space>MBeans<seq2seq4repair_space>and<seq2seq4repair_space>its<seq2seq4repair_space>attributes\n" + "=><seq2seq4repair_space>hit<seq2seq4repair_space>any<seq2seq4repair_space>key<seq2seq4repair_space>to<seq2seq4repair_space>proceed" ) ) ) ; TestClient . listServices ( lConnector ) ; TestClient . getUserInput ( ( "\n" + ( ( ( ( ( "7.<seq2seq4repair_space>Try<seq2seq4repair_space>to<seq2seq4repair_space>add<seq2seq4repair_space>a<seq2seq4repair_space>listener<seq2seq4repair_space>to<seq2seq4repair_space>all<seq2seq4repair_space>available<seq2seq4repair_space>MBeans.\n" + "Please<seq2seq4repair_space>note<seq2seq4repair_space>that<seq2seq4repair_space>this<seq2seq4repair_space>will<seq2seq4repair_space>keep<seq2seq4repair_space>this<seq2seq4repair_space>test<seq2seq4repair_space>client<seq2seq4repair_space>up<seq2seq4repair_space>and<seq2seq4repair_space>running<seq2seq4repair_space>waiting\n" ) + "for<seq2seq4repair_space>an<seq2seq4repair_space>event<seq2seq4repair_space>from<seq2seq4repair_space>the<seq2seq4repair_space>server.<seq2seq4repair_space>If<seq2seq4repair_space>there<seq2seq4repair_space>is<seq2seq4repair_space>no<seq2seq4repair_space>event<seq2seq4repair_space>comming<seq2seq4repair_space>then<seq2seq4repair_space>try\n" ) + "to<seq2seq4repair_space>shutdown<seq2seq4repair_space>the<seq2seq4repair_space>JBoss<seq2seq4repair_space>server.\n" ) + "To<seq2seq4repair_space>end<seq2seq4repair_space>this<seq2seq4repair_space>test<seq2seq4repair_space>client<seq2seq4repair_space>just<seq2seq4repair_space>hit<seq2seq4repair_space><CTRL>-C\n" ) + "=><seq2seq4repair_space>hit<seq2seq4repair_space>any<seq2seq4repair_space>key<seq2seq4repair_space>to<seq2seq4repair_space>proceed" ) ) ) ; TestClient . registerListeners ( lConnector ) ; try { Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { public void run ( ) { System . err . println ( "Shutdown" ) ; try { lLocalServer . invoke ( lFactoryInstance . getObjectName ( ) , "removeConnection" , new Object [ ] { lConnectorName } , new String [ ] { lConnectorName . getClass ( ) . getName ( ) } ) ; System . err . println ( "Shutting<seq2seq4repair_space>done" ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } } } ) ; System . out . println ( "Shutdown<seq2seq4repair_space>hook<seq2seq4repair_space>added" ) ; } catch ( Throwable e ) { System . out . println ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>add<seq2seq4repair_space>shutdown<seq2seq4repair_space>hook" ) ; } } catch ( RuntimeMBeanException rme ) { System . err . println ( ( ( ( "TestClient.main(),<seq2seq4repair_space>caught:<seq2seq4repair_space>" + rme ) + ",<seq2seq4repair_space>target:<seq2seq4repair_space>" ) + ( rme . getTargetException ( ) ) ) ) ; rme . printStackTrace ( ) ; } catch ( MBeanException me ) { System . err . println ( ( ( ( "TestClient.main(),<seq2seq4repair_space>caught:<seq2seq4repair_space>" + me ) + ",<seq2seq4repair_space>target:<seq2seq4repair_space>" ) + ( me . getTargetException ( ) ) ) ) ; me . printStackTrace ( ) ; } catch ( RuntimeErrorException rte ) { System . err . println ( ( ( ( "TestClient.main(),<seq2seq4repair_space>caught:<seq2seq4repair_space>" + rte ) + ",<seq2seq4repair_space>target:<seq2seq4repair_space>" ) + ( rte . getTargetError ( ) ) ) ) ; rte . printStackTrace ( ) ; } catch ( ReflectionException re ) { System . err . println ( ( ( ( "TestClient.main(),<seq2seq4repair_space>caught:<seq2seq4repair_space>" + re ) + ",<seq2seq4repair_space>target:<seq2seq4repair_space>" ) + ( re . getTargetException ( ) ) ) ) ; re . printStackTrace ( ) ; } catch ( Exception e ) { System . err . println ( ( "TestClient.main(),<seq2seq4repair_space>caught:<seq2seq4repair_space>" + e ) ) ; e . printStackTrace ( ) ; } } public static void listServices ( JMXConnector pConnector ) throws Exception { } public static void registerListeners ( JMXConnector pConnector ) throws Exception { } private static int getUserInput ( String lMessage ) { } private static class Listener implements NotificationListener { public void handleNotification ( Notification pNotification , Object pHandback ) { } } private static class NotSerializableHandback { private static int miCounter = 0 ; private String mName ;

Fix:
TestClient . getUserInput ( ( "Testing<seq2seq4repair_space>JMX<seq2seq4repair_space>RMI-Connector<seq2seq4repair_space>from<seq2seq4repair_space>client<seq2seq4repair_space>to<seq2seq4repair_space>server\n" + ( ( ( "===========================================\n\n" + "1.<seq2seq4repair_space>Instantiate<seq2seq4repair_space>local<seq2seq4repair_space>MBeanServer<seq2seq4repair_space>and<seq2seq4repair_space>add<seq2seq4repair_space>connector<seq2seq4repair_space>" ) + "factory<seq2seq4repair_space>as<seq2seq4repair_space>first<seq2seq4repair_space>MBean<seq2seq4repair_space>to<seq2seq4repair_space>search<seq2seq4repair_space>your<seq2seq4repair_space>net\n" ) + "=><seq2seq4repair_space>hit<seq2seq4repair_space>any<seq2seq4repair_space>key<seq2seq4repair_space>to<seq2seq4repair_space>proceed" ) ) ) ;