nus-yam/ex-repair huggingface dataset:
Program: 52087
Project: 52087
Buggy source:
private String getUsername(){
  if (null == this.USERNAME) {
    this.USERNAME=this.configurationService.getProperty(CFG_USER);
    if (null == this.USERNAME) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + CFG_USER + "String_Node_Str");
    }
  }
  return this.USERNAME;
}

Fixed version (ground truth):
protected String getUsername(){
  if (null == this.USERNAME) {
    this.USERNAME=this.configurationService.getProperty(CFG_USER);
    if (null == this.USERNAME) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + CFG_USER + "String_Node_Str");
    }
  }
  return this.USERNAME;
}
Program: 52088
Project: 52088
Buggy source:
private DataCiteResponse sendMetadataGetRequest(String doi) throws DOIIdentifierException {
  return sendGetRequest(doi,METADATA_PATH);
}

Fixed version (ground truth):
protected DataCiteResponse sendMetadataGetRequest(String doi) throws DOIIdentifierException {
  return sendGetRequest(doi,METADATA_PATH);
}
Program: 52090
Project: 52090
Buggy source:
private DataCiteResponse sendDOIPostRequest(String doi,String url) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(DOI_PATH);
  HttpPost httppost=null;
  try {
    httppost=new HttpPost(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  HttpEntity reqEntity=null;
  try {
    String req="String_Node_Str" + doi.substring(DOI.SCHEME.length()) + "String_Node_Str"+ "String_Node_Str"+ url+ "String_Node_Str";
    ContentType contentType=ContentType.create("String_Node_Str","String_Node_Str");
    reqEntity=new StringEntity(req,contentType);
    httppost.setEntity(reqEntity);
    return sendHttpRequest(httppost,doi);
  }
  finally {
    try {
      EntityUtils.consume(reqEntity);
    }
 catch (    IOException ioe) {
      log.info("String_Node_Str" + ioe.getMessage());
    }
  }
}

Fixed version (ground truth):
protected DataCiteResponse sendDOIPostRequest(String doi,String url) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(DOI_PATH);
  HttpPost httppost=null;
  try {
    httppost=new HttpPost(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  HttpEntity reqEntity=null;
  try {
    String req="String_Node_Str" + doi.substring(DOI.SCHEME.length()) + "String_Node_Str"+ "String_Node_Str"+ url+ "String_Node_Str";
    ContentType contentType=ContentType.create("String_Node_Str","String_Node_Str");
    reqEntity=new StringEntity(req,contentType);
    httppost.setEntity(reqEntity);
    return sendHttpRequest(httppost,doi);
  }
  finally {
    try {
      EntityUtils.consume(reqEntity);
    }
 catch (    IOException ioe) {
      log.info("String_Node_Str" + ioe.getMessage());
    }
  }
}
Program: 52091
Project: 52091
Buggy source:
private String extractAlternateIdentifier(Context context,String content) throws SQLException, DOIIdentifierException {
  if (content == null) {
    return null;
  }
  SAXBuilder saxBuilder=new SAXBuilder();
  Document doc=null;
  try {
    doc=saxBuilder.build(new ByteArrayInputStream(content.getBytes("String_Node_Str")));
  }
 catch (  IOException ioe) {
    throw new RuntimeException("String_Node_Str",ioe);
  }
catch (  JDOMException jde) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",jde,DOIIdentifierException.BAD_ANSWER);
  }
  String handle=null;
  Iterator<Element> it=doc.getDescendants(new ElementFilter("String_Node_Str"));
  while (handle == null && it.hasNext()) {
    Element alternateIdentifier=it.next();
    try {
      handle=HandleManager.resolveUrlToHandle(context,alternateIdentifier.getText());
    }
 catch (    SQLException e) {
      throw e;
    }
  }
  return handle;
}

Fixed version (ground truth):
protected String extractAlternateIdentifier(Context context,String content) throws SQLException, DOIIdentifierException {
  if (content == null) {
    return null;
  }
  SAXBuilder saxBuilder=new SAXBuilder();
  Document doc=null;
  try {
    doc=saxBuilder.build(new ByteArrayInputStream(content.getBytes("String_Node_Str")));
  }
 catch (  IOException ioe) {
    throw new RuntimeException("String_Node_Str",ioe);
  }
catch (  JDOMException jde) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",jde,DOIIdentifierException.BAD_ANSWER);
  }
  String handle=null;
  Iterator<Element> it=doc.getDescendants(new ElementFilter("String_Node_Str"));
  while (handle == null && it.hasNext()) {
    Element alternateIdentifier=it.next();
    try {
      handle=HandleManager.resolveUrlToHandle(context,alternateIdentifier.getText());
    }
 catch (    SQLException e) {
      throw e;
    }
  }
  return handle;
}
Program: 52092
Project: 52092
Buggy source:
private Element addDOI(String doi,Element root){
  if (null != extractDOI(root)) {
    return root;
  }
  Element identifier=new Element("String_Node_Str","String_Node_Str");
  identifier.setAttribute("String_Node_Str","String_Node_Str");
  identifier.addContent(doi.substring(DOI.SCHEME.length()));
  return root.addContent(0,identifier);
}

