Program: 3570
Project: 3570
Buggy source:
protected void doDSPost(Context c,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  int groupID=UIUtil.getIntParameter(request,"String_Node_Str");
  Group group=null;
  if (groupID >= 0) {
    group=Group.find(c,groupID);
  }
  if (group != null) {
    AuthorizeManager.authorizeAction(c,group,Constants.ADD);
    boolean submit_edit=(request.getParameter("String_Node_Str") != null);
    boolean submit_group_update=(request.getParameter("String_Node_Str") != null);
    boolean submit_group_delete=(request.getParameter("String_Node_Str") != null);
    if (submit_edit && !submit_group_update && !submit_group_delete) {
      request.setAttribute("String_Node_Str",group);
      request.setAttribute("String_Node_Str",group.getMembers());
      request.setAttribute("String_Node_Str",group.getMemberGroups());
      JSPManager.showJSP(request,response,"String_Node_Str");
    }
 else     if (submit_group_update) {
      String newName=request.getParameter("String_Node_Str");
      if (!newName.equals(group.getName())) {
        group.setName(newName);
        group.update();
      }
      int[] eperson_ids=UIUtil.getIntParameters(request,"String_Node_Str");
      int[] group_ids=UIUtil.getIntParameters(request,"String_Node_Str");
      EPerson[] members=group.getMembers();
      Group[] membergroups=group.getMemberGroups();
      if (eperson_ids != null) {
        Set memberSet=new HashSet();
        Set epersonIDSet=new HashSet();
        for (int x=0; x < members.length; x++) {
          Integer epersonID=new Integer(members[x].getID());
          memberSet.add(epersonID);
        }
        for (int x=0; x < eperson_ids.length; x++) {
          epersonIDSet.add(new Integer(eperson_ids[x]));
        }
        Iterator i=epersonIDSet.iterator();
        while (i.hasNext()) {
          Integer currentID=(Integer)i.next();
          if (!memberSet.contains(currentID)) {
            group.addMember(EPerson.find(c,currentID.intValue()));
          }
        }
        for (int x=0; x < members.length; x++) {
          EPerson e=members[x];
          if (!epersonIDSet.contains(new Integer(e.getID()))) {
            group.removeMember(e);
          }
        }
      }
 else {
        for (int y=0; y < members.length; y++) {
          group.removeMember(members[y]);
        }
      }
      if (group_ids != null) {
        Set memberSet=new HashSet();
        Set groupIDSet=new HashSet();
        for (int x=0; x < membergroups.length; x++) {
          Integer myID=new Integer(membergroups[x].getID());
          memberSet.add(myID);
        }
        for (int x=0; x < group_ids.length; x++) {
          groupIDSet.add(new Integer(group_ids[x]));
        }
        Iterator i=groupIDSet.iterator();
        while (i.hasNext()) {
          Integer currentID=(Integer)i.next();
          if (!memberSet.contains(currentID)) {
            group.addMember(Group.find(c,currentID.intValue()));
          }
        }
        for (int x=0; x < membergroups.length; x++) {
          Group g=membergroups[x];
          if (!groupIDSet.contains(new Integer(g.getID()))) {
            group.removeMember(g);
          }
        }
      }
 else {
        for (int y=0; y < membergroups.length; y++) {
          group.removeMember(membergroups[y]);
        }
      }
      group.update();
      request.setAttribute("String_Node_Str",group);
      request.setAttribute("String_Node_Str",group.getMembers());
      request.setAttribute("String_Node_Str",group.getMemberGroups());
      JSPManager.showJSP(request,response,"String_Node_Str");
      c.complete();
    }
 else     if (submit_group_delete) {
      AuthorizeManager.authorizeAction(c,group,Constants.WRITE);
      group.delete();
      showMainPage(c,request,response);
      c.complete();
    }
 else {
      request.setAttribute("String_Node_Str",group);
      request.setAttribute("String_Node_Str",group.getMembers());
      request.setAttribute("String_Node_Str",group.getMemberGroups());
      JSPManager.showJSP(request,response,"String_Node_Str");
    }
  }
 else {
    String button=UIUtil.getSubmitButton(request,"String_Node_Str");
    if (button.equals("String_Node_Str")) {
      group=Group.create(c);
      group.setName("String_Node_Str" + group.getID());
      group.update();
      request.setAttribute("String_Node_Str",group);
      request.setAttribute("String_Node_Str",group.getMembers());
      request.setAttribute("String_Node_Str",group.getMemberGroups());
      JSPManager.showJSP(request,response,"String_Node_Str");
      c.complete();
    }
 else {
      showMainPage(c,request,response);
    }
  }
}

