nus-yam/ex-repair huggingface dataset:
Program: 52294
Project: 52294
Buggy source:
/** 
 * Method for invoking subscriptions via the command line
 * @param argv command-line arguments, none used yet
 */
public static void main(String[] argv){
  Options options=new Options();
  HelpFormatter formatter=new HelpFormatter();
  CommandLine line=null;
  options.addOption(OptionBuilder.isRequired(false).withDescription("String_Node_Str").withLongOpt("String_Node_Str").create("String_Node_Str"));
  boolean test=options.hasOption("String_Node_Str");
  if (test)   log.setLevel(Level.DEBUG);
  Context context=null;
  try {
    context=new Context();
    processDaily(context,test);
    context.complete();
  }
 catch (  Exception e) {
    log.fatal(e);
  }
 finally {
    if (context != null && context.isValid()) {
      context.abort();
    }
  }
}

Fixed version (ground truth):
/** 
 * Method for invoking subscriptions via the command line
 * @param argv command-line arguments, none used yet
 */
public static void main(String[] argv){
  String usage="String_Node_Str";
  Options options=new Options();
  HelpFormatter formatter=new HelpFormatter();
  CommandLine line=null;
{
    Option opt=new Option("String_Node_Str","String_Node_Str",false,"String_Node_Str");
    opt.setRequired(false);
    options.addOption(opt);
  }
{
    Option opt=new Option("String_Node_Str","String_Node_Str",false,"String_Node_Str");
    opt.setRequired(false);
    options.addOption(opt);
  }
  try {
    line=new PosixParser().parse(options,argv);
  }
 catch (  Exception e) {
    formatter.printHelp(usage,e.getMessage(),options,"String_Node_Str");
    System.exit(1);
  }
  if (line.hasOption("String_Node_Str")) {
    formatter.printHelp(usage,options);
    System.exit(1);
  }
  boolean test=line.hasOption("String_Node_Str");
  if (test)   log.setLevel(Level.DEBUG);
  Context context=null;
  try {
    context=new Context();
    processDaily(context,test);
    context.complete();
  }
 catch (  Exception e) {
    log.fatal(e);
  }
 finally {
    if (context != null && context.isValid()) {
      context.abort();
    }
  }
}
Program: 52296
Project: 52296
Buggy source:
/** 
 * Method for invoking subscriptions via the command line
 * @param argv command-line arguments, none used yet
 */
public static void main(String[] argv){
  Options options=new Options();
  HelpFormatter formatter=new HelpFormatter();
  CommandLine line=null;
  options.addOption(OptionBuilder.isRequired(false).withDescription("String_Node_Str").withLongOpt("String_Node_Str").create("String_Node_Str"));
  boolean test=options.hasOption("String_Node_Str");
  if (test)   log.setLevel(Level.DEBUG);
  Context context=null;
  try {
    context=new Context();
    processDaily(context,test);
    context.complete();
  }
 catch (  Exception e) {
    log.fatal(e);
  }
 finally {
    if (context != null && context.isValid()) {
      context.abort();
    }
  }
}

Fixed version (ground truth):
/** 
 * Method for invoking subscriptions via the command line
 * @param argv command-line arguments, none used yet
 */
