Program: 87070
Project: 87070
Buggy source:
/** 
 * Add a new access rule. Either user or group name, but not both must be  specified. All other arguments are required.
 * @param repositoryName Repository name
 * @param path Relative path string
 * @param userName User name
 * @param groupName Group name
 * @param access Access level
 * @throws ApplicationException Error occurred
 */
private static void addRule(String repositoryName,String path,String userName,String groupName,String access) 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 (access == null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  access=access.equals(Constants.ACCESS_LEVEL_NONE) ? Constants.ACCESS_LEVEL_DENY_ACCESS : access;
  if (userName != null) {
    if (repositoryName == null) {
      Document.addServerAccessRuleForUser(userName,access);
    }
 else {
      Document.addAccessRuleForUser(Document.addRepository(repositoryName),path,Document.addUser(userName),access);
    }
  }
 else   if (groupName != null) {
    if (repositoryName == null) {
      Document.addServerAccessRuleForGroup(groupName,access);
    }
 else {
      Document.addAccessRuleForGroup(Document.addRepository(repositoryName),path,Document.addGroup(groupName,null,null),access);
    }
  }
 else {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
}

Fixed version (ground truth):
/** 
 * Add a new access rule. Either user or group name, but not both must be  specified. All other arguments are required.
 * @param repositoryName Repository name
 * @param path Relative path string
 * @param userName User name
 * @param groupName Group name
 * @param access Access level
 * @throws ApplicationException Error occurred
 */
private static void addRule(String repositoryName,String path,String userName,String groupName,String access) 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 (access == null) {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
  access=access.equals(Constants.ACCESS_LEVEL_NONE) ? Constants.ACCESS_LEVEL_DENY_ACCESS : access;
  if (userName != null) {
    if (repositoryName == null) {
      Document.addAccessRuleForUser(null,path,Document.addUser(userName),access);
    }
 else {
      Document.addAccessRuleForUser(Document.addRepository(repositoryName),path,Document.addUser(userName),access);
    }
  }
 else   if (groupName != null) {
    if (repositoryName == null) {
      Document.addAccessRuleForGroup(null,path,Document.addGroup(groupName,null,null),access);
    }
 else {
      Document.addAccessRuleForGroup(Document.addRepository(repositoryName),path,Document.addGroup(groupName,null,null),access);
    }
  }
 else {
    throw new ApplicationException(ResourceUtil.getString("String_Node_Str"));
  }
}