Program: 89825
Project: 89825
Buggy source:
/** 
 * Creates the script for creating the application specified directories. Also creates the directories along the path to the directories.
 * @return The script for creating the application specified directories.
 */
@Override protected String getAppDirectories(){
  StringBuilder res=new StringBuilder();
  String[] dirs;
  for (  Application app : applications) {
    dirs=app.getSettingsValues(Constants.SETTINGS_BITARCHIVE_BASEFILEDIR_LEAF);
    if (dirs != null && dirs.length > 0) {
      for (      String dir : dirs) {
        res.append(createPathToDir(dir));
        res.append(scriptCreateDir(dir,false));
        for (        String subdir : Constants.BASEFILEDIR_SUBDIRECTORIES) {
          res.append(scriptCreateDir(dir + Constants.BACKSLASH + subdir,false));
        }
      }
    }
    dirs=app.getSettingsValues(Constants.SETTINGS_HARVEST_SERVERDIR_LEAF);
    if (dirs != null && dirs.length > 0) {
      for (      String dir : dirs) {
        res.append(createPathToDir(dir));
        res.append(scriptCreateDir(dir,false));
      }
    }
    dirs=app.getSettingsValues(Constants.SETTINGS_VIEWERPROXY_BASEDIR_LEAF);
    if (dirs != null && dirs.length > 0) {
      for (      String dir : dirs) {
        res.append(createPathToDir(dir));
        res.append(scriptCreateDir(dir,false));
      }
    }
    dirs=app.getSettingsValues(Constants.SETTINGS_TEMPDIR_LEAF);
    if (dirs != null && dirs.length > 0) {
      String machineDir=settings.getLeafValue(Constants.SETTINGS_TEMPDIR_LEAF);
      for (      String dir : dirs) {
        if (dir.equals(machineDir)) {
          res.append(createPathToDir(dir));
          res.append(scriptCreateDir(dir,resetTempDir));
        }
      }
    }
  }
  return res.toString();
}

Fixed version (ground truth):
/** 
 * Creates the script for creating the application specified directories. Also creates the directories along the path to the directories.
 * @return The script for creating the application specified directories.
 */
@Override protected String getAppDirectories(){
  StringBuilder res=new StringBuilder();
  String[] dirs;
  for (  Application app : applications) {
    dirs=app.getSettingsValues(Constants.SETTINGS_BITARCHIVE_BASEFILEDIR_LEAF);
    if (dirs != null && dirs.length > 0) {
      for (      String dir : dirs) {
        res.append(createPathToDir(dir));
        res.append(scriptCreateDir(dir,false));
        for (        String subdir : Constants.BASEFILEDIR_SUBDIRECTORIES) {
          res.append(scriptCreateDir(dir + Constants.BACKSLASH + subdir,false));
        }
      }
    }
    dirs=app.getSettingsValues(Constants.SETTINGS_HARVEST_SERVERDIR_LEAF);
    if (dirs != null && dirs.length > 0) {
      for (      String dir : dirs) {
        res.append(createPathToDir(dir));
        res.append(scriptCreateDir(dir,false));
      }
    }
    dirs=app.getSettingsValues(Constants.SETTINGS_VIEWERPROXY_BASEDIR_LEAF);
    if (dirs != null && dirs.length > 0) {
      for (      String dir : dirs) {
        res.append(createPathToDir(dir));
        res.append(scriptCreateDir(dir,false));
      }
    }
    dirs=app.getSettingsValues(Constants.SETTINGS_TEMPDIR_LEAF);
    if (dirs != null && dirs.length > 0) {
      String machineDir=settings.getLeafValue(Constants.SETTINGS_TEMPDIR_LEAF);
      for (      String dir : dirs) {
        if (!dir.equals(machineDir)) {
          res.append(createPathToDir(dir));
          res.append(scriptCreateDir(dir,resetTempDir));
        }
      }
    }
  }
  return res.toString();
}