Fixed version (ground truth):
protected Element addDOI(String doi,Element root){
  if (null != extractDOI(root)) {
    return root;
  }
  Element identifier=new Element("String_Node_Str","String_Node_Str");
  identifier.setAttribute("String_Node_Str","String_Node_Str");
  identifier.addContent(doi.substring(DOI.SCHEME.length()));
  return root.addContent(0,identifier);
}
Program: 52093
Project: 52093
Buggy source:
private DataCiteResponse sendMetadataPostRequest(String doi,String metadata) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(METADATA_PATH);
  HttpPost httppost=null;
  try {
    httppost=new HttpPost(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  HttpEntity reqEntity=null;
  try {
    ContentType contentType=ContentType.create("String_Node_Str","String_Node_Str");
    reqEntity=new StringEntity(metadata,contentType);
    httppost.setEntity(reqEntity);
    return sendHttpRequest(httppost,doi);
  }
  finally {
    try {
      EntityUtils.consume(reqEntity);
    }
 catch (    IOException ioe) {
      log.info("String_Node_Str" + ioe.getMessage());
    }
  }
}

Fixed version (ground truth):
protected DataCiteResponse sendMetadataPostRequest(String doi,String metadata) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(METADATA_PATH);
  HttpPost httppost=null;
  try {
    httppost=new HttpPost(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  HttpEntity reqEntity=null;
  try {
    ContentType contentType=ContentType.create("String_Node_Str","String_Node_Str");
    reqEntity=new StringEntity(metadata,contentType);
    httppost.setEntity(reqEntity);
    return sendHttpRequest(httppost,doi);
  }
  finally {
    try {
      EntityUtils.consume(reqEntity);
    }
 catch (    IOException ioe) {
      log.info("String_Node_Str" + ioe.getMessage());
    }
  }
}
Program: 52094
Project: 52094
Buggy source:
private DataCiteResponse sendGetRequest(String doi,String path) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(path + doi.substring(DOI.SCHEME.length()));
  HttpGet httpget=null;
  try {
    httpget=new HttpGet(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  return sendHttpRequest(httpget,doi);
}

Fixed version (ground truth):
protected DataCiteResponse sendGetRequest(String doi,String path) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(path + doi.substring(DOI.SCHEME.length()));
  HttpGet httpget=null;
  try {
    httpget=new HttpGet(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  return sendHttpRequest(httpget,doi);
}
Program: 52095
Project: 52095
Buggy source:
private String getPassword(){
  if (null == this.PASSWORD) {
    this.PASSWORD=this.configurationService.getProperty(CFG_PASSWORD);
    if (null == this.PASSWORD) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + CFG_PASSWORD + "String_Node_Str");
    }
  }
  return this.PASSWORD;
}

Fixed version (ground truth):
protected String getPassword(){
  if (null == this.PASSWORD) {
    this.PASSWORD=this.configurationService.getProperty(CFG_PASSWORD);
    if (null == this.PASSWORD) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + CFG_PASSWORD + "String_Node_Str");
    }
  }
  return this.PASSWORD;
}
Program: 52096
Project: 52096
Buggy source:
private String extractDOI(Element root){
  Element doi=root.getChild("String_Node_Str",root.getNamespace());
  return (null == doi) ? null : doi.getTextTrim();
}

