Program: 3651
Project: 3651
Buggy source:
protected void doDSPost(Context c,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  String button=UIUtil.getSubmitButton(request,"String_Node_Str");
  if (button.equals("String_Node_Str")) {
    Collection[] collections=Collection.findAll(c);
    request.setAttribute("String_Node_Str",collections);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Community[] communities=Community.findAll(c);
    request.setAttribute("String_Node_Str",communities);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Collection[] collections=Collection.findAll(c);
    Group[] groups=Group.findAll(c,Group.NAME);
    request.setAttribute("String_Node_Str",collections);
    request.setAttribute("String_Node_Str",groups);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Collection collection=Collection.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    List policies=AuthorizeManager.getPolicies(c,collection);
    request.setAttribute("String_Node_Str",collection);
    request.setAttribute("String_Node_Str",policies);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Community target=Community.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    List policies=AuthorizeManager.getPolicies(c,target);
    request.setAttribute("String_Node_Str",target);
    request.setAttribute("String_Node_Str",policies);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Collection collection=Collection.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    ResourcePolicy policy=ResourcePolicy.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    policy.delete();
    request.setAttribute("String_Node_Str",collection);
    List policies=AuthorizeManager.getPolicies(c,collection);
    request.setAttribute("String_Node_Str",policies);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Community community=Community.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    ResourcePolicy policy=ResourcePolicy.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    policy.delete();
    request.setAttribute("String_Node_Str",community);
    List policies=AuthorizeManager.getPolicies(c,community);
    request.setAttribute("String_Node_Str",policies);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Collection collection=Collection.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    int policy_id=UIUtil.getIntParameter(request,"String_Node_Str");
    ResourcePolicy policy=null;
    if (policy_id == -1) {
      policy=ResourcePolicy.create(c);
      policy.update();
    }
 else {
      policy=ResourcePolicy.find(c,policy_id);
    }
    Group[] groups=Group.findAll(c,Group.NAME);
    EPerson[] epeople=EPerson.findAll(c,EPerson.EMAIL);
    request.setAttribute("String_Node_Str","String_Node_Str" + collection.getID());
    request.setAttribute("String_Node_Str",policy);
    request.setAttribute("String_Node_Str",groups);
    request.setAttribute("String_Node_Str",epeople);
    request.setAttribute("String_Node_Str","String_Node_Str");
    request.setAttribute("String_Node_Str","String_Node_Str" + collection.getID());
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Community community=Community.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    int policy_id=UIUtil.getIntParameter(request,"String_Node_Str");
    ResourcePolicy policy=null;
    if (policy_id == -1) {
      policy=ResourcePolicy.create(c);
      policy.update();
    }
 else {
      policy=ResourcePolicy.find(c,policy_id);
    }
    Group[] groups=Group.findAll(c,Group.NAME);
    EPerson[] epeople=EPerson.findAll(c,EPerson.EMAIL);
    request.setAttribute("String_Node_Str","String_Node_Str" + community.getID());
    request.setAttribute("String_Node_Str",policy);
    request.setAttribute("String_Node_Str",groups);
    request.setAttribute("String_Node_Str",epeople);
    request.setAttribute("String_Node_Str","String_Node_Str");
    request.setAttribute("String_Node_Str","String_Node_Str" + community.getID());
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    ResourcePolicy policy=ResourcePolicy.create(c);
    policy.update();
    Collection collection=Collection.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    Group[] groups=Group.findAll(c,Group.NAME);
    EPerson[] epeople=EPerson.findAll(c,EPerson.EMAIL);
    request.setAttribute("String_Node_Str","String_Node_Str" + collection.getID());
    request.setAttribute("String_Node_Str",policy);
    request.setAttribute("String_Node_Str",groups);
    request.setAttribute("String_Node_Str",epeople);
    request.setAttribute("String_Node_Str","String_Node_Str");
    request.setAttribute("String_Node_Str","String_Node_Str" + collection.getID());
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    ResourcePolicy policy=ResourcePolicy.create(c);
    policy.update();
    Community community=Community.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    Group[] groups=Group.findAll(c,Group.NAME);
    EPerson[] epeople=EPerson.findAll(c,EPerson.EMAIL);
    request.setAttribute("String_Node_Str","String_Node_Str" + community.getID());
    request.setAttribute("String_Node_Str",policy);
    request.setAttribute("String_Node_Str",groups);
    request.setAttribute("String_Node_Str",epeople);
    request.setAttribute("String_Node_Str","String_Node_Str");
    request.setAttribute("String_Node_Str","String_Node_Str" + community.getID());
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    int policy_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int action_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int group_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int collection_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int community_id=UIUtil.getIntParameter(request,"String_Node_Str");
    Collection collection=null;
    Community community=null;
    String display_page=null;
    ResourcePolicy policy=ResourcePolicy.find(c,policy_id);
    Group group=Group.find(c,group_id);
    if (collection_id != -1) {
      collection=Collection.find(c,collection_id);
      policy.setResource(collection);
      policy.setAction(action_id);
      policy.setGroup(group);
      policy.update();
      if (action_id == Constants.READ) {
        List rps=AuthorizeManager.getPoliciesActionFilter(c,collection,Constants.READ);
        Bitstream bs=collection.getLogo();
        AuthorizeManager.removeAllPolicies(c,bs);
        AuthorizeManager.addPolicies(c,rps,bs);
      }
      request.setAttribute("String_Node_Str",collection);
      request.setAttribute("String_Node_Str",AuthorizeManager.getPolicies(c,collection));
      display_page="String_Node_Str";
    }
    if (community_id != -1) {
      community=Community.find(c,community_id);
      policy.setResource(community);
      policy.setAction(action_id);
      policy.setGroup(group);
      policy.update();
      if (action_id == Constants.READ) {
        List rps=AuthorizeManager.getPoliciesActionFilter(c,community,Constants.READ);
        Bitstream bs=community.getLogo();
        AuthorizeManager.removeAllPolicies(c,bs);
        AuthorizeManager.addPolicies(c,rps,bs);
      }
      request.setAttribute("String_Node_Str",community);
      request.setAttribute("String_Node_Str",AuthorizeManager.getPolicies(c,community));
      display_page="String_Node_Str";
    }
    JSPManager.showJSP(request,response,display_page);
  }
 else   if (button.equals("String_Node_Str")) {
    int collection_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int community_id=UIUtil.getIntParameter(request,"String_Node_Str");
    String display_page=null;
    if (collection_id != -1) {
      Collection t=Collection.find(c,collection_id);
      request.setAttribute("String_Node_Str",t);
      request.setAttribute("String_Node_Str",AuthorizeManager.getPolicies(c,t));
      display_page="String_Node_Str";
    }
 else     if (community_id != -1) {
      Community t=Community.find(c,community_id);
      request.setAttribute("String_Node_Str",t);
      request.setAttribute("String_Node_Str",AuthorizeManager.getPolicies(c,t));
      display_page="String_Node_Str";
    }
    JSPManager.showJSP(request,response,display_page);
  }
 else   if (button.equals("String_Node_Str")) {
    int collection_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int resource_type=UIUtil.getIntParameter(request,"String_Node_Str");
    PolicySet.setPolicies(c,Constants.COLLECTION,collection_id,resource_type,0,0,false,true);
    if (resource_type == Constants.BITSTREAM) {
      PolicySet.setPolicies(c,Constants.COLLECTION,collection_id,Constants.BUNDLE,0,0,false,true);
    }
    showMainPage(c,request,response);
  }
 else   if (button.equals("String_Node_Str")) {
    int collection_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int resource_type=UIUtil.getIntParameter(request,"String_Node_Str");
    int action_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int group_id=UIUtil.getIntParameter(request,"String_Node_Str");
    PolicySet.setPolicies(c,Constants.COLLECTION,collection_id,resource_type,action_id,group_id,false,false);
    if (resource_type == Constants.BITSTREAM) {
      PolicySet.setPolicies(c,Constants.COLLECTION,collection_id,Constants.BUNDLE,action_id,group_id,false,false);
    }
    showMainPage(c,request,response);
  }
 else {
    showMainPage(c,request,response);
  }
  c.complete();
}

