Program: 89854
Project: 89854
Buggy source:
/** 
 * Creates the script for creating the application specified 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.SLASH + 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 != 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.
 * @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.SLASH + 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();
}