Fixed version (ground truth):
protected String extractDOI(Element root){
  Element doi=root.getChild("String_Node_Str",root.getNamespace());
  return (null == doi) ? null : doi.getTextTrim();
}
Program: 52097
Project: 52097
Buggy source:
private DataCiteResponse sendMetadataDeleteRequest(String doi) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme("String_Node_Str").setHost(HOST).setPath(METADATA_PATH + doi.substring(DOI.SCHEME.length()));
  HttpDelete httpdelete=null;
  try {
    httpdelete=new HttpDelete(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str","String_Node_Str" + HOST + DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  return sendHttpRequest(httpdelete,doi);
}

Fixed version (ground truth):
private DataCiteResponse sendMetadataDeleteRequest(String doi) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(METADATA_PATH + doi.substring(DOI.SCHEME.length()));
  HttpDelete httpdelete=null;
  try {
    httpdelete=new HttpDelete(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  return sendHttpRequest(httpdelete,doi);
}
Program: 52098
Project: 52098
Buggy source:
private DataCiteResponse sendDOIPostRequest(String doi,String url) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme("String_Node_Str").setHost(HOST).setPath(DOI_PATH);
  HttpPost httppost=null;
  try {
    httppost=new HttpPost(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str","String_Node_Str" + HOST + DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  HttpEntity reqEntity=null;
  try {
    String req="String_Node_Str" + doi.substring(DOI.SCHEME.length()) + "String_Node_Str"+ "String_Node_Str"+ url+ "String_Node_Str";
    ContentType contentType=ContentType.create("String_Node_Str","String_Node_Str");
    reqEntity=new StringEntity(req,contentType);
    httppost.setEntity(reqEntity);
    return sendHttpRequest(httppost,doi);
  }
  finally {
    try {
      EntityUtils.consume(reqEntity);
    }
 catch (    IOException ioe) {
      log.info("String_Node_Str" + ioe.getMessage());
    }
  }
}

Fixed version (ground truth):
private DataCiteResponse sendDOIPostRequest(String doi,String url) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(DOI_PATH);
  HttpPost httppost=null;
  try {
    httppost=new HttpPost(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  HttpEntity reqEntity=null;
  try {
    String req="String_Node_Str" + doi.substring(DOI.SCHEME.length()) + "String_Node_Str"+ "String_Node_Str"+ url+ "String_Node_Str";
    ContentType contentType=ContentType.create("String_Node_Str","String_Node_Str");
    reqEntity=new StringEntity(req,contentType);
    httppost.setEntity(reqEntity);
    return sendHttpRequest(httppost,doi);
  }
  finally {
    try {
      EntityUtils.consume(reqEntity);
    }
 catch (    IOException ioe) {
      log.info("String_Node_Str" + ioe.getMessage());
    }
  }
}
Program: 52099
Project: 52099
Buggy source:
private DataCiteResponse sendMetadataPostRequest(String doi,String metadata) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme("String_Node_Str").setHost(HOST).setPath(METADATA_PATH);
  HttpPost httppost=null;
  try {
    httppost=new HttpPost(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str","String_Node_Str" + HOST + DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  HttpEntity reqEntity=null;
  try {
    ContentType contentType=ContentType.create("String_Node_Str","String_Node_Str");
    reqEntity=new StringEntity(metadata,contentType);
    httppost.setEntity(reqEntity);
    return sendHttpRequest(httppost,doi);
  }
  finally {
    try {
      EntityUtils.consume(reqEntity);
    }
 catch (    IOException ioe) {
      log.info("String_Node_Str" + ioe.getMessage());
    }
  }
}

Fixed version (ground truth):
private DataCiteResponse sendMetadataPostRequest(String doi,String metadata) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(METADATA_PATH);
  HttpPost httppost=null;
  try {
    httppost=new HttpPost(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  HttpEntity reqEntity=null;
  try {
    ContentType contentType=ContentType.create("String_Node_Str","String_Node_Str");
    reqEntity=new StringEntity(metadata,contentType);
    httppost.setEntity(reqEntity);
    return sendHttpRequest(httppost,doi);
  }
  finally {
    try {
      EntityUtils.consume(reqEntity);
    }
 catch (    IOException ioe) {
      log.info("String_Node_Str" + ioe.getMessage());
    }
  }
}
Program: 52100
Project: 52100
Buggy source:
private DataCiteResponse sendGetRequest(String doi,String path) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme("String_Node_Str").setHost(HOST).setPath(path + doi.substring(DOI.SCHEME.length()));
  HttpGet httpget=null;
  try {
    httpget=new HttpGet(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str","String_Node_Str" + HOST + DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  return sendHttpRequest(httpget,doi);
}

Fixed version (ground truth):
private DataCiteResponse sendGetRequest(String doi,String path) throws DOIIdentifierException {
  URIBuilder uribuilder=new URIBuilder();
  uribuilder.setScheme(SCHEME).setHost(HOST).setPath(path + doi.substring(DOI.SCHEME.length()));
  HttpGet httpget=null;
  try {
    httpget=new HttpGet(uribuilder.build());
  }
 catch (  URISyntaxException e) {
    log.error("String_Node_Str" + "String_Node_Str");
    log.error("String_Node_Str",SCHEME + "String_Node_Str" + HOST+ DOI_PATH+ "String_Node_Str"+ doi.substring(DOI.SCHEME.length()));
    throw new RuntimeException("String_Node_Str" + "String_Node_Str",e);
  }
  return sendHttpRequest(httpget,doi);
}
Program: 52101
Project: 52101
Buggy source:
public void run(){
  Context context=null;
  ItemIterator iitems=null;
  try {
    context=new Context();
    context.setIgnoreAuthorization(true);
    File importDir=new File(ConfigurationManager.getProperty("String_Node_Str"));
    if (!importDir.exists()) {
      boolean success=importDir.mkdir();
      if (!success) {
        log.info("String_Node_Str");
        throw new Exception();
      }
    }
    String subDirName=generateRandomFilename(false);
    String workingDir=importDir.getAbsolutePath() + File.separator + subDirName;
    boolean success=(new File(workingDir)).mkdir();
    if (!success) {
      log.info("String_Node_Str");
      throw new Exception();
    }
    String mapfile=workingDir + File.separator + "String_Node_Str";
    ItemImport myloader=new ItemImport();
    myloader.addBTEItems(context,mycollections,myFile.getAbsolutePath(),mapfile,template,myBteInputType,workingDir);
    emailSuccessMessage(context,eperson,mapfile);
    context.setIgnoreAuthorization(false);
  }
 catch (  Exception e1) {
    try {
      emailErrorMessage(eperson,e1.getMessage());
    }
 catch (    Exception e) {
    }
    throw new IllegalStateException(e1);
  }
 finally {
    if (iitems != null) {
      iitems.close();
    }
    if (mapOut != null) {
      mapOut.close();
    }
    try {
      context.complete();
    }
 catch (    SQLException sqle) {
      context.abort();
    }
  }
}

Fixed version (ground truth):
public void run(){
  Context context=null;
  ItemIterator iitems=null;
  try {
    context=new Context();
    context.setCurrentUser(eperson);
    context.setIgnoreAuthorization(true);
    File importDir=new File(ConfigurationManager.getProperty("String_Node_Str"));
    if (!importDir.exists()) {
      boolean success=importDir.mkdir();
      if (!success) {
        log.info("String_Node_Str");
        throw new Exception();
      }
    }
    String subDirName=generateRandomFilename(false);
    String workingDir=importDir.getAbsolutePath() + File.separator + subDirName;
    boolean success=(new File(workingDir)).mkdir();
    if (!success) {
      log.info("String_Node_Str");
      throw new Exception();
    }
    String mapfile=workingDir + File.separator + "String_Node_Str";
    ItemImport myloader=new ItemImport();
    myloader.addBTEItems(context,mycollections,myFile.getAbsolutePath(),mapfile,template,myBteInputType,workingDir);
    emailSuccessMessage(context,eperson,mapfile);
    context.setIgnoreAuthorization(false);
  }
 catch (  Exception e1) {
    try {
      emailErrorMessage(eperson,e1.getMessage());
    }
 catch (    Exception e) {
    }
    throw new IllegalStateException(e1);
  }
 finally {
    if (iitems != null) {
      iitems.close();
    }
    if (mapOut != null) {
      mapOut.close();
    }
    try {
      context.complete();
    }
 catch (    SQLException sqle) {
      context.abort();
    }
  }
}
Program: 52103
Project: 52103
Buggy source:
public void reserveOnline(Context context,DSpaceObject dso,String identifier) throws IdentifierException, IllegalArgumentException, SQLException {
  String doi=DOI.formatIdentifier(identifier);
  TableRow doiRow=loadOrCreateDOI(context,dso,doi);
  if (DELETED == doiRow.getIntColumn("String_Node_Str") || TO_BE_DELETED == doiRow.getIntColumn("String_Node_Str")) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.DOI_IS_DELETED);
  }
  if (connector.isDOIReserved(context,doi)) {
    if (!connector.isDOIReserved(context,dso,doi)) {
      log.warn("String_Node_Str",doi);
      throw new DOIIdentifierException(DOIIdentifierException.DOI_ALREADY_EXISTS);
    }
  }
 else {
    connector.reserveDOI(context,dso,doi);
  }
  doiRow.setColumn("String_Node_Str",IS_RESERVED);
  DatabaseManager.update(context,doiRow);
}

Fixed version (ground truth):
public void reserveOnline(Context context,DSpaceObject dso,String identifier) throws IdentifierException, IllegalArgumentException, SQLException {
  String doi=DOI.formatIdentifier(identifier);
  TableRow doiRow=loadOrCreateDOI(context,dso,doi);
  if (DELETED == doiRow.getIntColumn("String_Node_Str") || TO_BE_DELETED == doiRow.getIntColumn("String_Node_Str")) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.DOI_IS_DELETED);
  }
  connector.reserveDOI(context,dso,doi);
  doiRow.setColumn("String_Node_Str",IS_RESERVED);
  DatabaseManager.update(context,doiRow);
}
Program: 52105
Project: 52105
Buggy source:
public void registerOnline(Context context,DSpaceObject dso,String identifier) throws IdentifierException, IllegalArgumentException, SQLException {
  String doi=DOI.formatIdentifier(identifier);
  TableRow doiRow=loadOrCreateDOI(context,dso,doi);
  if (DELETED == doiRow.getIntColumn("String_Node_Str") || TO_BE_DELETED == doiRow.getIntColumn("String_Node_Str")) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.DOI_IS_DELETED);
  }
  if (connector.isDOIRegistered(context,doi)) {
    if (!connector.isDOIRegistered(context,dso,doi)) {
      log.warn("String_Node_Str",doi);
      throw new DOIIdentifierException(DOIIdentifierException.DOI_ALREADY_EXISTS);
    }
  }
 else {
    if (!connector.isDOIReserved(context,dso,doi)) {
      if (connector.isDOIReserved(context,doi)) {
        log.warn("String_Node_Str" + "String_Node_Str",doi);
        throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.DOI_ALREADY_EXISTS);
      }
      connector.reserveDOI(context,dso,doi);
    }
    try {
      connector.registerDOI(context,dso,doi);
    }
 catch (    DOIIdentifierException die) {
      if (die.getCode() == DOIIdentifierException.RESERVE_FIRST) {
        this.reserveOnline(context,dso,identifier);
        connector.registerDOI(context,dso,doi);
      }
 else {
        throw die;
      }
    }
  }
  try {
    saveDOIToObject(context,dso,doi);
  }
 catch (  AuthorizeException ae) {
    throw new IdentifierException("String_Node_Str",ae);
  }
catch (  SQLException sqle) {
    throw new RuntimeException(sqle);
  }
  doiRow.setColumn("String_Node_Str",IS_REGISTERED);
  DatabaseManager.update(context,doiRow);
}

