Buggy code:
public class WatchManager implements BundleStoppingListener { private List < ZooKeeper > zooKeepers = new ArrayList < ZooKeeper > ( ) ; private Map < String , NodeWriter > nodeWriters = new HashMap < String , NodeWriter > ( ) ; private static Map < String , IServiceInfo > allKnownServices = new HashMap < String , IServiceInfo > ( ) ; private Configuration config ; private WriteRoot writeRoot ; private WatchManager . Lock writeRootLock = new WatchManager . Lock ( ) . lock ( ) ; public WatchManager ( Configuration config ) { } public synchronized void publish ( final ServiceReference ref ) { } public synchronized void publish ( final AdvertisedService published ) { } public synchronized void unpublish ( final String id ) { } public synchronized void update ( ServiceReference ref ) { } public void watch ( ) { switch ( getConfig ( ) . getFlavor ( ) ) { case CENTRALIZED : CACHED_THREAD_POOL . execute ( new Runnable ( ) { public void run ( ) { WatchManager . this . writeRoot = new WriteRoot ( getConfig ( ) . getServerIps ( ) , WatchManager . this ) ; synchronized ( WatchManager . this . writeRootLock ) { WatchManager . this . writeRootLock . unlock ( ) ; WatchManager . this . writeRootLock . notifyAll ( ) ; } } } ) ; CACHED_THREAD_POOL . execute ( new Runnable ( ) { public void run ( ) { new ReadRoot ( getConfig ( ) . getServerIps ( ) , WatchManager . this ) ; } } ) ; break ; case REPLICATED : CACHED_THREAD_POOL . execute ( new Runnable ( ) { public void run ( ) { WatchManager . this . writeRoot = new WriteRoot ( getConfig ( ) . getServerIps ( ) , WatchManager . this ) ; synchronized ( WatchManager . this . writeRootLock ) { WatchManager . this . writeRootLock . unlock ( ) ; WatchManager . this . writeRootLock . notifyAll ( ) ; } } } ) ; CACHED_THREAD_POOL . execute ( new Runnable ( ) { public void run ( ) { new ReadRoot ( getConfig ( ) . getServerIps ( ) , WatchManager . this ) ; } } ) ; break ; case STANDALONE : CACHED_THREAD_POOL . execute ( new Runnable ( ) { public void run ( ) { <START_BUG> WatchManager . this . writeRoot = new WriteRoot ( Geo . getHost ( ) , WatchManager . this ) ; <END_BUG> if ( ! ( WatchManager . this . writeRoot . isConnected ( ) ) ) { synchronized ( WatchManager . this . writeRoot ) { try { WatchManager . this . writeRoot . wait ( ) ; } catch ( InterruptedException e ) { Logger . log ( LogService . LOG_DEBUG , e . getMessage ( ) , e ) ; } } } synchronized ( WatchManager . this . writeRootLock ) { WatchManager . this . writeRootLock . unlock ( ) ; WatchManager . this . writeRootLock . notifyAll ( ) ; } } } ) ; CACHED_THREAD_POOL . execute ( new Runnable ( ) { public void run ( ) { for ( String ip : getConfig ( ) . getServerIps ( ) . split ( "," ) ) { new ReadRoot ( ip , WatchManager . this ) ; } } } ) ; break ; } } public void bundleStopping ( ) { } public void setConfig ( Configuration config ) { } public Configuration getConfig ( ) { } public void addZooKeeper ( ZooKeeper zooKeeper ) { } public void removeZooKeeper ( ZooKeeper zooKeeper ) { } public WriteRoot getWriteRoot ( ) { } public Map < String , NodeWriter > getNodeWriters ( ) { } private class Lock { boolean state ; boolean isOpen ( ) { } WatchManager . Lock unlock ( ) { } WatchManager . Lock lock ( ) { } } public void unpublishAll ( ) { } public void republishAll ( ) { } public static Map < String , IServiceInfo > getAllKnownServices ( ) { } public void dipose ( ) { } }

Fix:
WatchManager . this . writeRoot = new WriteRoot ( ( ( ( Geo . getHost ( ) ) + ":" ) + ( getConfig ( ) . getClientPort ( ) ) ) , WatchManager . this ) ;