public static void main(String[] argv){
  String usage="String_Node_Str";
  Options options=new Options();
  HelpFormatter formatter=new HelpFormatter();
  CommandLine line=null;
{
    Option opt=new Option("String_Node_Str","String_Node_Str",false,"String_Node_Str");
    opt.setRequired(false);
    options.addOption(opt);
  }
{
    Option opt=new Option("String_Node_Str","String_Node_Str",false,"String_Node_Str");
    opt.setRequired(false);
    options.addOption(opt);
  }
  try {
    line=new PosixParser().parse(options,argv);
  }
 catch (  Exception e) {
    formatter.printHelp(usage,e.getMessage(),options,"String_Node_Str");
    System.exit(1);
  }
  if (line.hasOption("String_Node_Str")) {
    formatter.printHelp(usage,options);
    System.exit(1);
  }
  boolean test=line.hasOption("String_Node_Str");
  if (test)   log.setLevel(Level.DEBUG);
  Context context=null;
  try {
    context=new Context();
    processDaily(context,test);
    context.complete();
  }
 catch (  Exception e) {
    log.fatal(e);
  }
 finally {
    if (context != null && context.isValid()) {
      context.abort();
    }
  }
}
Program: 52303
Project: 52303
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  if (CreativeCommons.isEnabled() && ccLicenseStep != null) {
    ccLicenseStep.addBody(body);
    return;
  }
  Collection collection=submission.getCollection();
  String actionURL=IdentifierService.getURL(collection).toString() + "String_Node_Str";
  String licenseText=collection.getLicense();
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  Division inner=div.addDivision("String_Node_Str");
  inner.setHead(T_head);
  inner.addPara(T_info1);
  inner.addPara(T_info2);
  Division displayLicense=inner.addDivision("String_Node_Str","String_Node_Str");
  displayLicense.addSimpleHTMLFragment(true,licenseText);
  inner.addPara(T_info3);
  List controls=inner.addList("String_Node_Str",List.TYPE_FORM);
  CheckBox decision=controls.addItem().addCheckBox("String_Node_Str");
  decision.setLabel(T_decision_label);
  decision.addOption("String_Node_Str",T_decision_checkbox);
  if (this.errorFlag == org.dspace.submit.step.LicenseStep.STATUS_LICENSE_REJECTED) {
    decision.addError(T_decision_error);
  }
  addControlButtons(controls);
  div.addHidden("String_Node_Str").setValue(knot.getId());
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  if (CreativeCommons.isEnabled() && ccLicenseStep != null) {
    ccLicenseStep.addBody(body);
    return;
  }
  Collection collection=submission.getCollection();
  String actionURL=IdentifierService.getURL(collection).toString() + "String_Node_Str" + knot.getId()+ "String_Node_Str";
  String licenseText=collection.getLicense();
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  Division inner=div.addDivision("String_Node_Str");
  inner.setHead(T_head);
  inner.addPara(T_info1);
  inner.addPara(T_info2);
  Division displayLicense=inner.addDivision("String_Node_Str","String_Node_Str");
  displayLicense.addSimpleHTMLFragment(true,licenseText);
  inner.addPara(T_info3);
  List controls=inner.addList("String_Node_Str",List.TYPE_FORM);
  CheckBox decision=controls.addItem().addCheckBox("String_Node_Str");
  decision.setLabel(T_decision_label);
  decision.addOption("String_Node_Str",T_decision_checkbox);
  if (this.errorFlag == org.dspace.submit.step.LicenseStep.STATUS_LICENSE_REJECTED) {
    decision.addError(T_decision_error);
  }
  addControlButtons(controls);
}
Program: 52304
Project: 52304
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Item item=submission.getItem();
  Collection collection=submission.getCollection();
  String actionURL=IdentifierService.getURL(collection).toString() + "String_Node_Str";
  Request request=ObjectModelHelper.getRequest(objectModel);
  String showfull=request.getParameter("String_Node_Str");
  if (showfull != null && request.getParameter("String_Node_Str") != null)   showfull=null;
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  if (showfull == null) {
    ReferenceSet referenceSet=div.addReferenceSet("String_Node_Str",ReferenceSet.TYPE_SUMMARY_VIEW);
    referenceSet.addReference(item);
    div.addPara().addButton("String_Node_Str").setValue(T_showfull);
  }
 else {
    ReferenceSet referenceSet=div.addReferenceSet("String_Node_Str",ReferenceSet.TYPE_DETAIL_VIEW);
    referenceSet.addReference(item);
    div.addPara().addButton("String_Node_Str").setValue(T_showsimple);
    div.addHidden("String_Node_Str").setValue("String_Node_Str");
  }
  List form=div.addList("String_Node_Str",List.TYPE_FORM);
  org.dspace.app.xmlui.wing.element.Item actions=form.addItem();
  actions.addButton("String_Node_Str").setValue(T_submit_resume);
  actions.addButton("String_Node_Str").setValue(T_submit_cancel);
  div.addHidden("String_Node_Str").setValue(knot.getId());
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Item item=submission.getItem();
  Collection collection=submission.getCollection();
  String actionURL=IdentifierService.getURL(collection).toString() + "String_Node_Str" + knot.getId()+ "String_Node_Str";
  Request request=ObjectModelHelper.getRequest(objectModel);
  String showfull=request.getParameter("String_Node_Str");
  if (showfull != null && request.getParameter("String_Node_Str") != null)   showfull=null;
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  if (showfull == null) {
    ReferenceSet referenceSet=div.addReferenceSet("String_Node_Str",ReferenceSet.TYPE_SUMMARY_VIEW);
    referenceSet.addReference(item);
    div.addPara().addButton("String_Node_Str").setValue(T_showfull);
  }
 else {
    ReferenceSet referenceSet=div.addReferenceSet("String_Node_Str",ReferenceSet.TYPE_DETAIL_VIEW);
    referenceSet.addReference(item);
    div.addPara().addButton("String_Node_Str").setValue(T_showsimple);
    div.addHidden("String_Node_Str").setValue("String_Node_Str");
  }
  List form=div.addList("String_Node_Str",List.TYPE_FORM);
  org.dspace.app.xmlui.wing.element.Item actions=form.addItem();
  actions.addButton("String_Node_Str").setValue(T_submit_resume);
  actions.addButton("String_Node_Str").setValue(T_submit_cancel);
}
Program: 52306
Project: 52306
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Collection collection=submission.getCollection();
  String actionURL=IdentifierService.getURL(collection).toString() + "String_Node_Str";
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  List saveOrCancel=div.addList("String_Node_Str",List.TYPE_FORM);
  saveOrCancel.setHead(T_head);
  saveOrCancel.addItem(T_info1);
  saveOrCancel.addItem().addButton("String_Node_Str").setValue(T_submit_back);
  org.dspace.app.xmlui.wing.element.Item actions=saveOrCancel.addItem();
  actions.addButton("String_Node_Str").setValue(T_submit_save);
  actions.addButton("String_Node_Str").setValue(T_submit_remove);
  div.addHidden("String_Node_Str").setValue(knot.getId());
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Collection collection=submission.getCollection();
  String actionURL=IdentifierService.getURL(collection).toString() + "String_Node_Str" + knot.getId()+ "String_Node_Str";
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  List saveOrCancel=div.addList("String_Node_Str",List.TYPE_FORM);
  saveOrCancel.setHead(T_head);
  saveOrCancel.addItem(T_info1);
  saveOrCancel.addItem().addButton("String_Node_Str").setValue(T_submit_back);
  org.dspace.app.xmlui.wing.element.Item actions=saveOrCancel.addItem();
  actions.addButton("String_Node_Str").setValue(T_submit_save);
  actions.addButton("String_Node_Str").setValue(T_submit_remove);
}
Program: 52313
Project: 52313
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  if (CreativeCommons.isEnabled() && ccLicenseStep != null) {
    ccLicenseStep.addBody(body);
    return;
  }
  Collection collection=submission.getCollection();
  String actionURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str";
  String licenseText=collection.getLicense();
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  Division inner=div.addDivision("String_Node_Str");
  inner.setHead(T_head);
  inner.addPara(T_info1);
  inner.addPara(T_info2);
  Division displayLicense=inner.addDivision("String_Node_Str","String_Node_Str");
  displayLicense.addSimpleHTMLFragment(true,licenseText);
  inner.addPara(T_info3);
  List controls=inner.addList("String_Node_Str",List.TYPE_FORM);
  CheckBox decision=controls.addItem().addCheckBox("String_Node_Str");
  decision.setLabel(T_decision_label);
  decision.addOption("String_Node_Str",T_decision_checkbox);
  if (this.errorFlag == org.dspace.submit.step.LicenseStep.STATUS_LICENSE_REJECTED) {
    log.info(LogManager.getHeader(context,"String_Node_Str",submissionInfo.getSubmissionLogInfo()));
    decision.addError(T_decision_error);
  }
  addControlButtons(controls);
  div.addHidden("String_Node_Str").setValue(knot.getId());
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  if (CreativeCommons.isEnabled() && ccLicenseStep != null) {
    ccLicenseStep.addBody(body);
    return;
  }
  Collection collection=submission.getCollection();
  String actionURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str"+ knot.getId()+ "String_Node_Str";
  String licenseText=collection.getLicense();
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  Division inner=div.addDivision("String_Node_Str");
  inner.setHead(T_head);
  inner.addPara(T_info1);
  inner.addPara(T_info2);
  Division displayLicense=inner.addDivision("String_Node_Str","String_Node_Str");
  displayLicense.addSimpleHTMLFragment(true,licenseText);
  inner.addPara(T_info3);
  List controls=inner.addList("String_Node_Str",List.TYPE_FORM);
  CheckBox decision=controls.addItem().addCheckBox("String_Node_Str");
  decision.setLabel(T_decision_label);
  decision.addOption("String_Node_Str",T_decision_checkbox);
  if (this.errorFlag == org.dspace.submit.step.LicenseStep.STATUS_LICENSE_REJECTED) {
    log.info(LogManager.getHeader(context,"String_Node_Str",submissionInfo.getSubmissionLogInfo()));
    decision.addError(T_decision_error);
  }
  addControlButtons(controls);
}
Program: 52314
Project: 52314
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Item item=submission.getItem();
  Collection collection=submission.getCollection();
  String actionURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str";
  Request request=ObjectModelHelper.getRequest(objectModel);
  String showfull=request.getParameter("String_Node_Str");
  if (showfull != null && request.getParameter("String_Node_Str") != null)   showfull=null;
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  if (showfull == null) {
    ReferenceSet referenceSet=div.addReferenceSet("String_Node_Str",ReferenceSet.TYPE_SUMMARY_VIEW);
    referenceSet.addReference(item);
    div.addPara().addButton("String_Node_Str").setValue(T_showfull);
  }
 else {
    ReferenceSet referenceSet=div.addReferenceSet("String_Node_Str",ReferenceSet.TYPE_DETAIL_VIEW);
    referenceSet.addReference(item);
    div.addPara().addButton("String_Node_Str").setValue(T_showsimple);
    div.addHidden("String_Node_Str").setValue("String_Node_Str");
  }
  List form=div.addList("String_Node_Str",List.TYPE_FORM);
  org.dspace.app.xmlui.wing.element.Item actions=form.addItem();
  actions.addButton("String_Node_Str").setValue(T_submit_resume);
  actions.addButton("String_Node_Str").setValue(T_submit_cancel);
  div.addHidden("String_Node_Str").setValue(knot.getId());
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Item item=submission.getItem();
  Collection collection=submission.getCollection();
  String actionURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str"+ knot.getId()+ "String_Node_Str";
  Request request=ObjectModelHelper.getRequest(objectModel);
  String showfull=request.getParameter("String_Node_Str");
  if (showfull != null && request.getParameter("String_Node_Str") != null)   showfull=null;
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  if (showfull == null) {
    ReferenceSet referenceSet=div.addReferenceSet("String_Node_Str",ReferenceSet.TYPE_SUMMARY_VIEW);
    referenceSet.addReference(item);
    div.addPara().addButton("String_Node_Str").setValue(T_showfull);
  }
 else {
    ReferenceSet referenceSet=div.addReferenceSet("String_Node_Str",ReferenceSet.TYPE_DETAIL_VIEW);
    referenceSet.addReference(item);
    div.addPara().addButton("String_Node_Str").setValue(T_showsimple);
    div.addHidden("String_Node_Str").setValue("String_Node_Str");
  }
  List form=div.addList("String_Node_Str",List.TYPE_FORM);
  org.dspace.app.xmlui.wing.element.Item actions=form.addItem();
  actions.addButton("String_Node_Str").setValue(T_submit_resume);
  actions.addButton("String_Node_Str").setValue(T_submit_cancel);
}
Program: 52316
Project: 52316
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Collection collection=submission.getCollection();
  String actionURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str";
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  List saveOrCancel=div.addList("String_Node_Str",List.TYPE_FORM);
  saveOrCancel.setHead(T_head);
  saveOrCancel.addItem(T_info1);
  saveOrCancel.addItem().addButton("String_Node_Str").setValue(T_submit_back);
  org.dspace.app.xmlui.wing.element.Item actions=saveOrCancel.addItem();
  actions.addButton("String_Node_Str").setValue(T_submit_save);
  actions.addButton("String_Node_Str").setValue(T_submit_remove);
  div.addHidden("String_Node_Str").setValue(knot.getId());
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Collection collection=submission.getCollection();
  String actionURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str"+ knot.getId()+ "String_Node_Str";
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  List saveOrCancel=div.addList("String_Node_Str",List.TYPE_FORM);
  saveOrCancel.setHead(T_head);
  saveOrCancel.addItem(T_info1);
  saveOrCancel.addItem().addButton("String_Node_Str").setValue(T_submit_back);
  org.dspace.app.xmlui.wing.element.Item actions=saveOrCancel.addItem();
  actions.addButton("String_Node_Str").setValue(T_submit_save);
  actions.addButton("String_Node_Str").setValue(T_submit_remove);
}
Program: 52317
Project: 52317
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Collection[] collections;
  DSpaceObject dso=HandleManager.resolveToObject(context,handle);
  if (dso != null && dso instanceof Community) {
    collections=Collection.findAuthorized(context,((Community)dso),Constants.ADD);
  }
 else {
    collections=Collection.findAuthorized(context,null,Constants.ADD);
  }
  Division div=body.addInteractiveDivision("String_Node_Str",contextPath + "String_Node_Str",Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  List list=div.addList("String_Node_Str",List.TYPE_FORM);
  list.setHead(T_head);
  Select select=list.addItem().addSelect("String_Node_Str");
  select.setLabel(T_collection);
  select.setHelp(T_collection_help);
  select.addOption("String_Node_Str",T_collection_default);
  for (  Collection collection : collections) {
    String name=collection.getMetadata("String_Node_Str");
    if (name.length() > 50)     name=name.substring(0,47) + "String_Node_Str";
    select.addOption(collection.getHandle(),name);
  }
  Button submit=list.addItem().addButton("String_Node_Str");
  submit.setValue(T_submit_next);
  div.addHidden("String_Node_Str").setValue(knot.getId());
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  Collection[] collections;
  String actionURL=contextPath + "String_Node_Str" + knot.getId()+ "String_Node_Str";
  DSpaceObject dso=HandleManager.resolveToObject(context,handle);
  if (dso != null && dso instanceof Community) {
    collections=Collection.findAuthorized(context,((Community)dso),Constants.ADD);
  }
 else {
    collections=Collection.findAuthorized(context,null,Constants.ADD);
  }
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_POST,"String_Node_Str");
  div.setHead(T_submission_head);
  List list=div.addList("String_Node_Str",List.TYPE_FORM);
  list.setHead(T_head);
  Select select=list.addItem().addSelect("String_Node_Str");
  select.setLabel(T_collection);
  select.setHelp(T_collection_help);
  select.addOption("String_Node_Str",T_collection_default);
  for (  Collection collection : collections) {
    String name=collection.getMetadata("String_Node_Str");
    if (name.length() > 50)     name=name.substring(0,47) + "String_Node_Str";
    select.addOption(collection.getHandle(),name);
  }
  Button submit=list.addItem().addButton("String_Node_Str");
  submit.setValue(T_submit_next);
}
Program: 52319
Project: 52319
Buggy source:
/** 
 * Initialise various variables, read in config etc.
 * @param context DSpace context
 */