Fixed version (ground truth):
public void registerOnline(Context context,DSpaceObject dso,String identifier) throws IdentifierException, IllegalArgumentException, SQLException {
  String doi=DOI.formatIdentifier(identifier);
  TableRow doiRow=loadOrCreateDOI(context,dso,doi);
  if (DELETED == doiRow.getIntColumn("String_Node_Str") || TO_BE_DELETED == doiRow.getIntColumn("String_Node_Str")) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.DOI_IS_DELETED);
  }
  try {
    connector.registerDOI(context,dso,doi);
  }
 catch (  DOIIdentifierException die) {
    if (die.getCode() == DOIIdentifierException.RESERVE_FIRST) {
      this.reserveOnline(context,dso,identifier);
      connector.registerDOI(context,dso,doi);
    }
 else {
      throw die;
    }
  }
  try {
    saveDOIToObject(context,dso,doi);
  }
 catch (  AuthorizeException ae) {
    throw new IdentifierException("String_Node_Str",ae);
  }
catch (  SQLException sqle) {
    throw new RuntimeException(sqle);
  }
  doiRow.setColumn("String_Node_Str",IS_REGISTERED);
  DatabaseManager.update(context,doiRow);
}
Program: 52106
Project: 52106
Buggy source:
/** 
 * Sends a request to the DOI registry to register a DOI. Please check on your own if the DOI is already reserved or even registered before you try to register it. You can use the methods  {@code DOIConnector.isDOIRegistered(...)} and{@code DOIConnector.isDOIReserved(...)} for it. The DOIConnector won'tdo any tests and throws an DOIIdentifierException in case of any problems with the DOI you want to register.
 * @param context
 * @param dso
 * @param doi
 * @return
 * @throws DOIIdentifierException 
 */
