Program: 48839
Project: 48839
Buggy source:
public void run(){
  File currentFile=null;
  while (!isTerminate) {
    try {
      File directory=new File("String_Node_Str");
      File[] files=directory.listFiles(new FilenameFilter(){
        public boolean accept(        File dir,        String name){
          if (name.startsWith(filenamePrefix))           return true;
 else           return false;
        }
      }
);
      Arrays.sort(files,new Comparator<File>(){
        public int compare(        File f1,        File f2){
          return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified());
        }
      }
);
      for (      File file : files) {
        currentFile=file;
        String filename=file.getName();
        logger.info("String_Node_Str" + filename + "String_Node_Str");
        String[] strs=filename.substring(filenamePrefix.length()).split("String_Node_Str");
        if (strs == null || strs.length != 2) {
          logger.error("String_Node_Str" + filename + "String_Node_Str"+ filenamePrefix+ "String_Node_Str");
          file.delete();
          continue;
        }
        String clusterName=strs[0];
        String nodeCountStr=strs[1];
        ClusterRead cluster=null;
        try {
          cluster=clusterMgr.getClusterByName(clusterName,false);
        }
 catch (        BddException e) {
          logger.error("String_Node_Str",e);
          file.delete();
          continue;
        }
        if (cluster == null) {
          logger.error("String_Node_Str" + clusterName + "String_Node_Str");
          file.delete();
          continue;
        }
        if (!cluster.validateSetManualElasticity()) {
          logger.error("String_Node_Str" + clusterName + "String_Node_Str");
          file.delete();
          continue;
        }
        int nodeCount;
        try {
          nodeCount=Integer.valueOf(nodeCountStr);
        }
 catch (        NumberFormatException e) {
          logger.error(nodeCountStr + "String_Node_Str");
          file.delete();
          continue;
        }
        if (nodeCount < -1) {
          logger.error("String_Node_Str" + nodeCountStr + "String_Node_Str");
          file.delete();
          continue;
        }
        int computeNodeNum=cluster.retrieveComputeNodeNum();
        if (nodeCount > computeNodeNum) {
          logger.error("String_Node_Str" + computeNodeNum);
          file.delete();
          continue;
        }
        if (cluster.getAutomationEnable() == true && cluster.getVhmMinNum() == nodeCount && cluster.getVhmMaxNum() == nodeCount) {
          logger.info("String_Node_Str");
        }
 else {
          try {
            List<String> nodeGroupNames=clusterMgr.syncSetParam(clusterName,null,Integer.valueOf(nodeCount),Integer.valueOf(nodeCount),true,null);
            logger.info(nodeGroupNames + "String_Node_Str" + nodeCount);
          }
 catch (          BddException e) {
            logger.error("String_Node_Str",e);
          }
        }
        file.delete();
      }
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      logger.warn("String_Node_Str");
      isTerminate=true;
    }
catch (    Exception e) {
      logger.error("String_Node_Str",e);
    }
 finally {
      if (currentFile != null && currentFile.exists()) {
        currentFile.delete();
      }
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (!isTerminate) {
    try {
      File directory=new File("String_Node_Str");
      File[] files=directory.listFiles(new FilenameFilter(){
        public boolean accept(        File dir,        String name){
          if (name.startsWith(filenamePrefix))           return true;
 else           return false;
        }
      }
);
      Arrays.sort(files,new Comparator<File>(){
        public int compare(        File f1,        File f2){
          return Long.valueOf(f1.lastModified()).compareTo(f2.lastModified());
        }
      }
);
      for (      File file : files) {
        String filename=file.getName();
        logger.info("String_Node_Str" + filename + "String_Node_Str");
        String[] strs=filename.substring(filenamePrefix.length()).split("String_Node_Str");
        if (strs == null || strs.length != 2) {
          logger.error("String_Node_Str" + filename + "String_Node_Str"+ filenamePrefix+ "String_Node_Str");
          continue;
        }
        String clusterName=strs[0];
        String nodeCountStr=strs[1];
        ClusterRead cluster=null;
        try {
          cluster=clusterMgr.getClusterByName(clusterName,false);
        }
 catch (        BddException e) {
          logger.error("String_Node_Str",e);
          continue;
        }
        if (cluster == null) {
          logger.error("String_Node_Str" + clusterName + "String_Node_Str");
          continue;
        }
        if (!cluster.validateSetManualElasticity()) {
          logger.error("String_Node_Str" + clusterName + "String_Node_Str");
          continue;
        }
        int nodeCount;
        try {
          nodeCount=Integer.valueOf(nodeCountStr);
        }
 catch (        NumberFormatException e) {
          logger.error(nodeCountStr + "String_Node_Str");
          continue;
        }
        if (nodeCount < -1) {
          logger.error("String_Node_Str" + nodeCountStr + "String_Node_Str");
          continue;
        }
        int computeNodeNum=cluster.retrieveComputeNodeNum();
        if (nodeCount > computeNodeNum) {
          logger.error("String_Node_Str" + computeNodeNum);
          continue;
        }
        try {
          List<String> nodeGroupNames=clusterMgr.syncSetParam(clusterName,null,Integer.valueOf(nodeCount),Integer.valueOf(nodeCount),true,null);
          logger.info(nodeGroupNames + "String_Node_Str" + nodeCount);
          file.delete();
        }
 catch (        BddException e) {
          logger.error("String_Node_Str",e);
        }
      }
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
      logger.warn("String_Node_Str");
      isTerminate=true;
    }
catch (    Exception e) {
      logger.error("String_Node_Str",e);
    }
  }
}