Program: 70247
Project: 70247
Buggy source:
public MasterResource(){
  super(new COMPSsMaster());
  userExecutionDirPath=System.getProperty("String_Node_Str");
  boolean mustCreateExecutionSandbox=true;
  String specificOpt=System.getProperty(ITConstants.IT_SPECIFIC_LOG_DIR);
  if (specificOpt != null && !specificOpt.isEmpty()) {
    COMPSsLogBaseDirPath=specificOpt.endsWith(File.separator) ? specificOpt : specificOpt + File.separator;
    mustCreateExecutionSandbox=false;
  }
 else {
    String baseOpt=System.getProperty(ITConstants.IT_BASE_LOG_DIR);
    if (baseOpt != null && !baseOpt.isEmpty()) {
      baseOpt=baseOpt.endsWith(File.separator) ? baseOpt : baseOpt + File.separator;
      COMPSsLogBaseDirPath=baseOpt + "String_Node_Str" + File.separator;
    }
 else {
      COMPSsLogBaseDirPath=System.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator;
    }
  }
  if (!new File(COMPSsLogBaseDirPath).exists()) {
    if (!new File(COMPSsLogBaseDirPath).mkdir()) {
      ErrorManager.error(ERROR_COMPSs_LOG_BASE_DIR);
    }
  }
  if (mustCreateExecutionSandbox) {
    String appName=System.getProperty(ITConstants.IT_APP_NAME);
    if (System.getProperty(ITConstants.IT_SERVICE_NAME) != null) {
      String serviceName=System.getProperty(ITConstants.IT_SERVICE_NAME);
      int overloadCode=1;
      String appLog=COMPSsLogBaseDirPath + serviceName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
      String oldest=appLog;
      while ((new File(appLog).exists()) && (overloadCode <= MAX_OVERLOAD)) {
        if (new File(oldest).lastModified() > new File(appLog).lastModified()) {
          oldest=appLog;
        }
        overloadCode=overloadCode + 1;
        if (overloadCode < 10) {
          appLog=COMPSsLogBaseDirPath + serviceName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
        }
 else {
          appLog=COMPSsLogBaseDirPath + serviceName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
        }
      }
      if (overloadCode > MAX_OVERLOAD) {
        appLog=oldest;
        System.err.println(WARN_FOLDER_OVERLOAD);
        System.err.println("String_Node_Str" + appLog);
        if (!deleteDirectory(new File(appLog))) {
          ErrorManager.error(ERROR_APP_OVERLOAD);
        }
      }
      appLogDirPath=appLog;
      if (!new File(appLogDirPath).mkdir()) {
        ErrorManager.error(ERROR_APP_LOG_DIR);
      }
      System.setProperty(ITConstants.IT_APP_LOG_DIR,appLogDirPath);
    }
 else {
      int overloadCode=1;
      String appLog=COMPSsLogBaseDirPath + appName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
      String oldest=appLog;
      while ((new File(appLog).exists()) && (overloadCode <= MAX_OVERLOAD)) {
        if (new File(oldest).lastModified() > new File(appLog).lastModified()) {
          oldest=appLog;
        }
        overloadCode=overloadCode + 1;
        if (overloadCode < 10) {
          appLog=COMPSsLogBaseDirPath + appName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
        }
 else {
          appLog=COMPSsLogBaseDirPath + appName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
        }
      }
      if (overloadCode > MAX_OVERLOAD) {
        appLog=oldest;
        System.err.println(WARN_FOLDER_OVERLOAD);
        System.err.println("String_Node_Str" + appLog);
        if (!deleteDirectory(new File(appLog))) {
          ErrorManager.error(ERROR_APP_OVERLOAD);
        }
      }
      appLogDirPath=appLog;
      if (!new File(appLogDirPath).mkdir()) {
        ErrorManager.error(ERROR_APP_LOG_DIR);
      }
      System.setProperty(ITConstants.IT_APP_LOG_DIR,appLogDirPath);
    }
  }
 else {
    appLogDirPath=COMPSsLogBaseDirPath;
    System.setProperty(ITConstants.IT_APP_LOG_DIR,appLogDirPath);
  }
  tempDirPath=appLogDirPath + "String_Node_Str" + File.separator;
  if (!new File(tempDirPath).mkdir()) {
    ErrorManager.error(ERROR_TEMP_DIR);
  }
  jobsDirPath=appLogDirPath + "String_Node_Str" + File.separator;
  if (!new File(jobsDirPath).mkdir()) {
    ErrorManager.error(ERROR_JOBS_DIR);
  }
  workersDirPath=appLogDirPath + "String_Node_Str" + File.separator;
  if (!new File(workersDirPath).mkdir()) {
    System.err.println(ERROR_WORKERS_DIR);
    System.exit(1);
  }
}