public void registerDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException ;

Fixed version (ground truth):
/** 
 * Sends a request to the DOI registry to register a DOI. The DOIConnector ensures compliance with the workflow of the registration agency. For example, if a DOI has to be reserved before it can be registered the DOIConnector has to check if it is reserved. In this case you can throw an DOIIdentifierExcpetion and set the error code to   {@link DOIIdentifierException.RESERVE_FIRST}.
 * @param context
 * @param dso
 * @param doi
 * @return
 * @throws DOIIdentifierException 
 */
public void registerDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException ;
Program: 52107
Project: 52107
Buggy source:
/** 
 * Sends a request to the DOI registry to update Metadata for a DOI. The DOIConnector won't do any tests and throws an IdentifierException  in case of any problems with the DOI you want to update the metadata.
 * @param context
 * @param dso
 * @param doi
 * @return
 * @throws IdentifierException 
 */
public void updateMetadata(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException ;

Fixed version (ground truth):
/** 
 * Sends a request to the DOI registry to update metadata for a DOI. The DOIConnector should check weather the DOI is reserved or registered  for the specified DSpace Object before it sends the metadata update.
 * @param context
 * @param dso
 * @param doi
 * @return
 * @throws IdentifierException 
 */
public void updateMetadata(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException ;
Program: 52108
Project: 52108
Buggy source:
/** 
 * Sends a request to the DOI registry to reserve a DOI. Please check on your own if the DOI is already reserved or even registered before you try to reserve it. You can use  {@link isDOIRegistered} and {@link isDOIReserved} for it. TheDOIConnector won't do any tests and throws an DOIIdentifierException in case of any problems with the DOI you want to reserve.
 * @param context
 * @param dso
 * @param doi
 * @return
 * @throws DOIIdentifierException 
 */
public void reserveDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException ;

Fixed version (ground truth):
/** 
 * Sends a request to the DOI registry to reserve a DOI. The DOIConnector should check weather this DOI is reserved for another object already. In this case it should throw an   {@link DOIIdentifierException} and set the error code to {@code DOIIdentifierException.DOI_ALREADY_EXISTS}.
 * @param context
 * @param dso
 * @param doi
 * @return
 * @throws DOIIdentifierException 
 */
public void reserveDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException ;
Program: 52109
Project: 52109
Buggy source:
/** 
 * Sends the DELETE-Request to the DOI registry. <p>This method sends a request to "delete" a DOI. As DOIs are persistent identifiers they should never be deleted. For example, if you send a HTTP DELETE request to the DataCite Metadata API directly, it will set the DOI to inactive.</p> <p>A DOIConnector does not have to check whether the DOI is reserved, registered or not. It will only send the request and return the answer in form of a boolean weather the deletion was successful or not. It may even throw an DOIIdentifierException in case you are not allowed to delete a DOI, the DOI does not exist, ... So please be sure that the deletion of a DOI is conform with the rules of the registry and that the DOI is in the appropriate state (f.e. reserved but not registered).</p>
 * @param context
 * @param doi
 * @return
 * @throws DOIIdentifierException 
 */
public void deleteDOI(Context context,String doi) throws DOIIdentifierException ;

Fixed version (ground truth):
/** 
 * Sends the DELETE-Request to the DOI registry. <p>This method sends a request to "delete" a DOI. As DOIs are persistent identifiers they should never be deleted. For example, if you send a HTTP DELETE request to the DataCite Metadata API directly, it will set the DOI to inactive.</p>
 * @param context
 * @param doi
 * @return
 * @throws DOIIdentifierException 
 */
public void deleteDOI(Context context,String doi) throws DOIIdentifierException ;
Program: 52110
Project: 52110
Buggy source:
@Override public void registerDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException {
  log.debug("String_Node_Str",doi);
  DataCiteResponse resp=null;
  try {
    resp=this.sendDOIPostRequest(doi,HandleManager.resolveToURL(context,dso.getHandle()));
  }
 catch (  SQLException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new RuntimeException(e);
  }
switch (resp.statusCode) {
case (201):
{
      return;
    }
case (400):
{
    log.warn("String_Node_Str" + "String_Node_Str" + resp.getContent());
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str" + "String_Node_Str",DOIIdentifierException.BAD_REQUEST);
  }
case (412):
{
  log.error("String_Node_Str" + "String_Node_Str",doi,resp.getContent());
  throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",DOIIdentifierException.RESERVE_FIRST);
}
default :
{
log.warn("String_Node_Str" + "String_Node_Str",new String[]{doi,Integer.toString(resp.statusCode),resp.getContent()});
throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.BAD_ANSWER);
}
}
}

Fixed version (ground truth):
@Override public void registerDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException {
  if (this.isDOIRegistered(context,doi)) {
    if (!this.isDOIRegistered(context,dso,doi)) {
      log.warn("String_Node_Str",doi);
      throw new DOIIdentifierException(DOIIdentifierException.DOI_ALREADY_EXISTS);
    }
    return;
  }
 else {
    if (!this.isDOIReserved(context,dso,doi)) {
      if (this.isDOIReserved(context,doi)) {
        log.warn("String_Node_Str" + "String_Node_Str",doi);
        throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.DOI_ALREADY_EXISTS);
      }
      throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.RESERVE_FIRST);
    }
  }
  DataCiteResponse resp=null;
  try {
    resp=this.sendDOIPostRequest(doi,HandleManager.resolveToURL(context,dso.getHandle()));
  }
 catch (  SQLException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new RuntimeException(e);
  }
