Program: 82527
Project: 82527
Buggy source:
private void watchForTables(){
  _tablesToCluster=new Thread(new Runnable(){
    @Override public void run(){
      try {
        doWatch();
      }
 catch (      KeeperException e) {
        LOG.error("String_Node_Str",e);
      }
catch (      InterruptedException e) {
        return;
      }
    }
    private void doWatch() throws KeeperException, InterruptedException {
      while (_running.get()) {
synchronized (_tableToClusterCache) {
          String clusterPath=ZookeeperPathConstants.getClustersPath();
          List<String> clusters=_zk.getChildren(clusterPath,new Watcher(){
            @Override public void process(            WatchedEvent event){
synchronized (_tableToClusterCache) {
                _tableToClusterCache.notifyAll();
              }
            }
          }
);
          for (          String cluster : clusters) {
            List<String> tables=_zk.getChildren(ZookeeperPathConstants.getTablesPath(cluster),new Watcher(){
              @Override public void process(              WatchedEvent event){
synchronized (_tableToClusterCache) {
                  _tableToClusterCache.notifyAll();
                }
              }
            }
);
            Map<String,List<String>> newValue=new HashMap<String,List<String>>();
            for (            String table : tables) {
              List<String> clusterList=newValue.get(table);
              if (clusterList == null) {
                clusterList=new ArrayList<String>();
                newValue.put(table,clusterList);
              }
              clusterList.add(cluster);
            }
            _tableToClusterCache.set(newValue);
          }
          _tableToClusterCache.wait();
        }
      }
    }
  }
);
  _tablesToCluster.setDaemon(true);
  _tablesToCluster.setName("String_Node_Str");
  _tablesToCluster.start();
}

Fixed version (ground truth):
private void watchForTables(){
  _tablesToCluster=new Thread(new Runnable(){
    @Override public void run(){
      try {
        doWatch();
      }
 catch (      KeeperException e) {
        LOG.error("String_Node_Str",e);
      }
catch (      InterruptedException e) {
        return;
      }
    }
    private void doWatch() throws KeeperException, InterruptedException {
      while (_running.get()) {
synchronized (_tableToClusterCache) {
          String clusterPath=ZookeeperPathConstants.getClustersPath();
          List<String> clusters=_zk.getChildren(clusterPath,new Watcher(){
            @Override public void process(            WatchedEvent event){
synchronized (_tableToClusterCache) {
                _tableToClusterCache.notifyAll();
              }
            }
          }
);
          Map<String,List<String>> newValue=new HashMap<String,List<String>>();
          for (          String cluster : clusters) {
            List<String> tables=_zk.getChildren(ZookeeperPathConstants.getTablesPath(cluster),new Watcher(){
              @Override public void process(              WatchedEvent event){
synchronized (_tableToClusterCache) {
                  _tableToClusterCache.notifyAll();
                }
              }
            }
);
            for (            String table : tables) {
              List<String> clusterList=newValue.get(table);
              if (clusterList == null) {
                clusterList=new ArrayList<String>();
                newValue.put(table,clusterList);
              }
              clusterList.add(cluster);
            }
          }
          _tableToClusterCache.set(newValue);
          _tableToClusterCache.wait();
        }
      }
    }
  }
);
  _tablesToCluster.setDaemon(true);
  _tablesToCluster.setName("String_Node_Str");
  _tablesToCluster.start();
}