private static void init(Context context) throws SQLException, IOException {
  if (licenseFormat != -1) {
    return;
  }
  BitstreamFormat bf=BitstreamFormat.findByShortDescription(context,"String_Node_Str");
  licenseFormat=bf.getID();
  String configFile=ConfigurationManager.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str";
  InputStream is=new FileInputStream(configFile);
  dcToMODS=new Properties();
  dcToMODS.load(is);
}

Fixed version (ground truth):
/** 
 * Initialise various variables, read in config etc.
 * @param context DSpace context
 */
private static void init(Context context) throws SQLException, IOException {
  if (licenseFormat != -1) {
    return;
  }
  BitstreamFormat bf=BitstreamFormat.findByShortDescription(context,"String_Node_Str");
  licenseFormat=bf.getID();
  String configFile=ConfigurationManager.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str";
  InputStream is=null;
  try {
    is=new FileInputStream(configFile);
    dcToMODS=new Properties();
    dcToMODS.load(is);
  }
  finally {
    if (is != null)     try {
      is.close();
    }
 catch (    IOException ioe) {
    }
  }
}
Program: 52320
Project: 52320
Buggy source:
/** 
 * read in the action map file which converts log file line actions into actions which are more understandable to humans
 * @param map     the map file
 */
public static void readMap(String map) throws IOException {
  FileReader fr=null;
  BufferedReader br=null;
  String record=null;
  try {
    fr=new FileReader(map);
    br=new BufferedReader(fr);
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str");
    return;
  }
  while ((record=br.readLine()) != null) {
    Matcher matchReal=real.matcher(record);
    if (matchReal.matches()) {
      actionMap.put(matchReal.group(1).trim(),matchReal.group(2).trim());
    }
  }
}

