Buggy code:
public class CmiRegistry extends AbsRegistry implements NameService { private static DistributedEquiv de = null ; private static RegistryKiller cregk = null ; private static int objectPort = 0 ; private InetAddress registryInetAddress = null ; public CmiRegistry ( ) { } public void start ( ) throws NameServiceException { if ( TraceCarol . isDebugJndiCarol ( ) ) { TraceCarol . debugJndiCarol ( ( "CmiRegistry.start()<seq2seq4repair_space>on<seq2seq4repair_space>port:" + ( getPort ( ) ) ) ) ; } try { if ( System . getProperty ( SERVER_MODE , "false" ) . equalsIgnoreCase ( "true" ) ) { if ( ( getConfigProperties ( ) ) != null ) { String propertyName = CarolDefaultValues . SERVER_JRMP_PORT ; CmiRegistry . objectPort = PortNumber . strToint ( getConfigProperties ( ) . getProperty ( propertyName , "0" ) , propertyName ) ; propertyName = CarolDefaultValues . SERVER_JRMP_SINGLE_ITF ; boolean useSingleItf = Boolean . valueOf ( getConfigProperties ( ) . getProperty ( propertyName , "false" ) ) . booleanValue ( ) ; if ( useSingleItf ) { String url = getConfigProperties ( ) . getProperty ( ( ( ( CarolDefaultValues . CAROL_PREFIX ) + ".jrmp." ) + ( CarolDefaultValues . URL_PREFIX ) ) ) ; registryInetAddress = InetAddress . getByName ( ConfigurationUtil . getHostOfUrl ( url ) ) ; } } else { TraceCarol . debugCarol ( ( ( "No<seq2seq4repair_space>properties<seq2seq4repair_space>'" + ( CarolDefaultValues . SERVER_JRMP_PORT ) ) + "'<seq2seq4repair_space>defined<seq2seq4repair_space>in<seq2seq4repair_space>carol.properties<seq2seq4repair_space>file." ) ) ; } } if ( ! ( isStarted ( ) ) ) { if ( ( CmiRegistry . objectPort ) > 0 ) { TraceCarol . infoCarol ( ( ( "Using<seq2seq4repair_space>JRMP<seq2seq4repair_space>fixed<seq2seq4repair_space>server<seq2seq4repair_space>port<seq2seq4repair_space>number<seq2seq4repair_space>'" + ( CmiRegistry . objectPort ) ) + "'." ) ) ; } if ( ( registryInetAddress ) != null ) { TraceCarol . infoCarol ( ( ( "Using<seq2seq4repair_space>Specific<seq2seq4repair_space>address<seq2seq4repair_space>to<seq2seq4repair_space>bind<seq2seq4repair_space>registry<seq2seq4repair_space>'" + ( registryInetAddress ) ) + "'." ) ) ; } if ( ( getPort ( ) ) >= 0 ) { <START_BUG> RMIManageableSocketFactory . register ( CmiRegistry . objectPort , registryInetAddress , "cmi" ) ; <END_BUG> CmiRegistry . de = DistributedEquiv . start ( ) ; CmiRegistry . cregk = RegistryImpl . start ( getPort ( ) ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { public void run ( ) { try { CmiRegistry . this . stop ( ) ; } catch ( Exception e ) { TraceCarol . error ( "CmiRegistry<seq2seq4repair_space>ShutdownHook<seq2seq4repair_space>problem" , e ) ; } } } ) ; } else { if ( TraceCarol . isDebugJndiCarol ( ) ) { TraceCarol . debugJndiCarol ( ( ( "Can't<seq2seq4repair_space>start<seq2seq4repair_space>CmiRegistry,<seq2seq4repair_space>port=" + ( getPort ( ) ) ) + "<seq2seq4repair_space>is<seq2seq4repair_space><<seq2seq4repair_space>0" ) ) ; } } } else { if ( TraceCarol . isDebugJndiCarol ( ) ) { TraceCarol . debugJndiCarol ( ( "CmiRegistry<seq2seq4repair_space>is<seq2seq4repair_space>already<seq2seq4repair_space>start<seq2seq4repair_space>on<seq2seq4repair_space>port:" + ( getPort ( ) ) ) ) ; } } } catch ( Exception e ) { String msg = "can<seq2seq4repair_space>not<seq2seq4repair_space>start<seq2seq4repair_space>cluster<seq2seq4repair_space>registry:<seq2seq4repair_space>" + e ; TraceCarol . error ( msg ) ; throw new NameServiceException ( msg ) ; } } public void stop ( ) throws NameServiceException { } public boolean isStarted ( ) { } public static Registry getRegistry ( ) { } public static boolean isLocal ( ) { } }

Fix:
RMIManageableSocketFactory . register ( getPort ( ) , CmiRegistry . objectPort , registryInetAddress , "cmi" ) ;