nus-yam/ex-repair huggingface dataset:
Program: 3322
Project: 3322
Buggy source:
/** 
 * Get repeated values from a form. If "foo" is passed in as the parameter, values in the form of parameters "foo", "foo_1", "foo_2", etc. are returned. <P> This method can also handle "composite fields" (metadata fields which may require multiple params, etc. a first name and last name).
 * @param request the HTTP request containing the form information
 * @param metadataField the metadata field which can store repeated values
 * @param param the repeated parameter on the page (used to fill out the metadataField)
 * @return a List of Strings
 */
protected List getRepeatedParameter(HttpServletRequest request,String metadataField,String param){
  List vals=new LinkedList();
  int i=0;
  boolean foundLast=false;
  log.debug("String_Node_Str" + metadataField + "String_Node_Str"+ metadataField);
  while (!foundLast) {
    String s=null;
    if (i == 0)     s=request.getParameter(param);
 else     s=request.getParameter(param + "String_Node_Str" + i);
    if (s != null) {
      boolean addValue=true;
      String[] selected=request.getParameterValues(metadataField + "String_Node_Str");
      if (selected != null) {
        for (int j=0; j < selected.length; j++) {
          if (selected[j].equals(metadataField + "String_Node_Str" + i)) {
            addValue=false;
          }
        }
      }
      if (addValue)       vals.add(s.trim());
    }
 else {
      foundLast=true;
    }
    i++;
  }
  return vals;
}

Fixed version (ground truth):
/** 
 * Get repeated values from a form. If "foo" is passed in as the parameter, values in the form of parameters "foo", "foo_1", "foo_2", etc. are returned. <P> This method can also handle "composite fields" (metadata fields which may require multiple params, etc. a first name and last name).
 * @param request the HTTP request containing the form information
 * @param metadataField the metadata field which can store repeated values
 * @param param the repeated parameter on the page (used to fill out the metadataField)
 * @return a List of Strings
 */
protected List getRepeatedParameter(HttpServletRequest request,String metadataField,String param){
  List vals=new LinkedList();
  int i=1;
  boolean foundLast=false;
  log.debug("String_Node_Str" + metadataField + "String_Node_Str"+ metadataField);
  while (!foundLast) {
    String s=null;
    s=request.getParameter(param + "String_Node_Str" + i);
    if (s == null) {
      s=request.getParameter(param);
      foundLast=true;
    }
    if (s != null) {
      boolean addValue=true;
      String[] selected=request.getParameterValues(metadataField + "String_Node_Str");
      if (selected != null) {
        for (int j=0; j < selected.length; j++) {
          if (selected[j].equals(metadataField + "String_Node_Str" + i)) {
            addValue=false;
          }
        }
      }
      if (addValue)       vals.add(s.trim());
    }
    i++;
  }
  return vals;
}
Program: 3323
Project: 3323
Buggy source:
/** 
 * Decode the given string from URL transmission.
 * @param encodedString The encoded string.
 * @return The unencoded string
 */
public static String URLDecode(String encodedString) throws UIException {
  if (encodedString == null)   return null;
  try {
    return URLDecoder.decode(encodedString,Constants.DEFAULT_ENCODING);
  }
 catch (  UnsupportedEncodingException uee) {
    throw new UIException(uee);
  }
}

Fixed version (ground truth):
/** 
 * Decode the given string from URL transmission.
 * @param encodedString The encoded string.
 * @return The unencoded string
 */
public static String URLDecode(String encodedString) throws UIException {
  if (encodedString == null)   return null;
  try {
    if (encodedString.contains("String_Node_Str")) {
      encodedString=encodedString.replace("String_Node_Str","String_Node_Str");
    }
    return URLDecoder.decode(encodedString,Constants.DEFAULT_ENCODING);
  }
 catch (  UnsupportedEncodingException uee) {
    throw new UIException(uee);
  }
}
Program: 3324
Project: 3324
Buggy source:
/** 
 * What to add at the end of the body 
 */
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  if (this.bodyEmpty) {
    Division notFound=body.addDivision("String_Node_Str","String_Node_Str");
    notFound.setHead(T_head);
    notFound.addPara(T_para1);
    notFound.addPara().addXref(contextPath,T_go_home);
  }
}