Fixed version (ground truth):
/** 
 * read in the action map file which converts log file line actions into actions which are more understandable to humans
 * @param map     the map file
 */
public static void readMap(String map) throws IOException {
  FileReader fr=null;
  BufferedReader br=null;
  try {
    String record=null;
    try {
      fr=new FileReader(map);
      br=new BufferedReader(fr);
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str");
      return;
    }
    while ((record=br.readLine()) != null) {
      Matcher matchReal=real.matcher(record);
      if (matchReal.matches()) {
        actionMap.put(matchReal.group(1).trim(),matchReal.group(2).trim());
      }
    }
  }
  finally {
    if (br != null)     try {
      br.close();
    }
 catch (    IOException ioe) {
    }
    if (fr != null)     try {
      fr.close();
    }
 catch (    IOException ioe) {
    }
  }
}
Program: 52321
Project: 52321
Buggy source:
/** 
 * Return a List of the policies for a group
 * @param c  current context
 * @param g  group to retrieve policies for
 * @return List of <code>ResourcePolicy</code> objects
 */
public static List<ResourcePolicy> getPoliciesForGroup(Context c,Group g) throws SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str",g.getID());
  List<ResourcePolicy> policies=new ArrayList<ResourcePolicy>();
  while (tri.hasNext()) {
    TableRow row=tri.next();
    ResourcePolicy cachepolicy=(ResourcePolicy)c.fromCache(ResourcePolicy.class,row.getIntColumn("String_Node_Str"));
    if (cachepolicy != null) {
      policies.add(cachepolicy);
    }
 else {
      policies.add(new ResourcePolicy(c,row));
    }
  }
  tri.close();
  return policies;
}