switch (resp.statusCode) {
case (201):
{
      return;
    }
case (400):
{
    log.warn("String_Node_Str" + "String_Node_Str" + resp.getContent());
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str" + "String_Node_Str",DOIIdentifierException.BAD_REQUEST);
  }
case (412):
{
  log.error("String_Node_Str" + "String_Node_Str",doi,resp.getContent());
  throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",DOIIdentifierException.RESERVE_FIRST);
}
default :
{
log.warn("String_Node_Str" + "String_Node_Str",new String[]{doi,Integer.toString(resp.statusCode),resp.getContent()});
throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.BAD_ANSWER);
}
}
}
Program: 52112
Project: 52112
Buggy source:
@Override public void updateMetadata(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException {
  this.reserveDOI(context,dso,doi);
}

Fixed version (ground truth):
@Override public void updateMetadata(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException {
  if (!this.isDOIReserved(context,dso,doi) && this.isDOIReserved(context,doi)) {
    log.warn("String_Node_Str" + "String_Node_Str",doi);
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.DOI_ALREADY_EXISTS);
  }
  this.reserveDOI(context,dso,doi);
}
Program: 52114
Project: 52114
Buggy source:
public static String codeToString(int code){
switch (code) {
case CODE_NOT_SET:
    return "String_Node_Str";
case DOI_DOES_NOT_EXIST:
  return "String_Node_Str";
case DOI_ALREADY_EXISTS:
return "String_Node_Str";
case FOREIGN_DOI:
return "String_Node_Str";
case BAD_ANSWER:
return "String_Node_Str";
case REGISTER_FIRST:
return "String_Node_Str";
case AUTHENTICATION_ERROR:
return "String_Node_Str";
case INTERNAL_ERROR:
return "String_Node_Str";
case CONVERSION_ERROR:
return "String_Node_Str";
case MISMATCH:
return "String_Node_Str";
case UNRECOGNIZED:
return "String_Node_Str";
case UNAUTHORIZED_METADATA_MANIPULATION:
return "String_Node_Str";
case DOI_IS_DELETED:
return "String_Node_Str";
default :
return "String_Node_Str";
}
}

Fixed version (ground truth):
public static String codeToString(int code){
switch (code) {
case CODE_NOT_SET:
    return "String_Node_Str";
case DOI_DOES_NOT_EXIST:
  return "String_Node_Str";
case DOI_ALREADY_EXISTS:
return "String_Node_Str";
case FOREIGN_DOI:
return "String_Node_Str";
case BAD_ANSWER:
return "String_Node_Str";
case RESERVE_FIRST:
return "String_Node_Str";
case AUTHENTICATION_ERROR:
return "String_Node_Str";
case INTERNAL_ERROR:
return "String_Node_Str";
case CONVERSION_ERROR:
return "String_Node_Str";
case MISMATCH:
return "String_Node_Str";
case UNRECOGNIZED:
return "String_Node_Str";
case UNAUTHORIZED_METADATA_MANIPULATION:
return "String_Node_Str";
case DOI_IS_DELETED:
return "String_Node_Str";
default :
return "String_Node_Str";
}
}
Program: 52115
Project: 52115
Buggy source:
@Override public void registerDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException {
  log.debug("String_Node_Str",doi);
  DataCiteResponse resp=null;
  try {
    resp=this.sendDOIPostRequest(doi,HandleManager.resolveToURL(context,dso.getHandle()));
  }
 catch (  SQLException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new RuntimeException(e);
  }
switch (resp.statusCode) {
case (201):
{
      return;
    }
case (400):
{
    log.warn("String_Node_Str" + "String_Node_Str" + resp.getContent());
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str" + "String_Node_Str",DOIIdentifierException.BAD_REQUEST);
  }
case (412):
{
  log.error("String_Node_Str" + "String_Node_Str",doi,resp.getContent());
  throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",DOIIdentifierException.REGISTER_FIRST);
}
default :
{
log.warn("String_Node_Str" + "String_Node_Str",new String[]{doi,Integer.toString(resp.statusCode),resp.getContent()});
throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.BAD_ANSWER);
}
}
}

