Program: 82069
Project: 82069
Buggy source:
@Override public void run(){
  _globalLock.lock();
  try {
    if (_lastCleanup + _cleanupDelay < System.currentTimeMillis()) {
      try {
        cleanupOldDirs();
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e,_shard,_table);
      }
      _lastCleanup=System.currentTimeMillis();
    }
    Path path=_shardContext.getHdfsDirPath();
    Configuration configuration=_shardContext.getTableContext().getConfiguration();
    try {
      FileSystem fileSystem=path.getFileSystem(configuration);
      SortedSet<FileStatus> listStatus;
      while (true) {
        try {
          listStatus=sort(fileSystem.listStatus(path,new PathFilter(){
            @Override public boolean accept(            Path path){
              if (path != null && path.getName().endsWith(COMMIT)) {
                return true;
              }
              return false;
            }
          }
));
          break;
        }
 catch (        FileNotFoundException e) {
          LOG.warn("String_Node_Str");
        }
        try {
          Thread.sleep(100);
        }
 catch (        InterruptedException e) {
          return;
        }
      }
      for (      FileStatus fileStatus : listStatus) {
        Path file=fileStatus.getPath();
        if (fileStatus.isDir() && file.getName().endsWith(COMMIT)) {
          Path inuse=new Path(file.getParent(),rename(file.getName(),INUSE));
          touch(fileSystem,new Path(file,INPROGRESS));
          if (fileSystem.rename(file,inuse)) {
            if (_testError != null) {
              _testError.run();
            }
            HdfsDirectory hdfsDirectory=new HdfsDirectory(configuration,inuse);
            try {
              if (DirectoryReader.indexExists(hdfsDirectory)) {
                IndexAction indexAction=getIndexAction(hdfsDirectory,fileSystem);
                _blurIndex.process(indexAction);
                return;
              }
 else {
                Path badindex=new Path(file.getParent(),rename(file.getName(),BADINDEX));
                if (fileSystem.rename(inuse,badindex)) {
                  LOG.error("String_Node_Str",inuse,badindex);
                }
 else {
                  LOG.fatal("String_Node_Str",inuse,badindex);
                }
              }
            }
  finally {
              hdfsDirectory.close();
            }
          }
 else {
            LOG.fatal("String_Node_Str",file);
          }
        }
      }
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e,_shard,_table);
    }
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",t);
  }
 finally {
    _globalLock.unlock();
  }
}

Fixed version (ground truth):
@Override public void run(){
  _globalLock.lock();
  try {
    if (_lastCleanup + _cleanupDelay < System.currentTimeMillis()) {
      try {
        cleanupOldDirs();
      }
 catch (      IOException e) {
        LOG.error("String_Node_Str",e,_shard,_table);
      }
      _lastCleanup=System.currentTimeMillis();
    }
    Path path=_shardContext.getHdfsDirPath();
    Configuration configuration=_shardContext.getTableContext().getConfiguration();
    try {
      FileSystem fileSystem=path.getFileSystem(configuration);
      SortedSet<FileStatus> listStatus=null;
      for (int i=0; i < MAX_ATTEMPTS; i++) {
        try {
          if (!fileSystem.exists(path)) {
            LOG.warn("String_Node_Str",path);
            return;
          }
          listStatus=sort(fileSystem.listStatus(path,new PathFilter(){
            @Override public boolean accept(            Path path){
              if (path != null && path.getName().endsWith(COMMIT)) {
                return true;
              }
              return false;
            }
          }
));
          break;
        }
 catch (        FileNotFoundException e) {
          LOG.warn("String_Node_Str");
        }
        try {
          Thread.sleep(100 * (i + 1));
        }
 catch (        InterruptedException e) {
          return;
        }
      }
      if (listStatus == null) {
        LOG.warn("String_Node_Str",path);
        return;
      }
      for (      FileStatus fileStatus : listStatus) {
        Path file=fileStatus.getPath();
        if (fileStatus.isDir() && file.getName().endsWith(COMMIT)) {
          Path inuse=new Path(file.getParent(),rename(file.getName(),INUSE));
          touch(fileSystem,new Path(file,INPROGRESS));
          if (fileSystem.rename(file,inuse)) {
            if (_testError != null) {
              _testError.run();
            }
            HdfsDirectory hdfsDirectory=new HdfsDirectory(configuration,inuse);
            try {
              if (DirectoryReader.indexExists(hdfsDirectory)) {
                IndexAction indexAction=getIndexAction(hdfsDirectory,fileSystem);
                _blurIndex.process(indexAction);
                return;
              }
 else {
                Path badindex=new Path(file.getParent(),rename(file.getName(),BADINDEX));
                if (fileSystem.rename(inuse,badindex)) {
                  LOG.error("String_Node_Str",inuse,badindex);
                }
 else {
                  LOG.fatal("String_Node_Str",inuse,badindex);
                }
              }
            }
  finally {
              hdfsDirectory.close();
            }
          }
 else {
            LOG.fatal("String_Node_Str",file);
          }
        }
      }
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e,_shard,_table);
    }
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",t);
  }
 finally {
    _globalLock.unlock();
  }
}