Fixed version (ground truth):
protected void doDSPost(Context c,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  String button=UIUtil.getSubmitButton(request,"String_Node_Str");
  if (button.equals("String_Node_Str")) {
    Collection[] collections=Collection.findAll(c);
    request.setAttribute("String_Node_Str",collections);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Community[] communities=Community.findAll(c);
    request.setAttribute("String_Node_Str",communities);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Collection[] collections=Collection.findAll(c);
    Group[] groups=Group.findAll(c,Group.NAME);
    request.setAttribute("String_Node_Str",collections);
    request.setAttribute("String_Node_Str",groups);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Collection collection=Collection.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    List policies=AuthorizeManager.getPolicies(c,collection);
    request.setAttribute("String_Node_Str",collection);
    request.setAttribute("String_Node_Str",policies);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Community target=Community.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    List policies=AuthorizeManager.getPolicies(c,target);
    request.setAttribute("String_Node_Str",target);
    request.setAttribute("String_Node_Str",policies);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Collection collection=Collection.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    ResourcePolicy policy=ResourcePolicy.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    policy.delete();
    request.setAttribute("String_Node_Str",collection);
    List policies=AuthorizeManager.getPolicies(c,collection);
    request.setAttribute("String_Node_Str",policies);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Community community=Community.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    ResourcePolicy policy=ResourcePolicy.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    policy.delete();
    request.setAttribute("String_Node_Str",community);
    List policies=AuthorizeManager.getPolicies(c,community);
    request.setAttribute("String_Node_Str",policies);
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Collection collection=Collection.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    int policy_id=UIUtil.getIntParameter(request,"String_Node_Str");
    ResourcePolicy policy=null;
    if (policy_id == -1) {
      policy=ResourcePolicy.create(c);
      policy.update();
    }
 else {
      policy=ResourcePolicy.find(c,policy_id);
    }
    Group[] groups=Group.findAll(c,Group.NAME);
    EPerson[] epeople=EPerson.findAll(c,EPerson.EMAIL);
    request.setAttribute("String_Node_Str","String_Node_Str" + collection.getID());
    request.setAttribute("String_Node_Str",policy);
    request.setAttribute("String_Node_Str",groups);
    request.setAttribute("String_Node_Str",epeople);
    request.setAttribute("String_Node_Str","String_Node_Str");
    request.setAttribute("String_Node_Str","String_Node_Str" + collection.getID());
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    Community community=Community.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    int policy_id=UIUtil.getIntParameter(request,"String_Node_Str");
    ResourcePolicy policy=null;
    if (policy_id == -1) {
      policy=ResourcePolicy.create(c);
      policy.update();
    }
 else {
      policy=ResourcePolicy.find(c,policy_id);
    }
    Group[] groups=Group.findAll(c,Group.NAME);
    EPerson[] epeople=EPerson.findAll(c,EPerson.EMAIL);
    request.setAttribute("String_Node_Str","String_Node_Str" + community.getID());
    request.setAttribute("String_Node_Str",policy);
    request.setAttribute("String_Node_Str",groups);
    request.setAttribute("String_Node_Str",epeople);
    request.setAttribute("String_Node_Str","String_Node_Str");
    request.setAttribute("String_Node_Str","String_Node_Str" + community.getID());
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    ResourcePolicy policy=ResourcePolicy.create(c);
    policy.update();
    Collection collection=Collection.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    Group[] groups=Group.findAll(c,Group.NAME);
    EPerson[] epeople=EPerson.findAll(c,EPerson.EMAIL);
    request.setAttribute("String_Node_Str","String_Node_Str" + collection.getID());
    request.setAttribute("String_Node_Str",policy);
    request.setAttribute("String_Node_Str",groups);
    request.setAttribute("String_Node_Str",epeople);
    request.setAttribute("String_Node_Str","String_Node_Str");
    request.setAttribute("String_Node_Str","String_Node_Str" + collection.getID());
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    ResourcePolicy policy=ResourcePolicy.create(c);
    policy.update();
    Community community=Community.find(c,UIUtil.getIntParameter(request,"String_Node_Str"));
    Group[] groups=Group.findAll(c,Group.NAME);
    EPerson[] epeople=EPerson.findAll(c,EPerson.EMAIL);
    request.setAttribute("String_Node_Str","String_Node_Str" + community.getID());
    request.setAttribute("String_Node_Str",policy);
    request.setAttribute("String_Node_Str",groups);
    request.setAttribute("String_Node_Str",epeople);
    request.setAttribute("String_Node_Str","String_Node_Str");
    request.setAttribute("String_Node_Str","String_Node_Str" + community.getID());
    JSPManager.showJSP(request,response,"String_Node_Str");
  }
 else   if (button.equals("String_Node_Str")) {
    int policy_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int action_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int group_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int collection_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int community_id=UIUtil.getIntParameter(request,"String_Node_Str");
    Collection collection=null;
    Community community=null;
    String display_page=null;
    ResourcePolicy policy=ResourcePolicy.find(c,policy_id);
    Group group=Group.find(c,group_id);
    if (collection_id != -1) {
      collection=Collection.find(c,collection_id);
      policy.setResource(collection);
      policy.setAction(action_id);
      policy.setGroup(group);
      policy.update();
      if (action_id == Constants.READ) {
        List rps=AuthorizeManager.getPoliciesActionFilter(c,collection,Constants.READ);
        Bitstream bs=collection.getLogo();
        if (bs != null) {
          AuthorizeManager.removeAllPolicies(c,bs);
          AuthorizeManager.addPolicies(c,rps,bs);
        }
      }
      request.setAttribute("String_Node_Str",collection);
      request.setAttribute("String_Node_Str",AuthorizeManager.getPolicies(c,collection));
      display_page="String_Node_Str";
    }
    if (community_id != -1) {
      community=Community.find(c,community_id);
      policy.setResource(community);
      policy.setAction(action_id);
      policy.setGroup(group);
      policy.update();
      if (action_id == Constants.READ) {
        List rps=AuthorizeManager.getPoliciesActionFilter(c,community,Constants.READ);
        Bitstream bs=community.getLogo();
        if (bs != null) {
          AuthorizeManager.removeAllPolicies(c,bs);
          AuthorizeManager.addPolicies(c,rps,bs);
        }
      }
      request.setAttribute("String_Node_Str",community);
      request.setAttribute("String_Node_Str",AuthorizeManager.getPolicies(c,community));
      display_page="String_Node_Str";
    }
    JSPManager.showJSP(request,response,display_page);
  }
 else   if (button.equals("String_Node_Str")) {
    int collection_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int community_id=UIUtil.getIntParameter(request,"String_Node_Str");
    String display_page=null;
    if (collection_id != -1) {
      Collection t=Collection.find(c,collection_id);
      request.setAttribute("String_Node_Str",t);
      request.setAttribute("String_Node_Str",AuthorizeManager.getPolicies(c,t));
      display_page="String_Node_Str";
    }
 else     if (community_id != -1) {
      Community t=Community.find(c,community_id);
      request.setAttribute("String_Node_Str",t);
      request.setAttribute("String_Node_Str",AuthorizeManager.getPolicies(c,t));
      display_page="String_Node_Str";
    }
    JSPManager.showJSP(request,response,display_page);
  }
 else   if (button.equals("String_Node_Str")) {
    int collection_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int resource_type=UIUtil.getIntParameter(request,"String_Node_Str");
    PolicySet.setPolicies(c,Constants.COLLECTION,collection_id,resource_type,0,0,false,true);
    if (resource_type == Constants.BITSTREAM) {
      PolicySet.setPolicies(c,Constants.COLLECTION,collection_id,Constants.BUNDLE,0,0,false,true);
    }
    showMainPage(c,request,response);
  }
 else   if (button.equals("String_Node_Str")) {
    int collection_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int resource_type=UIUtil.getIntParameter(request,"String_Node_Str");
    int action_id=UIUtil.getIntParameter(request,"String_Node_Str");
    int group_id=UIUtil.getIntParameter(request,"String_Node_Str");
    PolicySet.setPolicies(c,Constants.COLLECTION,collection_id,resource_type,action_id,group_id,false,false);
    if (resource_type == Constants.BITSTREAM) {
      PolicySet.setPolicies(c,Constants.COLLECTION,collection_id,Constants.BUNDLE,action_id,group_id,false,false);
    }
    showMainPage(c,request,response);
  }
 else {
    showMainPage(c,request,response);
  }
  c.complete();
}