Fixed version (ground truth):
/** 
 * Return a List of the policies for a group
 * @param c  current context
 * @param g  group to retrieve policies for
 * @return List of <code>ResourcePolicy</code> objects
 */
public static List<ResourcePolicy> getPoliciesForGroup(Context c,Group g) throws SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str",g.getID());
  List<ResourcePolicy> policies=new ArrayList<ResourcePolicy>();
  try {
    while (tri.hasNext()) {
      TableRow row=tri.next();
      ResourcePolicy cachepolicy=(ResourcePolicy)c.fromCache(ResourcePolicy.class,row.getIntColumn("String_Node_Str"));
      if (cachepolicy != null) {
        policies.add(cachepolicy);
      }
 else {
        policies.add(new ResourcePolicy(c,row));
      }
    }
  }
  finally {
    if (tri != null)     tri.close();
  }
  return policies;
}
Program: 52322
Project: 52322
Buggy source:
/** 
 * Return a list of policies for an object that match the action
 * @param c context
 * @param o DSpaceObject policies relate to
 * @param actionID action (defined in class Constants)
 * @throws SQLException if there's a database problem
 */
public static List<ResourcePolicy> getPoliciesActionFilter(Context c,DSpaceObject o,int actionID) throws SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str" + "String_Node_Str",o.getType(),o.getID(),actionID);
  List<ResourcePolicy> policies=new ArrayList<ResourcePolicy>();
  while (tri.hasNext()) {
    TableRow row=tri.next();
    ResourcePolicy cachepolicy=(ResourcePolicy)c.fromCache(ResourcePolicy.class,row.getIntColumn("String_Node_Str"));
    if (cachepolicy != null) {
      policies.add(cachepolicy);
    }
 else {
      policies.add(new ResourcePolicy(c,row));
    }
  }
  tri.close();
  return policies;
}

Fixed version (ground truth):
/** 
 * Return a list of policies for an object that match the action
 * @param c context
 * @param o DSpaceObject policies relate to
 * @param actionID action (defined in class Constants)
 * @throws SQLException if there's a database problem
 */
public static List<ResourcePolicy> getPoliciesActionFilter(Context c,DSpaceObject o,int actionID) throws SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str" + "String_Node_Str",o.getType(),o.getID(),actionID);
  List<ResourcePolicy> policies=new ArrayList<ResourcePolicy>();
  try {
    while (tri.hasNext()) {
      TableRow row=tri.next();
      ResourcePolicy cachepolicy=(ResourcePolicy)c.fromCache(ResourcePolicy.class,row.getIntColumn("String_Node_Str"));
      if (cachepolicy != null) {
        policies.add(cachepolicy);
      }
 else {
        policies.add(new ResourcePolicy(c,row));
      }
    }
  }
  finally {
    if (tri != null)     tri.close();
  }
  return policies;
}
Program: 52323
Project: 52323
Buggy source:
/** 
 * Returns all groups authorized to perform an action on an object. Returns empty array if no matches.
 * @param c current context
 * @param o object
 * @param actionID ID of action frm <code>org.dspace.core.Constants</code>
 * @return array of <code>Group</code>s that can perform the specifiedaction on the specified object
 * @throws java.sql.SQLException if there's a database problem
 */
public static Group[] getAuthorizedGroups(Context c,DSpaceObject o,int actionID) throws java.sql.SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str" + "String_Node_Str",o.getType(),o.getID(),actionID);
  List<Group> groups=new ArrayList<Group>();
  while (tri.hasNext()) {
    TableRow row=tri.next();
    ResourcePolicy cachepolicy=(ResourcePolicy)c.fromCache(ResourcePolicy.class,row.getIntColumn("String_Node_Str"));
    ResourcePolicy myPolicy=null;
    if (cachepolicy != null) {
      myPolicy=cachepolicy;
    }
 else {
      myPolicy=new ResourcePolicy(c,row);
    }
    Group myGroup=myPolicy.getGroup();
    if (myGroup != null) {
      groups.add(myGroup);
    }
  }
  tri.close();
  Group[] groupArray=new Group[groups.size()];
  groupArray=groups.toArray(groupArray);
  return groupArray;
}