Fixed version (ground truth):
@Override public void registerDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException {
  log.debug("String_Node_Str",doi);
  DataCiteResponse resp=null;
  try {
    resp=this.sendDOIPostRequest(doi,HandleManager.resolveToURL(context,dso.getHandle()));
  }
 catch (  SQLException e) {
    log.error("String_Node_Str" + e.getMessage());
    throw new RuntimeException(e);
  }
switch (resp.statusCode) {
case (201):
{
      return;
    }
case (400):
{
    log.warn("String_Node_Str" + "String_Node_Str" + resp.getContent());
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str" + "String_Node_Str",DOIIdentifierException.BAD_REQUEST);
  }
case (412):
{
  log.error("String_Node_Str" + "String_Node_Str",doi,resp.getContent());
  throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",DOIIdentifierException.RESERVE_FIRST);
}
default :
{
log.warn("String_Node_Str" + "String_Node_Str",new String[]{doi,Integer.toString(resp.statusCode),resp.getContent()});
throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.BAD_ANSWER);
}
}
}
Program: 52116
Project: 52116
Buggy source:
@Override @Mock public void registerDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException {
  if (!reserved.containsKey(doi)) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.REGISTER_FIRST);
  }
  if (reserved.get(doi).intValue() != dso.getID()) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.MISMATCH);
  }
  if (registered.containsKey(doi)) {
    if (registered.get(doi).intValue() == dso.getID()) {
      return;
    }
 else {
      throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.MISMATCH);
    }
  }
  registered.put(doi,new Integer(dso.getID()));
}

Fixed version (ground truth):
@Override @Mock public void registerDOI(Context context,DSpaceObject dso,String doi) throws DOIIdentifierException {
  if (!reserved.containsKey(doi)) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.RESERVE_FIRST);
  }
  if (reserved.get(doi).intValue() != dso.getID()) {
    throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.MISMATCH);
  }
  if (registered.containsKey(doi)) {
    if (registered.get(doi).intValue() == dso.getID()) {
      return;
    }
 else {
      throw new DOIIdentifierException("String_Node_Str" + "String_Node_Str",DOIIdentifierException.MISMATCH);
    }
  }
  registered.put(doi,new Integer(dso.getID()));
}
Program: 52117
Project: 52117
Buggy source:
@Override public RecordSet getRecords(DataLoadingSpec spec) throws MalformedSourceException {
  return getRecords();
}

Fixed version (ground truth):
@Override public RecordSet getRecords(DataLoadingSpec spec) throws MalformedSourceException {
  if (spec.getOffset() > 0) {
    return new RecordSet();
  }
  return getRecords();
}
Program: 52118
Project: 52118
Buggy source:
@Override public RecordSet getRecords(DataLoadingSpec spec) throws MalformedSourceException {
  return getRecords();
}

Fixed version (ground truth):
@Override public RecordSet getRecords(DataLoadingSpec spec) throws MalformedSourceException {
  if (spec.getOffset() > 0) {
    return new RecordSet();
  }
  return getRecords();
}
Program: 52119
Project: 52119
Buggy source:
@Override public RecordSet getRecords(DataLoadingSpec spec) throws MalformedSourceException {
  return getRecords();
}