Fixed version (ground truth):
/** 
 * What to add at the end of the body 
 */
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  if (this.bodyEmpty) {
    Division notFound=body.addDivision("String_Node_Str","String_Node_Str");
    notFound.setHead(T_head);
    notFound.addPara(T_para1);
    notFound.addPara().addXref(contextPath,T_go_home);
    HttpServletResponse response=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
    response.setStatus(HttpServletResponse.SC_NOT_FOUND);
  }
}
Program: 3325
Project: 3325
Buggy source:
/** 
 * Since the archive is created in a new thread we are unable to communicate with calling method about success or failure. We accomplis this communication with email instead. Send a success email once the export archive is complete and ready for download
 * @param toMail - email to send message to
 * @param fromMail - email for the from field
 * @param ccMail - carbon copy email
 * @param fileName - the file name to be downloaded. It is added to the url in the email
 * @throws MessagingException
 */
public static void emailSuccessMessage(String toMail,String fromMail,String ccMail,String fileName) throws MessagingException {
  StringBuffer content=new StringBuffer();
  content.append("String_Node_Str");
  content.append(System.getProperty("String_Node_Str"));
  content.append(System.getProperty("String_Node_Str"));
  content.append("String_Node_Str");
  content.append(System.getProperty("String_Node_Str"));
  content.append(ConfigurationManager.getProperty("String_Node_Str"));
  content.append("String_Node_Str");
  content.append(fileName);
  content.append(System.getProperty("String_Node_Str"));
  content.append(System.getProperty("String_Node_Str"));
  content.append("String_Node_Str");
  content.append(ConfigurationManager.getProperty("String_Node_Str"));
  content.append("String_Node_Str");
  content.append(System.getProperty("String_Node_Str"));
  content.append(System.getProperty("String_Node_Str"));
  content.append("String_Node_Str");
  sendMessage(toMail,fromMail,ccMail,"String_Node_Str",content);
}

Fixed version (ground truth):
/** 
 * Since the archive is created in a new thread we are unable to communicate with calling method about success or failure. We accomplis this communication with email instead. Send a success email once the export archive is complete and ready for download
 * @param context - the current Context
 * @param eperson - eperson to send the email to
 * @param fileName - the file name to be downloaded. It is added to the url in the email
 * @throws MessagingException
 */