Fixed version (ground truth):
public MasterResource(){
  super(new COMPSsMaster(),null);
  userExecutionDirPath=System.getProperty("String_Node_Str");
  boolean mustCreateExecutionSandbox=true;
  String specificOpt=System.getProperty(ITConstants.IT_SPECIFIC_LOG_DIR);
  if (specificOpt != null && !specificOpt.isEmpty()) {
    COMPSsLogBaseDirPath=specificOpt.endsWith(File.separator) ? specificOpt : specificOpt + File.separator;
    mustCreateExecutionSandbox=false;
  }
 else {
    String baseOpt=System.getProperty(ITConstants.IT_BASE_LOG_DIR);
    if (baseOpt != null && !baseOpt.isEmpty()) {
      baseOpt=baseOpt.endsWith(File.separator) ? baseOpt : baseOpt + File.separator;
      COMPSsLogBaseDirPath=baseOpt + "String_Node_Str" + File.separator;
    }
 else {
      COMPSsLogBaseDirPath=System.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator;
    }
  }
  if (!new File(COMPSsLogBaseDirPath).exists()) {
    if (!new File(COMPSsLogBaseDirPath).mkdir()) {
      ErrorManager.error(ERROR_COMPSs_LOG_BASE_DIR);
    }
  }
  if (mustCreateExecutionSandbox) {
    String appName=System.getProperty(ITConstants.IT_APP_NAME);
    if (System.getProperty(ITConstants.IT_SERVICE_NAME) != null) {
      String serviceName=System.getProperty(ITConstants.IT_SERVICE_NAME);
      int overloadCode=1;
      String appLog=COMPSsLogBaseDirPath + serviceName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
      String oldest=appLog;
      while ((new File(appLog).exists()) && (overloadCode <= MAX_OVERLOAD)) {
        if (new File(oldest).lastModified() > new File(appLog).lastModified()) {
          oldest=appLog;
        }
        overloadCode=overloadCode + 1;
        if (overloadCode < 10) {
          appLog=COMPSsLogBaseDirPath + serviceName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
        }
 else {
          appLog=COMPSsLogBaseDirPath + serviceName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
        }
      }
      if (overloadCode > MAX_OVERLOAD) {
        appLog=oldest;
        System.err.println(WARN_FOLDER_OVERLOAD);
        System.err.println("String_Node_Str" + appLog);
        if (!deleteDirectory(new File(appLog))) {
          ErrorManager.error(ERROR_APP_OVERLOAD);
        }
      }
      appLogDirPath=appLog;
      if (!new File(appLogDirPath).mkdir()) {
        ErrorManager.error(ERROR_APP_LOG_DIR);
      }
      System.setProperty(ITConstants.IT_APP_LOG_DIR,appLogDirPath);
    }
 else {
      int overloadCode=1;
      String appLog=COMPSsLogBaseDirPath + appName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
      String oldest=appLog;
      while ((new File(appLog).exists()) && (overloadCode <= MAX_OVERLOAD)) {
        if (new File(oldest).lastModified() > new File(appLog).lastModified()) {
          oldest=appLog;
        }
        overloadCode=overloadCode + 1;
        if (overloadCode < 10) {
          appLog=COMPSsLogBaseDirPath + appName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
        }
 else {
          appLog=COMPSsLogBaseDirPath + appName + "String_Node_Str"+ String.valueOf(overloadCode)+ File.separator;
        }
      }
      if (overloadCode > MAX_OVERLOAD) {
        appLog=oldest;
        System.err.println(WARN_FOLDER_OVERLOAD);
        System.err.println("String_Node_Str" + appLog);
        if (!deleteDirectory(new File(appLog))) {
          ErrorManager.error(ERROR_APP_OVERLOAD);
        }
      }
      appLogDirPath=appLog;
      if (!new File(appLogDirPath).mkdir()) {
        ErrorManager.error(ERROR_APP_LOG_DIR);
      }
      System.setProperty(ITConstants.IT_APP_LOG_DIR,appLogDirPath);
    }
  }
 else {
    appLogDirPath=COMPSsLogBaseDirPath;
    System.setProperty(ITConstants.IT_APP_LOG_DIR,appLogDirPath);
  }
  tempDirPath=appLogDirPath + "String_Node_Str" + File.separator;
  if (!new File(tempDirPath).mkdir()) {
    ErrorManager.error(ERROR_TEMP_DIR);
  }
  jobsDirPath=appLogDirPath + "String_Node_Str" + File.separator;
  if (!new File(jobsDirPath).mkdir()) {
    ErrorManager.error(ERROR_JOBS_DIR);
  }
  workersDirPath=appLogDirPath + "String_Node_Str" + File.separator;
  if (!new File(workersDirPath).mkdir()) {
    System.err.println(ERROR_WORKERS_DIR);
    System.exit(1);
  }
}