Fixed version (ground truth):
/** 
 * Returns all groups authorized to perform an action on an object. Returns empty array if no matches.
 * @param c current context
 * @param o object
 * @param actionID ID of action frm <code>org.dspace.core.Constants</code>
 * @return array of <code>Group</code>s that can perform the specifiedaction on the specified object
 * @throws java.sql.SQLException if there's a database problem
 */
public static Group[] getAuthorizedGroups(Context c,DSpaceObject o,int actionID) throws java.sql.SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str" + "String_Node_Str",o.getType(),o.getID(),actionID);
  List<Group> groups=new ArrayList<Group>();
  try {
    while (tri.hasNext()) {
      TableRow row=tri.next();
      ResourcePolicy cachepolicy=(ResourcePolicy)c.fromCache(ResourcePolicy.class,row.getIntColumn("String_Node_Str"));
      ResourcePolicy myPolicy=null;
      if (cachepolicy != null) {
        myPolicy=cachepolicy;
      }
 else {
        myPolicy=new ResourcePolicy(c,row);
      }
      Group myGroup=myPolicy.getGroup();
      if (myGroup != null) {
        groups.add(myGroup);
      }
    }
  }
  finally {
    if (tri != null)     tri.close();
  }
  Group[] groupArray=new Group[groups.size()];
  groupArray=groups.toArray(groupArray);
  return groupArray;
}
Program: 52324
Project: 52324
Buggy source:
/** 
 * Return a List of the policies for an object
 * @param c  current context
 * @param o  object to retrieve policies for
 * @return List of <code>ResourcePolicy</code> objects
 */
public static List<ResourcePolicy> getPolicies(Context c,DSpaceObject o) throws SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str",o.getType(),o.getID());
  List<ResourcePolicy> policies=new ArrayList();
  while (tri.hasNext()) {
    TableRow row=tri.next();
    ResourcePolicy cachepolicy=(ResourcePolicy)c.fromCache(ResourcePolicy.class,row.getIntColumn("String_Node_Str"));
    if (cachepolicy != null) {
      policies.add(cachepolicy);
    }
 else {
      policies.add(new ResourcePolicy(c,row));
    }
  }
  tri.close();
  return policies;
}

Fixed version (ground truth):
/** 
 * Return a List of the policies for an object
 * @param c  current context
 * @param o  object to retrieve policies for
 * @return List of <code>ResourcePolicy</code> objects
 */
public static List<ResourcePolicy> getPolicies(Context c,DSpaceObject o) throws SQLException {
  TableRowIterator tri=DatabaseManager.queryTable(c,"String_Node_Str","String_Node_Str",o.getType(),o.getID());
  List<ResourcePolicy> policies=new ArrayList();
  try {
    while (tri.hasNext()) {
      TableRow row=tri.next();
      ResourcePolicy cachepolicy=(ResourcePolicy)c.fromCache(ResourcePolicy.class,row.getIntColumn("String_Node_Str"));
      if (cachepolicy != null) {
        policies.add(cachepolicy);
      }
 else {
        policies.add(new ResourcePolicy(c,row));
      }
    }
  }
  finally {
    if (tri != null)     tri.close();
  }
  return policies;
}
Program: 52325
Project: 52325
Buggy source:
public ServiceDocument doServiceDocument(ServiceDocumentRequest request) throws SWORDAuthenticationException, SWORDException {
  if (log.isDebugEnabled()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  }
  try {
    SWORDContext sc=this.authenticate(request);
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + request.getUsername() + "String_Node_Str"+ request.getOnBehalfOf()));
    SWORDService service=new SWORDService();
    service.setContext(context);
    service.setSWORDContext(sc);
    ServiceDocument doc=service.getServiceDocument();
    return doc;
  }
 catch (  DSpaceSWORDException e) {
    log.error("String_Node_Str",e);
    throw new SWORDException("String_Node_Str",e);
  }
 finally {
    if (context != null) {
      context.abort();
    }
  }
}

Fixed version (ground truth):
public ServiceDocument doServiceDocument(ServiceDocumentRequest request) throws SWORDAuthenticationException, SWORDException {
  Context context=constructContext(request.getIPAddress());
  if (log.isDebugEnabled()) {
    log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
  }
  try {
    SWORDContext sc=this.authenticate(context,request);
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + request.getUsername() + "String_Node_Str"+ request.getOnBehalfOf()));
    SWORDService service=new SWORDService();
    service.setContext(context);
    service.setSWORDContext(sc);
    ServiceDocument doc=service.getServiceDocument();
    return doc;
  }
 catch (  DSpaceSWORDException e) {
    log.error("String_Node_Str",e);
    throw new SWORDException("String_Node_Str",e);
  }
 finally {
    if (context != null) {
      context.abort();
    }
  }
}
Program: 52326
Project: 52326
Buggy source:
/** 
 * Construct the context object member variable of this class using the passed IP address as part of the loggable information
 * @param ip	the ip address of the incoming request
 * @throws SWORDException
 */
