Program: 87068
Project: 87068
Buggy source:
/** 
 * Edits an existing access rule. Either user or group name, but not both  must be specified. Arguments prefixed with "new" indicate new values for the access rule. Multiple changes may be specified at once.
 * @param repositoryName Repository name
 * @param path Relative path string
 * @param userName User name
 * @param groupName Group name
 * @param newRepositoryName New repository name
 * @param newPathString New relative path string
 * @param newUserName New user name
 * @param newGroupName New group name
 * @param newAccess New access level
 * @throws ApplicationException Error occurred
 */
private static void editRule(String repositoryName,String path,String userName,String groupName,String newRepositoryName,String newPathString,String newUserName,String newGroupName,String newAccess) throws ApplicationException {
  if (path == null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  if (userName == null && groupName == null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  if (userName != null && groupName != null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  if (newUserName != null && newGroupName != null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  AccessRule rule=null;
  if (userName == null) {
    User user=Document.findUser(userName);
    if (user == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",userName));
    }
    Repository repository=null;
    if (repositoryName != null) {
      repository=Document.findRepository(repositoryName);
      if (repository == null) {
        throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",repositoryName));
      }
    }
    rule=Document.findUserAccessRule(repository,path,user);
    if (rule == null) {
      throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
    }
  }
 else   if (groupName == null) {
    Group group=Document.findGroup(groupName);
    if (group == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",groupName));
    }
    Repository repository=null;
    if (repositoryName != null) {
      repository=Document.findRepository(repositoryName);
      if (repository == null) {
        throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",repositoryName));
      }
    }
    rule=Document.findGroupAccessRule(repository,path,group);
    if (rule == null) {
      throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
    }
  }
 else {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  if (newRepositoryName != null) {
    Repository newRepository=Document.findRepository(newRepositoryName);
    if (newRepository == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",repositoryName));
    }
    rule.getPath().setRepository(newRepository);
  }
  if (newPathString != null) {
    Path newPath=Document.addPath(rule.getPath().getRepository(),newPathString);
    rule.setPath(newPath);
  }
  if (newUserName != null) {
    User newUser=Document.addUser(newUserName);
    if (newUser == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",userName));
    }
    rule.setUser(newUser);
    rule.setGroup(null);
  }
  if (newGroupName != null) {
    Group newGroup=Document.findGroup(newGroupName);
    if (newGroup == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",groupName));
    }
    rule.setUser(null);
    rule.setGroup(newGroup);
  }
  if (newAccess != null) {
    String newAccessLevel=(newAccess.equals(Constants.ACCESS_LEVEL_NONE)) ? Constants.ACCESS_LEVEL_DENY_ACCESS : newAccess;
    rule.setLevel(newAccessLevel);
  }
}

Fixed version (ground truth):
/** 
 * Edits an existing access rule. Either user or group name, but not both  must be specified. Arguments prefixed with "new" indicate new values for the access rule. Multiple changes may be specified at once.
 * @param repositoryName Repository name
 * @param path Relative path string
 * @param userName User name
 * @param groupName Group name
 * @param newRepositoryName New repository name
 * @param newPathString New relative path string
 * @param newUserName New user name
 * @param newGroupName New group name
 * @param newAccess New access level
 * @throws ApplicationException Error occurred
 */
private static void editRule(String repositoryName,String path,String userName,String groupName,String newRepositoryName,String newPathString,String newUserName,String newGroupName,String newAccess) throws ApplicationException {
  if (path == null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  if (userName == null && groupName == null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  if (userName != null && groupName != null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  if (newUserName != null && newGroupName != null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  AccessRule rule=null;
  if (userName != null) {
    User user=Document.findUser(userName);
    if (user == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",userName));
    }
    Repository repository=null;
    if (repositoryName != null) {
      repository=Document.findRepository(repositoryName);
      if (repository == null) {
        throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",repositoryName));
      }
    }
    rule=Document.findUserAccessRule(repository,path,user);
    if (rule == null) {
      throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
    }
  }
 else   if (groupName != null) {
    Group group=Document.findGroup(groupName);
    if (group == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",groupName));
    }
    Repository repository=null;
    if (repositoryName != null) {
      repository=Document.findRepository(repositoryName);
      if (repository == null) {
        throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",repositoryName));
      }
    }
    rule=Document.findGroupAccessRule(repository,path,group);
    if (rule == null) {
      throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
    }
  }
 else {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  if (newRepositoryName != null) {
    Repository newRepository=Document.findRepository(newRepositoryName);
    if (newRepository == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",repositoryName));
    }
    rule.getPath().setRepository(newRepository);
  }
  if (newPathString != null) {
    Path newPath=Document.addPath(rule.getPath().getRepository(),newPathString);
    rule.setPath(newPath);
  }
  if (newUserName != null) {
    User newUser=Document.addUser(newUserName);
    if (newUser == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",userName));
    }
    rule.setUser(newUser);
    rule.setGroup(null);
  }
  if (newGroupName != null) {
    Group newGroup=Document.findGroup(newGroupName);
    if (newGroup == null) {
      throw new ApplicationException(ResourceUtil.getFormattedString("String_Node_Str",groupName));
    }
    rule.setUser(null);
    rule.setGroup(newGroup);
  }
  if (newAccess != null) {
    String newAccessLevel=(newAccess.equals(Constants.ACCESS_LEVEL_NONE)) ? Constants.ACCESS_LEVEL_DENY_ACCESS : newAccess;
    rule.setLevel(newAccessLevel);
  }
}