Program: 82494
Project: 82494
Buggy source:
@Override public void run(){
  try {
    int hdfsId=this.database.getHdfsId(this.hdfsName);
    FileSystem fileSystem=(this.user != null) ? FileSystem.get(this.uri,new Configuration(),this.user) : FileSystem.get(this.uri,new Configuration());
    if (fileSystem instanceof DistributedFileSystem) {
      DistributedFileSystem dfs=(DistributedFileSystem)fileSystem;
      FsStatus ds=dfs.getStatus();
      long capacity=ds.getCapacity();
      long used=ds.getUsed();
      long logical_used=used / dfs.getDefaultReplication();
      long remaining=ds.getRemaining();
      long presentCapacity=used + remaining;
      long liveNodes=-1;
      long deadNodes=-1;
      long totalNodes=-1;
      try {
        DatanodeInfo[] live=dfs.getClient().datanodeReport(DatanodeReportType.LIVE);
        DatanodeInfo[] dead=dfs.getClient().datanodeReport(DatanodeReportType.DEAD);
        liveNodes=live.length;
        deadNodes=dead.length;
        totalNodes=liveNodes + deadNodes;
      }
 catch (      Exception e) {
        log.warn("String_Node_Str");
      }
      Calendar cal=Calendar.getInstance();
      TimeZone z=cal.getTimeZone();
      cal.add(Calendar.MILLISECOND,-(z.getOffset(cal.getTimeInMillis())));
      this.database.insertHdfsStats(capacity,presentCapacity,remaining,used,logical_used,(((1.0 * used) / presentCapacity) * 100),dfs.getUnderReplicatedBlocksCount(),dfs.getCorruptBlocksCount(),dfs.getMissingBlocksCount(),totalNodes,liveNodes,deadNodes,cal.getTime(),host,port,hdfsId);
      dfs.close();
    }
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
catch (  DataAccessException e) {
    log.error("String_Node_Str",e);
  }
catch (  NullReturnedException e) {
    log.error(e.getMessage(),e);
  }
catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    int hdfsId=this.database.getHdfsId(this.hdfsName);
    if (hdfsId == -1) {
      log.error("String_Node_Str" + this.hdfsName + "String_Node_Str");
      return;
    }
    FileSystem fileSystem=(this.user != null) ? FileSystem.get(this.uri,new Configuration(),this.user) : FileSystem.get(this.uri,new Configuration());
    if (fileSystem instanceof DistributedFileSystem) {
      DistributedFileSystem dfs=(DistributedFileSystem)fileSystem;
      FsStatus ds=dfs.getStatus();
      long capacity=ds.getCapacity();
      long used=ds.getUsed();
      long logical_used=used / dfs.getDefaultReplication();
      long remaining=ds.getRemaining();
      long presentCapacity=used + remaining;
      long liveNodes=-1;
      long deadNodes=-1;
      long totalNodes=-1;
      try {
        DatanodeInfo[] live=dfs.getClient().datanodeReport(DatanodeReportType.LIVE);
        DatanodeInfo[] dead=dfs.getClient().datanodeReport(DatanodeReportType.DEAD);
        liveNodes=live.length;
        deadNodes=dead.length;
        totalNodes=liveNodes + deadNodes;
      }
 catch (      Exception e) {
        log.warn("String_Node_Str");
      }
      this.database.insertHdfsStats(capacity,presentCapacity,remaining,used,logical_used,(((1.0 * used) / presentCapacity) * 100),dfs.getUnderReplicatedBlocksCount(),dfs.getCorruptBlocksCount(),dfs.getMissingBlocksCount(),totalNodes,liveNodes,deadNodes,TimeHelper.now().getTime(),host,port,hdfsId);
      dfs.close();
    }
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
catch (  DataAccessException e) {
    log.error("String_Node_Str",e);
  }
catch (  NullReturnedException e) {
    log.error(e.getMessage(),e);
  }
catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}