private void constructContext(String ip) throws SWORDException {
  try {
    this.context=new Context();
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new SWORDException("String_Node_Str",e);
  }
  this.context.setExtraLogInfo("String_Node_Str" + ip);
}

Fixed version (ground truth):
/** 
 * Construct the context object member variable of this class using the passed IP address as part of the loggable information
 * @param ip	the ip address of the incoming request
 * @throws SWORDException
 */
private Context constructContext(String ip) throws SWORDException {
  try {
    Context context=new Context();
    context.setExtraLogInfo("String_Node_Str" + ip);
    return context;
  }
 catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new SWORDException("String_Node_Str",e);
  }
}
Program: 52328
Project: 52328
Buggy source:
public DepositResponse doDeposit(Deposit deposit) throws SWORDAuthenticationException, SWORDException {
  try {
    if (log.isDebugEnabled()) {
      log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
    }
    SWORDContext sc=this.authenticate(deposit);
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + deposit.getUsername() + "String_Node_Str"+ deposit.getOnBehalfOf()));
    DepositManager dm=new DepositManager();
    dm.setContext(context);
    dm.setDeposit(deposit);
    dm.setSWORDContext(sc);
    DepositResponse response=dm.deposit();
    if (context != null && context.isValid()) {
      context.commit();
    }
    return response;
  }
 catch (  DSpaceSWORDException e) {
    log.error("String_Node_Str",e);
    throw new SWORDAuthenticationException("String_Node_Str",e);
  }
catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new SWORDException("String_Node_Str",e);
  }
 finally {
    if (context != null && context.isValid()) {
      context.abort();
    }
  }
}

Fixed version (ground truth):
public DepositResponse doDeposit(Deposit deposit) throws SWORDAuthenticationException, SWORDException {
  Context context=constructContext(deposit.getIPAddress());
  try {
    if (log.isDebugEnabled()) {
      log.debug(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
    }
    SWORDContext sc=this.authenticate(context,deposit);
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + deposit.getUsername() + "String_Node_Str"+ deposit.getOnBehalfOf()));
    DepositManager dm=new DepositManager();
    dm.setContext(context);
    dm.setDeposit(deposit);
    dm.setSWORDContext(sc);
    DepositResponse response=dm.deposit();
    if (context != null && context.isValid()) {
      context.commit();
    }
    return response;
  }
 catch (  DSpaceSWORDException e) {
    log.error("String_Node_Str",e);
    throw new SWORDAuthenticationException("String_Node_Str",e);
  }
catch (  SQLException e) {
    log.error("String_Node_Str",e);
    throw new SWORDException("String_Node_Str",e);
  }
 finally {
    if (context != null && context.isValid()) {
      context.abort();
    }
  }
}
Program: 52329
Project: 52329
Buggy source:
/** 
 * Moves the item from one collection to another one
 * @throws SQLException
 * @throws AuthorizeException
 * @throws IOException
 */
public void move(Collection from,Collection to) throws SQLException, AuthorizeException, IOException {
  if (isOwningCollection(from)) {
    setOwningCollection(to);
    update();
  }
  to.addItem(this);
  from.removeItem(this);
}

Fixed version (ground truth):
/** 
 * Moves the item from one collection to another one
 * @throws SQLException
 * @throws AuthorizeException
 * @throws IOException
 */
public void move(Collection from,Collection to) throws SQLException, AuthorizeException, IOException {
  to.addItem(this);
  from.removeItem(this);
  if (isOwningCollection(from)) {
    setOwningCollection(to);
    update();
  }
 else {
    ourContext.addEvent(new Event(Event.MODIFY,Constants.ITEM,getID(),null));
  }
}
Program: 52330
Project: 52330
Buggy source:
/** 
 * Log the given user in as a real authenticated user. This should only be used after  a user has presented their credintals and they have been validated. 
 * @param context DSpace context
 * @param request HTTP request
 * @param eperson the eperson logged in
 */
private static void logIn(Context context,HttpServletRequest request,EPerson eperson) throws SQLException {
  if (eperson == null)   return;
  HttpSession session=request.getSession();
  context.setCurrentUser(eperson);
  if (!AuthorizeManager.isAdmin(context) && !SystemwideAlerts.canUserStartSession()) {
    context.setCurrentUser(null);
    return;
  }
  int[] groupIDs=AuthenticationManager.getSpecialGroups(context,request);
  for (  int groupID : groupIDs)   context.setSpecialGroup(groupID);
  session.setAttribute(CURRENT_IP_ADDRESS,request.getRemoteAddr());
  session.setAttribute(EFFECTIVE_USER_ID,eperson.getID());
  session.setAttribute(AUTHENTICATED_USER_ID,eperson.getID());
}

Fixed version (ground truth):
/** 
 * Log the given user in as a real authenticated user. This should only be used after  a user has presented their credintals and they have been validated. This method  signature is provided to be easier to call from flow scripts.
 * @param objectModel The cocoon object model.
 * @param eperson the eperson logged in
 */
public static void logIn(Map objectModel,EPerson eperson) throws SQLException {
  final HttpServletRequest request=(HttpServletRequest)objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);
  Context context=ContextUtil.obtainContext(objectModel);
  logIn(context,request,eperson);
}
Program: 52331
Project: 52331
Buggy source:
/** 
 * Log the given user in as a real authenticated user. This should only be used after  a user has presented their credintals and they have been validated. 
 * @param context DSpace context
 * @param request HTTP request
 * @param eperson the eperson logged in
 */