Fixed version (ground truth):
@Override public RecordSet getRecords(DataLoadingSpec spec) throws MalformedSourceException {
  if (spec.getOffset() > 0) {
    return new RecordSet();
  }
  return getRecords();
}
Program: 52121
Project: 52121
Buggy source:
/** 
 * GET request is only ever used to show the upload form
 * @param context a DSpace Context object
 * @param request the HTTP request
 * @param response the HTTP response
 * @throws ServletException
 * @throws IOException
 * @throws SQLException
 * @throws AuthorizeException
 */
protected void doDSGet(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  DataLoaderService dls=new DSpace().getSingletonService(DataLoaderService.class);
  List<String> inputTypes=Lists.newArrayList(dls.getDataLoaders().keySet());
  request.setAttribute("String_Node_Str",inputTypes);
  List<Collection> collections=null;
  String colIdS=request.getParameter("String_Node_Str");
  if (colIdS != null) {
    collections=new ArrayList<Collection>();
    collections.add(Collection.find(context,Integer.parseInt(colIdS)));
  }
 else {
    collections=Arrays.asList(Collection.findAll(context));
  }
  request.setAttribute("String_Node_Str",collections);
  JSPManager.showJSP(request,response,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * GET request is only ever used to show the upload form
 * @param context a DSpace Context object
 * @param request the HTTP request
 * @param response the HTTP response
 * @throws ServletException
 * @throws IOException
 * @throws SQLException
 * @throws AuthorizeException
 */
protected void doDSGet(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  BTEBatchImportService dls=new DSpace().getSingletonService(BTEBatchImportService.class);
  List<String> inputTypes=Lists.newArrayList(dls.getDataLoaders().keySet());
  request.setAttribute("String_Node_Str",inputTypes);
  List<Collection> collections=null;
  String colIdS=request.getParameter("String_Node_Str");
  if (colIdS != null) {
    collections=new ArrayList<Collection>();
    collections.add(Collection.find(context,Integer.parseInt(colIdS)));
  }
 else {
    collections=Arrays.asList(Collection.findAll(context));
  }
  request.setAttribute("String_Node_Str",collections);
  JSPManager.showJSP(request,response,"String_Node_Str");
}
Program: 52122
Project: 52122
Buggy source:
@GET @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public org.dspace.rest.common.Collection[] list(@QueryParam("String_Node_Str") String expand,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") Integer limit,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") Integer offset){
  try {
    if (context == null || !context.isValid()) {
      context=new org.dspace.core.Context();
      context.getDBConnection().setAutoCommit(true);
    }
    org.dspace.content.Collection[] collections;
    if (limit != null && limit >= 0 && offset != null && offset != 0) {
      collections=org.dspace.content.Collection.findAll(context,limit,offset);
    }
 else {
      collections=org.dspace.content.Collection.findAll(context);
    }
    ArrayList<org.dspace.rest.common.Collection> collectionArrayList=new ArrayList<org.dspace.rest.common.Collection>();
    for (    org.dspace.content.Collection collection : collections) {
      if (AuthorizeManager.authorizeActionBoolean(context,collection,org.dspace.core.Constants.READ)) {
        org.dspace.rest.common.Collection restCollection=new org.dspace.rest.common.Collection(collection,expand,context,limit,offset);
        collectionArrayList.add(restCollection);
      }
    }
    return collectionArrayList.toArray(new org.dspace.rest.common.Collection[0]);
  }
 catch (  SQLException e) {
    log.error(e.getMessage());
    throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
  }
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) public org.dspace.rest.common.Collection[] list(@QueryParam("String_Node_Str") String expand,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") Integer limit,@QueryParam("String_Node_Str") @DefaultValue("String_Node_Str") Integer offset){
  try {
    if (context == null || !context.isValid()) {
      context=new org.dspace.core.Context();
      context.getDBConnection().setAutoCommit(true);
    }
    org.dspace.content.Collection[] collections;
    if (limit != null && limit >= 0 && offset != null && offset >= 0) {
      collections=org.dspace.content.Collection.findAll(context,limit,offset);
    }
 else {
      collections=org.dspace.content.Collection.findAll(context);
    }
    ArrayList<org.dspace.rest.common.Collection> collectionArrayList=new ArrayList<org.dspace.rest.common.Collection>();
    for (    org.dspace.content.Collection collection : collections) {
      if (AuthorizeManager.authorizeActionBoolean(context,collection,org.dspace.core.Constants.READ)) {
        org.dspace.rest.common.Collection restCollection=new org.dspace.rest.common.Collection(collection,expand,context,limit,offset);
        collectionArrayList.add(restCollection);
      }
    }
    return collectionArrayList.toArray(new org.dspace.rest.common.Collection[0]);
  }
 catch (  SQLException e) {
    log.error(e.getMessage());
    throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
  }
}
Program: 52123
Project: 52123
Buggy source:
@Override public RecordSet getRecords(DataLoadingSpec arg0) throws MalformedSourceException {
  return getRecords();
}

Fixed version (ground truth):
@Override public RecordSet getRecords(DataLoadingSpec loadingSpec) throws MalformedSourceException {
  if (loadingSpec.getOffset() > 0)   return new RecordSet();
  return getRecords();
}