public static void emailSuccessMessage(Context context,EPerson eperson,String fileName) throws MessagingException {
  try {
    Locale supportedLocale=I18nUtil.getEPersonLocale(eperson);
    Email email=ConfigurationManager.getEmail(I18nUtil.getEmailFilename(supportedLocale,"String_Node_Str"));
    email.addRecipient(eperson.getEmail());
    email.addArgument(ConfigurationManager.getProperty("String_Node_Str") + "String_Node_Str" + fileName);
    email.addArgument(ConfigurationManager.getProperty("String_Node_Str"));
    email.send();
  }
 catch (  Exception e) {
    log.warn(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
  }
}
Program: 3326
Project: 3326
Buggy source:
public void run(){
  Context context;
  ItemIterator iitems=null;
  try {
    context=new Context();
    context.setIgnoreAuthorization(true);
    iitems=new ItemIterator(context,items);
    String fileName=assembleFileName("String_Node_Str",eperson,new Date());
    String workDir=getExportWorkDirectory() + System.getProperty("String_Node_Str") + fileName;
    String downloadDir=getExportDownloadDirectory(eperson.getID());
    File wkDir=new File(workDir);
    if (!wkDir.exists()) {
      wkDir.mkdirs();
    }
    File dnDir=new File(downloadDir);
    if (!dnDir.exists()) {
      dnDir.mkdirs();
    }
    exportItem(context,iitems,workDir,1);
    zip(workDir,downloadDir + System.getProperty("String_Node_Str") + fileName+ "String_Node_Str");
    emailSuccessMessage(eperson.getEmail(),ConfigurationManager.getProperty("String_Node_Str"),additionalEmail,fileName + "String_Node_Str");
    context.setIgnoreAuthorization(false);
  }
 catch (  Exception e1) {
    try {
      emailErrorMessage(eperson.getEmail(),ConfigurationManager.getProperty("String_Node_Str"),additionalEmail,e1.getMessage());
    }
 catch (    Exception e) {
    }
    throw new RuntimeException(e1);
  }
 finally {
    if (iitems != null)     iitems.close();
  }
}

Fixed version (ground truth):
public void run(){
  Context context;
  ItemIterator iitems=null;
  try {
    context=new Context();
    context.setIgnoreAuthorization(true);
    iitems=new ItemIterator(context,items);
    String fileName=assembleFileName("String_Node_Str",eperson,new Date());
    String workDir=getExportWorkDirectory() + System.getProperty("String_Node_Str") + fileName;
    String downloadDir=getExportDownloadDirectory(eperson.getID());
    File wkDir=new File(workDir);
    if (!wkDir.exists()) {
      wkDir.mkdirs();
    }
    File dnDir=new File(downloadDir);
    if (!dnDir.exists()) {
      dnDir.mkdirs();
    }
    exportItem(context,iitems,workDir,1);
    zip(workDir,downloadDir + System.getProperty("String_Node_Str") + fileName+ "String_Node_Str");
    emailSuccessMessage(context,eperson,fileName + "String_Node_Str");
    context.setIgnoreAuthorization(false);
  }
 catch (  Exception e1) {
    try {
      emailErrorMessage(eperson,e1.getMessage());
    }
 catch (    Exception e) {
    }
    throw new RuntimeException(e1);
  }
 finally {
    if (iitems != null)     iitems.close();
  }
}
Program: 3328
Project: 3328
Buggy source:
/** 
 * Since the archive is created in a new thread we are unable to communicate with calling method about success or failure. We accomplis this communication with email instead. Send an error email if the export archive fails
 * @param toMail - email to send message to
 * @param fromMail - email for the from field
 * @param ccMail - carbon copy email
 * @param error - the error message
 * @throws MessagingException
 */
public static void emailErrorMessage(String toMail,String fromMail,String ccMail,String error) throws MessagingException {
  StringBuffer content=new StringBuffer();
  content.append("String_Node_Str");
  content.append(System.getProperty("String_Node_Str"));
  content.append(System.getProperty("String_Node_Str"));
  content.append("String_Node_Str");
  content.append(System.getProperty("String_Node_Str"));
  content.append(System.getProperty("String_Node_Str"));
  content.append("String_Node_Str");
  content.append(error);
  content.append(System.getProperty("String_Node_Str"));
  content.append(System.getProperty("String_Node_Str"));
  content.append("String_Node_Str");
  sendMessage(toMail,fromMail,ccMail,"String_Node_Str",content);
}

Fixed version (ground truth):
/** 
 * Since the archive is created in a new thread we are unable to communicate with calling method about success or failure. We accomplis this communication with email instead. Send an error email if the export archive fails
 * @param eperson - EPerson to send the error message to
 * @param error - the error message
 * @throws MessagingException
 */
public static void emailErrorMessage(EPerson eperson,String error) throws MessagingException {
  log.warn("String_Node_Str" + error);
  try {
    Locale supportedLocale=I18nUtil.getEPersonLocale(eperson);
    Email email=ConfigurationManager.getEmail(I18nUtil.getEmailFilename(supportedLocale,"String_Node_Str"));
    email.addRecipient(eperson.getEmail());
    email.addArgument(error);
    email.addArgument(ConfigurationManager.getProperty("String_Node_Str") + "String_Node_Str");
    email.send();
  }
 catch (  Exception e) {
    log.warn("String_Node_Str",e);
  }
}
Program: 3329
Project: 3329
Buggy source:
/** 
 * Add a single link to the view item page that allows the user  to submit to the collection.
 */
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  DSpaceObject dso=HandleUtil.obtainHandle(objectModel);
  if (!(dso instanceof Collection))   return;
  Collection collection=(Collection)dso;
  if (AuthorizeManager.authorizeActionBoolean(context,collection,Constants.ADD)) {
    Division home=body.addDivision("String_Node_Str","String_Node_Str");
    Division viewer=home.addDivision("String_Node_Str","String_Node_Str");
    String submitURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str";
    viewer.addPara().addXref(submitURL,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Add a single link to the view item page that allows the user  to submit to the collection.
 */
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  DSpaceObject dso=HandleUtil.obtainHandle(objectModel);
  if (!(dso instanceof Collection))   return;
  Collection collection=(Collection)dso;
  if (AuthorizeManager.authorizeActionBoolean(context,collection,Constants.ADD)) {
    Division home=body.addDivision("String_Node_Str","String_Node_Str");
    Division viewer=home.addDivision("String_Node_Str","String_Node_Str");
    String submitURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str";
    viewer.addPara().addXref(submitURL,T_submit);
  }
}
Program: 3332
Project: 3332
Buggy source:
private boolean itemsChanged(Context context,DSpaceObject dso,long timeStamp) throws SQLException {
  DCDate dcStartDate=new DCDate(new Date(timeStamp));
  DCDate dcEndDate=new DCDate(new Date(System.currentTimeMillis()));
  String startDate=dcStartDate.toString().substring(0,10);
  String endDate=dcEndDate.toString().substring(0,10);
  try {
    return (Harvest.harvest(context,dso,startDate,endDate,0,1,false,false,false).size() > 0);
  }
 catch (  ParseException pe) {
    return false;
  }
}

Fixed version (ground truth):
private boolean itemsChanged(Context context,DSpaceObject dso,long timeStamp) throws SQLException {
  DCDate dcStartDate=new DCDate(new Date(timeStamp));
  DCDate dcEndDate=new DCDate(new Date(System.currentTimeMillis()));
  String startDate=dcStartDate.toString().substring(0,10);
  String endDate=dcEndDate.toString().substring(0,10);
  try {
    boolean includeAll=ConfigurationManager.getBooleanProperty("String_Node_Str",true);
    return (Harvest.harvest(context,dso,startDate,endDate,0,1,false,false,false,includeAll).size() > 0);
  }
 catch (  ParseException pe) {
    return false;
  }
}
Program: 3334
Project: 3334
Buggy source:
public boolean canDisseminate(DSpaceObject dso){
  return true;
}

Fixed version (ground truth):
public boolean canDisseminate(DSpaceObject dso){
  if (dso.getType() == Constants.BITSTREAM)   return true;
 else   return false;
}
Program: 3336
Project: 3336
Buggy source:
static String checkEmptyQuery(String myquery){
  if (myquery.equals("String_Node_Str")) {
    myquery="String_Node_Str";
  }
  return myquery;
}

Fixed version (ground truth):
static String checkEmptyQuery(String myquery){
  if (myquery == null || myquery.equals("String_Node_Str") || myquery.equals("String_Node_Str")) {
    myquery="String_Node_Str";
  }
  return myquery;
}
Program: 3337
Project: 3337
Buggy source:
public boolean canDisseminate(DSpaceObject dso){
  return true;
}

Fixed version (ground truth):
public boolean canDisseminate(DSpaceObject dso){
  if (dso.getType() == Constants.BITSTREAM)   return true;
 else   return false;
}
Program: 3338
Project: 3338
Buggy source:
/** 
 * Set the DSpace context to use
 * @param context
 */
public void setContext(Context context){
  this.context=context;
}

Fixed version (ground truth):
/** 
 * Set the DSpace context to use
 * @param context the context
 */
public void setContext(Context context){
  this.context=context;
}
Program: 3339
Project: 3339
Buggy source:
/** 
 * add group to this group
 * @param g
 */
public void addMember(Group g){
  loadData();
  if (isMember(g)) {
    return;
  }
  groups.add(g);
  groupsChanged=true;
  myContext.addEvent(new Event(Event.ADD,Constants.GROUP,getID(),Constants.GROUP,g.getID(),g.getName()));
}

Fixed version (ground truth):
/** 
 * add group to this group
 * @param g
 */
public void addMember(Group g){
  loadData();
  if (isMember(g) || getID() == g.getID()) {
    return;
  }
  groups.add(g);
  groupsChanged=true;
  myContext.addEvent(new Event(Event.ADD,Constants.GROUP,getID(),Constants.GROUP,g.getID(),g.getName()));
}
Program: 3340
Project: 3340
Buggy source:
/** 
 * Close the context, without committing any of the changes performed using this context. The database connection is freed. No exception is thrown if there is an error freeing the database connection, since this method may be called as part of an error-handling routine where an SQLException has already been thrown.
 */
public void abort(){
  try {
    connection.rollback();
  }
 catch (  SQLException se) {
    log.error(se.getMessage());
    se.printStackTrace();
  }
 finally {
    DatabaseManager.freeConnection(connection);
    connection=null;
    events=null;
  }
}

Fixed version (ground truth):
/** 
 * Close the context, without committing any of the changes performed using this context. The database connection is freed. No exception is thrown if there is an error freeing the database connection, since this method may be called as part of an error-handling routine where an SQLException has already been thrown.
 */
public void abort(){
  try {
    if (!connection.isClosed())     connection.rollback();
  }
 catch (  SQLException se) {
    log.error(se.getMessage());
    se.printStackTrace();
  }
 finally {
    try {
      if (!connection.isClosed())       DatabaseManager.freeConnection(connection);
    }
 catch (    Exception ex) {
      ex.printStackTrace();
    }
    connection=null;
    events=null;
  }
}
Program: 3343
Project: 3343
Buggy source:
public int[] getSpecialGroups(Context context,HttpServletRequest request){
  if ((context.getCurrentUser() != null) && (!context.getCurrentUser().getNetid().equals("String_Node_Str"))) {
    if (ldapGroup == null) {
      log.warn(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
      return new int[0];
    }
 else {
      return new int[]{ldapGroup.getID()};
    }
  }
  return new int[0];
}

Fixed version (ground truth):
public int[] getSpecialGroups(Context context,HttpServletRequest request){
  try {
    if (!context.getCurrentUser().getNetid().equals("String_Node_Str")) {
      if (ldapGroup == null) {
        log.warn(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
        return new int[0];
      }
 else {
        return new int[]{ldapGroup.getID()};
      }
    }
  }
 catch (  NullPointerException npe) {
  }
  return new int[0];
}
Program: 3345
Project: 3345
Buggy source:
public int[] getSpecialGroups(Context context,HttpServletRequest request){
  try {
    if (!context.getCurrentUser().getNetid().equals("String_Node_Str")) {
      if (ldapGroup == null) {
        log.warn(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
        return new int[0];
      }
 else {
        return new int[]{ldapGroup.getID()};
      }
    }
  }
 catch (  NullPointerException npe) {
  }
  return new int[0];
}

Fixed version (ground truth):
public int[] getSpecialGroups(Context context,HttpServletRequest request){
  try {
    if (!context.getCurrentUser().getNetid().equals("String_Node_Str")) {
      String groupName=ConfigurationManager.getProperty("String_Node_Str");
      if ((groupName != null) && (!groupName.trim().equals("String_Node_Str"))) {
        ldapGroup=Group.findByName(new Context(),groupName);
        if (ldapGroup == null) {
          log.warn(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"));
          return new int[0];
        }
 else {
          return new int[]{ldapGroup.getID()};
        }
      }
    }
  }
 catch (  Exception npe) {
  }
  return new int[0];
}
Program: 3346
Project: 3346
Buggy source:
/** 
 * Generate the validity for this cached entry
 * @return
 */
public SourceValidity getValidity(){
  if (validity == null) {
    try {
      initialise();
      boolean showReport=ConfigurationManager.getBooleanProperty("String_Node_Str");
      if (!showReport) {
        try {
          showReport=AuthorizeManager.isAdmin(context);
        }
 catch (        SQLException sqle) {
          log.error("String_Node_Str",sqle);
        }
      }
      if (showReport) {
        File analysisFile=null;
        if (reportDate != null)         analysisFile=StatisticsLoader.getAnalysisFor(reportDate);
 else         analysisFile=StatisticsLoader.getGeneralAnalysis();
        if (analysisFile != null) {
          DSpaceValidity newValidity=new DSpaceValidity();
          newValidity.add(Long.toString(analysisFile.lastModified()));
          newValidity.add("String_Node_Str");
          newValidity.add(Long.toString(analysisFile.length()));
          validity=newValidity.complete();
        }
      }
    }
 catch (    Exception e) {
    }
  }
  return validity;
}

Fixed version (ground truth):
/** 
 * Generate the validity for this cached entry
 * @return
 */
public SourceValidity getValidity(){
  if (validity == null) {
    try {
      initialise();
      boolean showReport=ConfigurationManager.getBooleanProperty("String_Node_Str");
      if (!showReport) {
        showReport=AuthorizeManager.isAdmin(context);
      }
      if (showReport) {
        File analysisFile=null;
        if (reportDate != null)         analysisFile=StatisticsLoader.getAnalysisFor(reportDate);
 else         analysisFile=StatisticsLoader.getGeneralAnalysis();
        if (analysisFile != null) {
          DSpaceValidity newValidity=new DSpaceValidity();
          newValidity.add(Long.toString(analysisFile.lastModified()));
          newValidity.add("String_Node_Str");
          newValidity.add(Long.toString(analysisFile.length()));
          validity=newValidity.complete();
        }
      }
    }
 catch (    Exception e) {
    }
  }
  return validity;
}
Program: 3348
Project: 3348
Buggy source:
/** 
 * Attempt to authenticate the user. 
 */
public Map act(Redirector redirector,SourceResolver resolver,Map objectModel,String source,Parameters parameters) throws Exception {
  Request request=ObjectModelHelper.getRequest(objectModel);
  String email=request.getParameter("String_Node_Str");
  String password=request.getParameter("String_Node_Str");
  String realm=request.getParameter("String_Node_Str");
  if (email == null)   email="String_Node_Str";
  if (password == null)   password="String_Node_Str";
  try {
    Context context=AuthenticationUtil.Authenticate(objectModel,email,password,realm);
    EPerson eperson=context.getCurrentUser();
    if (eperson != null) {
      String redirectURL=request.getContextPath();
      if (AuthenticationUtil.isInterupptedRequest(objectModel)) {
        redirectURL+=AuthenticationUtil.resumeInterruptedRequest(objectModel);
      }
 else {
        String loginRedirect=ConfigurationManager.getProperty("String_Node_Str");
        redirectURL+=(loginRedirect != null) ? loginRedirect.trim() : "String_Node_Str";
      }
      final HttpServletResponse httpResponse=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
      httpResponse.sendRedirect(redirectURL);
      context.setCurrentUser(null);
      return new HashMap();
    }
  }
 catch (  SQLException sqle) {
    throw new PatternException("String_Node_Str",sqle);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Attempt to authenticate the user. 
 */
public Map act(Redirector redirector,SourceResolver resolver,Map objectModel,String source,Parameters parameters) throws Exception {
  Request request=ObjectModelHelper.getRequest(objectModel);
  String email=request.getParameter("String_Node_Str");
  String password=request.getParameter("String_Node_Str");
  String realm=request.getParameter("String_Node_Str");
  if ((email == null) || (password == null)) {
    return null;
  }
  try {
    Context context=AuthenticationUtil.Authenticate(objectModel,email,password,realm);
    EPerson eperson=context.getCurrentUser();
    if (eperson != null) {
      String redirectURL=request.getContextPath();
      if (AuthenticationUtil.isInterupptedRequest(objectModel)) {
        redirectURL+=AuthenticationUtil.resumeInterruptedRequest(objectModel);
      }
 else {
        String loginRedirect=ConfigurationManager.getProperty("String_Node_Str");
        redirectURL+=(loginRedirect != null) ? loginRedirect.trim() : "String_Node_Str";
      }
      final HttpServletResponse httpResponse=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
      httpResponse.sendRedirect(redirectURL);
      context.setCurrentUser(null);
      return new HashMap();
    }
  }
 catch (  SQLException sqle) {
    throw new PatternException("String_Node_Str",sqle);
  }
  return null;
}
Program: 3351
Project: 3351
Buggy source:
/** 
 * Generate the cache validity object. The validity object will include the item being viewed, along with all bundles & bitstreams.
 */
public SourceValidity getValidity(){
  DSpaceObject dso=null;
  if (this.validity == null) {
    try {
      dso=URIUtil.resolve(objectModel);
      DSpaceValidity validity=new DSpaceValidity();
      validity.add(dso);
      this.validity=validity.complete();
    }
 catch (    Exception e) {
    }
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + (dso == null ? "String_Node_Str" : dso.getHandle())));
  }
  return this.validity;
}

Fixed version (ground truth):
/** 
 * Generate the cache validity object. The validity object will include the item being viewed, along with all bundles & bitstreams.
 */
public SourceValidity getValidity(){
  DSpaceObject dso=null;
  if (this.validity == null) {
    try {
      dso=URIUtil.resolve(objectModel);
      DSpaceValidity validity=new DSpaceValidity();
      validity.add(dso);
      this.validity=validity.complete();
    }
 catch (    Exception e) {
    }
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + (dso == null ? "String_Node_Str" : IdentifierService.getCanonicalForm(dso))));
  }
  return this.validity;
}
Program: 3353
Project: 3353
Buggy source:
/** 
 * Do the beginning of a Step. First do pre-processing, then display the JSP (if there is one). If there's no JSP, just End the step immediately.
 * @param context current DSpace context
 * @param request current servlet request object
 * @param response current servlet response object
 * @param subInfo submission info object
 * @return true if the step is completed (no JSP was loaded), falseotherwise
 */
private boolean doStepStart(Context context,HttpServletRequest request,HttpServletResponse response,SubmissionInfo subInfo) throws ServletException, IOException, SQLException, AuthorizeException {
  log.debug("String_Node_Str" + this.getClass().getName());
  stepJSPUI.doPreProcessing(context,request,response,subInfo);
  if (!response.isCommitted()) {
    log.debug("String_Node_Str" + this.getClass().getName());
    int errorFlag=stepProcessing.doProcessing(context,request,response,subInfo);
    if (errorFlag != AbstractProcessingStep.STATUS_COMPLETE) {
      String errorMessage=stepProcessing.getErrorMessage(errorFlag);
      if (errorMessage == null) {
        errorMessage="String_Node_Str" + this.getClass().getName() + "String_Node_Str"+ errorFlag+ "String_Node_Str"+ "String_Node_Str";
      }
      log.error(errorMessage);
    }
    return completeStep(context,request,response,subInfo);
  }
 else   return false;
}

Fixed version (ground truth):
/** 
 * Do the beginning of a Step. First do pre-processing, then display the JSP (if there is one). If there's no JSP, just End the step immediately.
 * @param context current DSpace context
 * @param request current servlet request object
 * @param response current servlet response object
 * @param subInfo submission info object
 * @return true if the step is completed (no JSP was loaded), falseotherwise
 */
private boolean doStepStart(Context context,HttpServletRequest request,HttpServletResponse response,SubmissionInfo subInfo) throws ServletException, IOException, SQLException, AuthorizeException {
  log.debug("String_Node_Str" + this.getClass().getName());
  if (stepJSPUI != null)   stepJSPUI.doPreProcessing(context,request,response,subInfo);
  if (!response.isCommitted()) {
    log.debug("String_Node_Str" + this.getClass().getName());
    int errorFlag=stepProcessing.doProcessing(context,request,response,subInfo);
    if (errorFlag != AbstractProcessingStep.STATUS_COMPLETE) {
      String errorMessage=stepProcessing.getErrorMessage(errorFlag);
      if (errorMessage == null) {
        errorMessage="String_Node_Str" + this.getClass().getName() + "String_Node_Str"+ errorFlag+ "String_Node_Str"+ "String_Node_Str";
      }
      log.error(errorMessage);
    }
    return completeStep(context,request,response,subInfo);
  }
 else   return false;
}
Program: 3354
Project: 3354
Buggy source:
/** 
 * Initialize the current JSPStepManager object, by loading the  specified step class.
 * @param stepConfig the SubmissionStepConfig object which describes this step's configuration in the item-submission.xml
 * @throws Exception if the JSPStep cannot be loaded or the class specified doesn't implement the JSPStep interface
 */
public static JSPStepManager loadStep(SubmissionStepConfig stepConfig) throws Exception {
  JSPStepManager stepManager=new JSPStepManager();
  stepManager.stepConfig=stepConfig;
  ClassLoader loader=stepManager.getClass().getClassLoader();
  Class stepClass=loader.loadClass(stepConfig.getProcessingClassName());
  Object stepInstance=stepClass.newInstance();
  if (stepInstance instanceof AbstractProcessingStep) {
    stepManager.stepProcessing=(AbstractProcessingStep)stepClass.newInstance();
  }
 else {
    throw new Exception("String_Node_Str" + stepConfig.getProcessingClassName() + "String_Node_Str"+ "String_Node_Str");
  }
  stepClass=loader.loadClass(stepConfig.getJSPUIClassName());
  stepInstance=stepClass.newInstance();
  if (stepInstance instanceof JSPStep) {
    stepManager.stepJSPUI=(JSPStep)stepClass.newInstance();
  }
 else {
    throw new Exception("String_Node_Str" + stepConfig.getJSPUIClassName() + "String_Node_Str"+ "String_Node_Str");
  }
  return stepManager;
}

Fixed version (ground truth):
/** 
 * Initialize the current JSPStepManager object, by loading the  specified step class.
 * @param stepConfig the SubmissionStepConfig object which describes this step's configuration in the item-submission.xml
 * @throws Exception if the JSPStep cannot be loaded or the class specified doesn't implement the JSPStep interface
 */
public static JSPStepManager loadStep(SubmissionStepConfig stepConfig) throws Exception {
  JSPStepManager stepManager=new JSPStepManager();
  stepManager.stepConfig=stepConfig;
  ClassLoader loader=stepManager.getClass().getClassLoader();
  Class stepClass=loader.loadClass(stepConfig.getProcessingClassName());
  Object stepInstance=stepClass.newInstance();
  if (stepInstance instanceof AbstractProcessingStep) {
    stepManager.stepProcessing=(AbstractProcessingStep)stepClass.newInstance();
  }
 else {
    throw new Exception("String_Node_Str" + stepConfig.getProcessingClassName() + "String_Node_Str"+ "String_Node_Str");
  }
  if (stepConfig.getJSPUIClassName() != null && stepConfig.getJSPUIClassName().length() > 0) {
    stepClass=loader.loadClass(stepConfig.getJSPUIClassName());
    stepInstance=stepClass.newInstance();
    if (stepInstance instanceof JSPStep) {
      stepManager.stepJSPUI=(JSPStep)stepClass.newInstance();
    }
 else {
      throw new Exception("String_Node_Str" + stepConfig.getJSPUIClassName() + "String_Node_Str"+ "String_Node_Str");
    }
  }
  return stepManager;
}
Program: 3355
Project: 3355
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: 3356
Project: 3356
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: 3364
Project: 3364
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: 3365
Project: 3365
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: 3367
Project: 3367
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: 3368
Project: 3368
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: 3370
Project: 3370
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) {
    }
  }
}