private static void logIn(Context context,HttpServletRequest request,EPerson eperson) throws SQLException {
  if (eperson == null)   return;
  HttpSession session=request.getSession();
  context.setCurrentUser(eperson);
  if (!AuthorizeManager.isAdmin(context) && !SystemwideAlerts.canUserStartSession()) {
    context.setCurrentUser(null);
    return;
  }
  int[] groupIDs=AuthenticationManager.getSpecialGroups(context,request);
  for (  int groupID : groupIDs)   context.setSpecialGroup(groupID);
  session.setAttribute(CURRENT_IP_ADDRESS,request.getRemoteAddr());
  session.setAttribute(EFFECTIVE_USER_ID,eperson.getID());
  session.setAttribute(AUTHENTICATED_USER_ID,eperson.getID());
}

Fixed version (ground truth):
/** 
 * Log the given user in as a real authenticated user. This should only be used after  a user has presented their credintals and they have been validated. This method  signature is provided to be easier to call from flow scripts.
 * @param objectModel The cocoon object model.
 * @param eperson the eperson logged in
 */
public static void logIn(Map objectModel,EPerson eperson) throws SQLException {
  final HttpServletRequest request=(HttpServletRequest)objectModel.get(HttpEnvironment.HTTP_REQUEST_OBJECT);
  Context context=ContextUtil.obtainContext(objectModel);
  logIn(context,request,eperson);
}
Program: 52338
Project: 52338
Buggy source:
public int doStartTag() throws JspException {
  try {
    if (ids.size() < 1) {
      return SKIP_BODY;
    }
    JspWriter out=pageContext.getOut();
    String header=this.getHeaderText();
    out.println("String_Node_Str");
    out.println("String_Node_Str" + header + "String_Node_Str");
    for (    ExternalIdentifier eid : ids) {
      writeIdentifier(eid,out);
    }
    return SKIP_BODY;
  }
 catch (  IOException e) {
    throw new JspException(e);
  }
}

Fixed version (ground truth):
public int doStartTag() throws JspException {
  try {
    if (ids.size() < 1) {
      return SKIP_BODY;
    }
    JspWriter out=pageContext.getOut();
    String header=this.getHeaderText();
    out.println("String_Node_Str");
    out.println("String_Node_Str" + header + "String_Node_Str");
    for (    ExternalIdentifier eid : ids) {
      writeIdentifier(eid,out);
    }
    out.println("String_Node_Str");
    return SKIP_BODY;
  }
 catch (  IOException e) {
    throw new JspException(e);
  }
}
Program: 52339
Project: 52339
Buggy source:
public int doOffsetQuery(String column,String value,boolean isAscending) throws BrowseException {
  TableRowIterator tri=null;
  try {
    List paramsList=new ArrayList();
    StringBuffer queryBuf=new StringBuffer();
    queryBuf.append("String_Node_Str").append(column).append("String_Node_Str");
    buildSelectStatement(queryBuf,paramsList);
    if (isAscending) {
      queryBuf.append("String_Node_Str").append(column).append("String_Node_Str");
      paramsList.add(value);
    }
 else {
      queryBuf.append("String_Node_Str").append(column).append("String_Node_Str");
      paramsList.add(value + Character.MAX_VALUE);
    }
    if (containerTable != null || (value != null && valueField != null && tableDis != null && tableMap != null)) {
      queryBuf.append("String_Node_Str").append("String_Node_Str");
      queryBuf.append(table).append("String_Node_Str");
    }
    tri=DatabaseManager.query(context,queryBuf.toString(),paramsList.toArray());
    TableRow row;
    if (tri.hasNext()) {
      row=tri.next();
      return row.getIntColumn("String_Node_Str");
    }
 else {
      return 0;
    }
  }
 catch (  SQLException e) {
    throw new BrowseException(e);
  }
 finally {
    if (tri != null) {
      tri.close();
    }
  }
}

Fixed version (ground truth):
public int doOffsetQuery(String column,String value,boolean isAscending) throws BrowseException {
  TableRowIterator tri=null;
  if (column == null || value == null)   return 0;
  try {
    List paramsList=new ArrayList();
    StringBuffer queryBuf=new StringBuffer();
    queryBuf.append("String_Node_Str").append(column).append("String_Node_Str");
    buildSelectStatement(queryBuf,paramsList);
    if (isAscending) {
      queryBuf.append("String_Node_Str").append(column).append("String_Node_Str");
      paramsList.add(value);
    }
 else {
      queryBuf.append("String_Node_Str").append(column).append("String_Node_Str");
      paramsList.add(value + Character.MAX_VALUE);
    }
    if (containerTable != null || (value != null && valueField != null && tableDis != null && tableMap != null)) {
      queryBuf.append("String_Node_Str").append("String_Node_Str");
      queryBuf.append(table).append("String_Node_Str");
    }
    tri=DatabaseManager.query(context,queryBuf.toString(),paramsList.toArray());
    TableRow row;
    if (tri.hasNext()) {
      row=tri.next();
      return row.getIntColumn("String_Node_Str");
    }
 else {
      return 0;
    }
  }
 catch (  SQLException e) {
    throw new BrowseException(e);
  }
 finally {
    if (tri != null) {
      tri.close();
    }
  }
}