Fixed version (ground truth):
protected void doDSPost(Context c,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  int groupID=UIUtil.getIntParameter(request,"String_Node_Str");
  Group group=null;
  if (groupID >= 0) {
    group=Group.find(c,groupID);
  }
  if (group != null) {
    AuthorizeManager.authorizeAction(c,group,Constants.ADD);
    boolean submit_edit=(request.getParameter("String_Node_Str") != null);
    boolean submit_group_update=(request.getParameter("String_Node_Str") != null);
    boolean submit_group_delete=(request.getParameter("String_Node_Str") != null);
    if (submit_edit && !submit_group_update && !submit_group_delete) {
      request.setAttribute("String_Node_Str",group);
      request.setAttribute("String_Node_Str",group.getMembers());
      request.setAttribute("String_Node_Str",group.getMemberGroups());
      JSPManager.showJSP(request,response,"String_Node_Str");
    }
 else     if (submit_group_update) {
      String newName=request.getParameter("String_Node_Str");
      if (!newName.equals(group.getName())) {
        group.setName(newName);
        group.update();
      }
      int[] eperson_ids=UIUtil.getIntParameters(request,"String_Node_Str");
      int[] group_ids=UIUtil.getIntParameters(request,"String_Node_Str");
      EPerson[] members=group.getMembers();
      Group[] membergroups=group.getMemberGroups();
      if (eperson_ids != null) {
        Set memberSet=new HashSet();
        Set epersonIDSet=new HashSet();
        for (int x=0; x < members.length; x++) {
          Integer epersonID=new Integer(members[x].getID());
          memberSet.add(epersonID);
        }
        for (int x=0; x < eperson_ids.length; x++) {
          epersonIDSet.add(new Integer(eperson_ids[x]));
        }
        Iterator i=epersonIDSet.iterator();
        while (i.hasNext()) {
          Integer currentID=(Integer)i.next();
          if (!memberSet.contains(currentID)) {
            group.addMember(EPerson.find(c,currentID.intValue()));
          }
        }
        for (int x=0; x < members.length; x++) {
          EPerson e=members[x];
          if (!epersonIDSet.contains(new Integer(e.getID()))) {
            group.removeMember(e);
          }
        }
      }
 else {
        for (int y=0; y < members.length; y++) {
          group.removeMember(members[y]);
        }
      }
      if (group_ids != null) {
        Set memberSet=new HashSet();
        Set groupIDSet=new HashSet();
        for (int x=0; x < membergroups.length; x++) {
          Integer myID=new Integer(membergroups[x].getID());
          memberSet.add(myID);
        }
        for (int x=0; x < group_ids.length; x++) {
          groupIDSet.add(new Integer(group_ids[x]));
        }
        Iterator i=groupIDSet.iterator();
        while (i.hasNext()) {
          Integer currentID=(Integer)i.next();
          if (!memberSet.contains(currentID)) {
            group.addMember(Group.find(c,currentID.intValue()));
          }
        }
        for (int x=0; x < membergroups.length; x++) {
          Group g=membergroups[x];
          if (!groupIDSet.contains(new Integer(g.getID()))) {
            group.removeMember(g);
          }
        }
      }
 else {
        for (int y=0; y < membergroups.length; y++) {
          group.removeMember(membergroups[y]);
        }
      }
      group.update();
      request.setAttribute("String_Node_Str",group);
      request.setAttribute("String_Node_Str",group.getMembers());
      request.setAttribute("String_Node_Str",group.getMemberGroups());
      JSPManager.showJSP(request,response,"String_Node_Str");
      c.complete();
    }
 else     if (submit_group_delete) {
      AuthorizeManager.authorizeAction(c,group,Constants.WRITE);
      group.delete();
      showMainPage(c,request,response);
    }
 else {
      request.setAttribute("String_Node_Str",group);
      request.setAttribute("String_Node_Str",group.getMembers());
      request.setAttribute("String_Node_Str",group.getMemberGroups());
      JSPManager.showJSP(request,response,"String_Node_Str");
    }
  }
 else {
    String button=UIUtil.getSubmitButton(request,"String_Node_Str");
    if (button.equals("String_Node_Str")) {
      group=Group.create(c);
      group.setName("String_Node_Str" + group.getID());
      group.update();
      request.setAttribute("String_Node_Str",group);
      request.setAttribute("String_Node_Str",group.getMembers());
      request.setAttribute("String_Node_Str",group.getMemberGroups());
      JSPManager.showJSP(request,response,"String_Node_Str");
      c.complete();
    }
 else {
      showMainPage(c,request,response);
    }
  }
}