nus-yam/ex-repair huggingface dataset:
Program: 51827
Project: 51827
Buggy source:
@Override public void update(Context context,Bitstream bitstream) throws SQLException, AuthorizeException {
  authorizeService.authorizeAction(context,bitstream,Constants.WRITE);
  log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + bitstream.getID()));
  super.update(context,bitstream);
  if (bitstream.isModified()) {
    context.addEvent(new Event(Event.MODIFY,Constants.BITSTREAM,bitstream.getID(),null,getIdentifiers(context,bitstream)));
    bitstream.setModified();
  }
  if (bitstream.isMetadataModified()) {
    context.addEvent(new Event(Event.MODIFY_METADATA,Constants.BITSTREAM,bitstream.getID(),bitstream.getDetails(),getIdentifiers(context,bitstream)));
    bitstream.clearModified();
    bitstream.clearDetails();
  }
  bitstreamDAO.save(context,bitstream);
}

Fixed version (ground truth):
@Override public void update(Context context,Bitstream bitstream) throws SQLException, AuthorizeException {
  log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + bitstream.getID()));
  super.update(context,bitstream);
  if (bitstream.isModified()) {
    context.addEvent(new Event(Event.MODIFY,Constants.BITSTREAM,bitstream.getID(),null,getIdentifiers(context,bitstream)));
    bitstream.setModified();
  }
  if (bitstream.isMetadataModified()) {
    context.addEvent(new Event(Event.MODIFY_METADATA,Constants.BITSTREAM,bitstream.getID(),bitstream.getDetails(),getIdentifiers(context,bitstream)));
    bitstream.clearModified();
    bitstream.clearDetails();
  }
  bitstreamDAO.save(context,bitstream);
}
Program: 51828
Project: 51828
Buggy source:
@Override public void delete(Context context,Bitstream bitstream) throws SQLException, AuthorizeException {
  authorizeService.authorizeAction(context,bitstream,Constants.DELETE);
  log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + bitstream.getID()));
  context.addEvent(new Event(Event.DELETE,Constants.BITSTREAM,bitstream.getID(),String.valueOf(bitstream.getSequenceID()),getIdentifiers(context,bitstream)));
  bitstream.setDeleted(true);
  update(context,bitstream);
  final List<Bundle> bundles=bitstream.getBundles();
  for (  Bundle bundle : bundles) {
    bundle.removeBitstream(bitstream);
  }
  bundles.clear();
  authorizeService.removeAllPolicies(context,bitstream);
}

Fixed version (ground truth):
@Override public void delete(Context context,Bitstream bitstream) throws SQLException, AuthorizeException {
  log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + bitstream.getID()));
  context.addEvent(new Event(Event.DELETE,Constants.BITSTREAM,bitstream.getID(),String.valueOf(bitstream.getSequenceID()),getIdentifiers(context,bitstream)));
  bitstream.setDeleted(true);
  update(context,bitstream);
  final List<Bundle> bundles=bitstream.getBundles();
  for (  Bundle bundle : bundles) {
    bundle.removeBitstream(bitstream);
  }
  bundles.clear();
  authorizeService.removeAllPolicies(context,bitstream);
}
Program: 51829
Project: 51829
Buggy source:
@RequestMapping(method=RequestMethod.DELETE,value=REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID) public ResponseEntity<ResourceSupport> delete(HttpServletRequest request,@PathVariable String apiCategory,@PathVariable String model,@PathVariable UUID id) throws HttpRequestMethodNotSupportedException {
  return deleteInternal(apiCategory,model,id);
}

Fixed version (ground truth):
@RequestMapping(method=RequestMethod.DELETE,value=REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID) public ResponseEntity<ResourceSupport> delete(HttpServletRequest request,@PathVariable String apiCategory,@PathVariable String model,@PathVariable UUID uuid) throws HttpRequestMethodNotSupportedException {
  return deleteInternal(apiCategory,model,uuid);
}
Program: 51831
Project: 51831
Buggy source:
@JsonProperty(value="String_Node_Str") public Map<String,List> getPageContent(){
  return fullMap;
}

Fixed version (ground truth):
@JsonProperty(value="String_Node_Str") public Map<String,List> getPageContent(){
  return embeddedPageContent;
}
Program: 51832
Project: 51832
Buggy source:
public EmbeddedPage(String self,Page page,List fullList,boolean totalElementsIsKnown,String relation){
  super(self,page,totalElementsIsKnown);
  fullMap=new HashMap<String,List>();
  fullMap.put(relation,fullList);
}

Fixed version (ground truth):
public EmbeddedPage(String self,Page page,List fullList,boolean totalElementsIsKnown,String relation){
  super(self,page,totalElementsIsKnown);
  this.fullList=fullList;
  this.embeddedPageContent=new HashMap<>();
  embeddedPageContent.put(relation,page.getContent());
}
Program: 51833
Project: 51833
Buggy source:
@JsonIgnore public Map<String,List> getFullList(){
  return fullMap;
}

Fixed version (ground truth):
@JsonIgnore public List getFullList(){
  return fullList;
}
Program: 51834
Project: 51834
Buggy source:
@Test public void discoverSearchTest() throws Exception {
  getClient().perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(jsonPath("String_Node_Str",is("String_Node_Str"))).andExpect(jsonPath("String_Node_Str",containsString("String_Node_Str"))).andExpect(jsonPath("String_Node_Str",containsString("String_Node_Str"))).andExpect(jsonPath("String_Node_Str",containsInAnyOrder(SearchFilterMatcher.titleFilter(),SearchFilterMatcher.authorFilter(),SearchFilterMatcher.subjectFilter(),SearchFilterMatcher.dateIssuedFilter(),SearchFilterMatcher.hasContentInOriginalBundleFilter()))).andExpect(jsonPath("String_Node_Str",containsInAnyOrder(SortOptionMatcher.titleSortOption(),SortOptionMatcher.dateIssuedSortOption(),SortOptionMatcher.scoreSortOption())));
}

Fixed version (ground truth):
@Test public void discoverSearchTest() throws Exception {
  getClient().perform(get("String_Node_Str")).andExpect(status().isOk()).andExpect(jsonPath("String_Node_Str",is("String_Node_Str"))).andExpect(jsonPath("String_Node_Str",containsString("String_Node_Str"))).andExpect(jsonPath("String_Node_Str",containsString("String_Node_Str"))).andExpect(jsonPath("String_Node_Str",containsInAnyOrder(SearchFilterMatcher.titleFilter(),SearchFilterMatcher.authorFilter(),SearchFilterMatcher.subjectFilter(),SearchFilterMatcher.dateIssuedFilter(),SearchFilterMatcher.hasContentInOriginalBundleFilter()))).andExpect(jsonPath("String_Node_Str",containsInAnyOrder(SortOptionMatcher.titleSortOption(),SortOptionMatcher.dateIssuedSortOption(),SortOptionMatcher.dateAccessionedSortOption(),SortOptionMatcher.scoreSortOption())));
}
Program: 51835
Project: 51835
Buggy source:
/** 
 * Default constructor
 */
private Util(){
}

Fixed version (ground truth):
/** 
 * Default constructor. Must be protected as org.dspace.xmlworkflow.WorkflowUtils extends it
 */
protected Util(){
}
Program: 51836
Project: 51836
Buggy source:
@Test public void findByCollection() throws Exception {
  context.turnOffAuthorisationSystem();
  parentCommunity=new CommunityBuilder().createCommunity(context).withName("String_Node_Str").build();
  Collection col1=new CollectionBuilder().createCollection(context,parentCommunity).withName("String_Node_Str").build();
  getClient().perform(get("String_Node_Str").param("String_Node_Str",col1.getID().toString())).andExpect(status().isOk()).andDo(MockMvcResultHandlers.print()).andExpect(content().contentType(contentType)).andExpect(jsonPath("String_Node_Str",SubmissionDefinitionsMatcher.matchSubmissionDefinition(true,"String_Node_Str","String_Node_Str")));
}

Fixed version (ground truth):
@Test public void findByCollection() throws Exception {
  context.turnOffAuthorisationSystem();
  parentCommunity=CommunityBuilder.createCommunity(context).withName("String_Node_Str").build();
  Collection col1=CollectionBuilder.createCollection(context,parentCommunity).withName("String_Node_Str").build();
  getClient().perform(get("String_Node_Str").param("String_Node_Str",col1.getID().toString())).andExpect(status().isOk()).andDo(MockMvcResultHandlers.print()).andExpect(content().contentType(contentType)).andExpect(jsonPath("String_Node_Str",SubmissionDefinitionsMatcher.matchSubmissionDefinition(true,"String_Node_Str","String_Node_Str")));
}
Program: 51837
Project: 51837
Buggy source:
@RequestMapping(method=RequestMethod.GET,value="String_Node_Str") public FacetsResource getFacets(@RequestParam(name="String_Node_Str",required=false) String query,@RequestParam(name="String_Node_Str",required=false) String dsoType,@RequestParam(name="String_Node_Str",required=false) String dsoScope,@RequestParam(name="String_Node_Str",required=false) String configurationName,List<SearchFilter> searchFilters,Pageable page) throws Exception {
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + StringUtils.trimToEmpty(dsoScope) + "String_Node_Str"+ StringUtils.trimToEmpty(configurationName)+ "String_Node_Str"+ StringUtils.trimToEmpty(dsoType)+ "String_Node_Str"+ StringUtils.trimToEmpty(dsoType)+ "String_Node_Str"+ Objects.toString(searchFilters)+ "String_Node_Str"+ Objects.toString(page));
  }
  SearchResultsRest searchResultsRest=discoveryRestRepository.getAllFacets(query,dsoType,dsoScope,configurationName,searchFilters,page);
  FacetsResource facetsResource=new FacetsResource(searchResultsRest);
  halLinkService.addLinks(facetsResource);
  return facetsResource;
}

Fixed version (ground truth):
@RequestMapping(method=RequestMethod.GET,value="String_Node_Str") public FacetsResource getFacets(@RequestParam(name="String_Node_Str",required=false) String query,@RequestParam(name="String_Node_Str",required=false) String dsoType,@RequestParam(name="String_Node_Str",required=false) String dsoScope,@RequestParam(name="String_Node_Str",required=false) String configurationName,List<SearchFilter> searchFilters) throws Exception {
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + StringUtils.trimToEmpty(dsoScope) + "String_Node_Str"+ StringUtils.trimToEmpty(configurationName)+ "String_Node_Str"+ StringUtils.trimToEmpty(dsoType)+ "String_Node_Str"+ StringUtils.trimToEmpty(dsoType)+ "String_Node_Str"+ Objects.toString(searchFilters));
  }
  SearchResultsRest searchResultsRest=discoveryRestRepository.getAllFacets(query,dsoType,dsoScope,configurationName,searchFilters);
  FacetsResource facetsResource=new FacetsResource(searchResultsRest);
  halLinkService.addLinks(facetsResource);
  return facetsResource;
}
Program: 51838
Project: 51838
Buggy source:
private void addFacetValues(final DiscoverResult searchResult,final SearchResultsRest resultsRest,final DiscoveryConfiguration configuration){
  List<DiscoverySearchFilterFacet> facets=configuration.getSidebarFacets();
  for (  DiscoverySearchFilterFacet field : CollectionUtils.emptyIfNull(facets)) {
    List<DiscoverResult.FacetResult> facetValues=searchResult.getFacetResult(field);
    SearchFacetEntryRest facetEntry=new SearchFacetEntryRest(field.getIndexFieldName());
    int valueCount=0;
    facetEntry.setFacetLimit(field.getFacetLimit());
    for (    DiscoverResult.FacetResult value : CollectionUtils.emptyIfNull(facetValues)) {
      if (valueCount < field.getFacetLimit()) {
        SearchFacetValueRest valueRest=facetValueConverter.convert(value);
        facetEntry.addValue(valueRest);
      }
 else {
        facetEntry.setHasMore(true);
      }
      if (StringUtils.isBlank(facetEntry.getFacetType())) {
        facetEntry.setFacetType(value.getFieldType());
      }
      valueCount++;
    }
    resultsRest.addFacetEntry(facetEntry);
  }
}

Fixed version (ground truth):
private void addFacetValues(final DiscoverResult searchResult,final SearchResultsRest resultsRest,final DiscoveryConfiguration configuration){
  List<DiscoverySearchFilterFacet> facets=configuration.getSidebarFacets();
  for (  DiscoverySearchFilterFacet field : CollectionUtils.emptyIfNull(facets)) {
    List<DiscoverResult.FacetResult> facetValues=searchResult.getFacetResult(field);
    SearchFacetEntryRest facetEntry=new SearchFacetEntryRest(field.getIndexFieldName());
    int valueCount=0;
    facetEntry.setHasMore(false);
    facetEntry.setFacetLimit(field.getFacetLimit());
    for (    DiscoverResult.FacetResult value : CollectionUtils.emptyIfNull(facetValues)) {
      if (valueCount < field.getFacetLimit()) {
        SearchFacetValueRest valueRest=facetValueConverter.convert(value);
        facetEntry.addValue(valueRest);
      }
 else {
        facetEntry.setHasMore(true);
      }
      if (StringUtils.isBlank(facetEntry.getFacetType())) {
        facetEntry.setFacetType(value.getFieldType());
      }
      valueCount++;
    }
    resultsRest.addFacetEntry(facetEntry);
  }
}
Program: 51839
Project: 51839
Buggy source:
protected UriComponentsBuilder buildSearchFacetsBaseLink(final SearchResultsRest data) throws Exception {
  UriComponentsBuilder uriBuilder=uriBuilder(getMethodOn().getFacets(data.getQuery(),data.getDsoType(),data.getScope(),data.getConfigurationName(),null,null));
  uriBuilder=addSortingParms(uriBuilder,data);
  return addFilterParams(uriBuilder,data);
}

Fixed version (ground truth):
protected UriComponentsBuilder buildSearchFacetsBaseLink(final SearchResultsRest data) throws Exception {
  UriComponentsBuilder uriBuilder=uriBuilder(getMethodOn().getFacets(data.getQuery(),data.getDsoType(),data.getScope(),data.getConfigurationName(),null));
  uriBuilder=addSortingParms(uriBuilder,data);
  return addFilterParams(uriBuilder,data);
}
Program: 51840
Project: 51840
Buggy source:
protected void addLinks(SearchConfigurationResource halResource,Pageable pageable,LinkedList<Link> list) throws Exception {
  SearchConfigurationRest data=halResource.getContent();
  if (data != null) {
    list.add(buildLink(Link.REL_SELF,getMethodOn().getSearchConfiguration(data.getScope(),data.getConfigurationName())));
    list.add(buildLink("String_Node_Str",getMethodOn().getSearchObjects(null,null,null,null,null,null)));
    list.add(buildLink("String_Node_Str",getMethodOn().getFacets(null,null,null,null,null,null)));
  }
}

Fixed version (ground truth):
protected void addLinks(SearchConfigurationResource halResource,Pageable pageable,LinkedList<Link> list) throws Exception {
  SearchConfigurationRest data=halResource.getContent();
  if (data != null) {
    list.add(buildLink(Link.REL_SELF,getMethodOn().getSearchConfiguration(data.getScope(),data.getConfigurationName())));
    list.add(buildLink("String_Node_Str",getMethodOn().getSearchObjects(null,null,null,null,null,null)));
    list.add(buildLink("String_Node_Str",getMethodOn().getFacets(null,null,null,null,null)));
  }
}
Program: 51841
Project: 51841
Buggy source:
@Override protected void addLinks(SearchFacetEntryResource halResource,Pageable pageable,LinkedList<Link> list) throws Exception {
  SearchFacetEntryRest facetData=halResource.getFacetData();
  DiscoveryResultsRest searchData=halResource.getSearchData();
  String query=searchData == null ? null : searchData.getQuery();
  String dsoType=searchData == null ? null : searchData.getDsoType();
  String scope=searchData == null ? null : searchData.getScope();
  UriComponentsBuilder uriBuilder=uriBuilder(getMethodOn().getFacetValues(facetData.getName(),query,dsoType,scope,null,null));
  addFilterParams(uriBuilder,searchData);
  if (CollectionUtils.isNotEmpty(facetData.getValues()) && facetData.isHasMore() != null) {
    PageImpl page=new PageImpl<>(facetData.getValues(),new PageRequest(0,facetData.getFacetLimit()),facetData.getValues().size() + (facetData.isHasMore() ? 1 : 0));
    halResource.setPageHeader(new EmbeddedPageHeader(uriBuilder,page,false));
    list.add(buildLink(Link.REL_SELF,uriBuilder.build().toUriString()));
  }
 else {
    list.add(buildLink(Link.REL_SELF,uriBuilder.build().toUriString()));
  }
}

Fixed version (ground truth):
@Override protected void addLinks(SearchFacetEntryResource halResource,Pageable pageable,LinkedList<Link> list) throws Exception {
  SearchFacetEntryRest facetData=halResource.getFacetData();
  DiscoveryResultsRest searchData=halResource.getSearchData();
  String query=searchData == null ? null : searchData.getQuery();
  String dsoType=searchData == null ? null : searchData.getDsoType();
  String scope=searchData == null ? null : searchData.getScope();
  UriComponentsBuilder uriBuilder=uriBuilder(getMethodOn().getFacetValues(facetData.getName(),query,dsoType,scope,null,null));
  addFilterParams(uriBuilder,searchData);
  if (CollectionUtils.isNotEmpty(facetData.getValues())) {
    PageImpl page=new PageImpl<>(facetData.getValues(),new PageRequest(0,facetData.getFacetLimit()),facetData.getValues().size() + (BooleanUtils.isTrue(facetData.isHasMore()) ? 1 : 0));
    halResource.setPageHeader(new EmbeddedPageHeader(uriBuilder,page,false));
  }
 else {
    list.add(buildLink(Link.REL_SELF,uriBuilder.build().toUriString()));
  }
}
Program: 51842
Project: 51842
Buggy source:
public SearchResultsRest getAllFacets(String query,String dsoType,String dsoScope,String configurationName,List<SearchFilter> searchFilters,Pageable page) throws InvalidRequestException {
  Context context=obtainContext();
  DSpaceObject scopeObject=scopeResolver.resolveScope(context,dsoScope);
  DiscoveryConfiguration configuration=searchConfigurationService.getDiscoveryConfigurationByNameOrDso(configurationName,scopeObject);
  DiscoverResult searchResult=null;
  DiscoverQuery discoverQuery=null;
  try {
    discoverQuery=queryBuilder.buildQuery(context,scopeObject,configuration,query,searchFilters,dsoType,page);
    searchResult=searchService.search(context,scopeObject,discoverQuery);
  }
 catch (  SearchServiceException e) {
    log.error("String_Node_Str",e);
  }
  SearchResultsRest searchResultsRest=discoverFacetsConverter.convert(context,query,dsoType,configurationName,dsoScope,searchFilters,page,configuration,searchResult);
  return searchResultsRest;
}

Fixed version (ground truth):
public SearchResultsRest getAllFacets(String query,String dsoType,String dsoScope,String configurationName,List<SearchFilter> searchFilters) throws InvalidRequestException {
  Context context=obtainContext();
  Pageable page=new PageRequest(1,1);
  DSpaceObject scopeObject=scopeResolver.resolveScope(context,dsoScope);
  DiscoveryConfiguration configuration=searchConfigurationService.getDiscoveryConfigurationByNameOrDso(configurationName,scopeObject);
  DiscoverResult searchResult=null;
  DiscoverQuery discoverQuery=null;
  try {
    discoverQuery=queryBuilder.buildQuery(context,scopeObject,configuration,query,searchFilters,dsoType,page);
    searchResult=searchService.search(context,scopeObject,discoverQuery);
  }
 catch (  SearchServiceException e) {
    log.error("String_Node_Str",e);
  }
  SearchResultsRest searchResultsRest=discoverFacetsConverter.convert(context,query,dsoType,configurationName,dsoScope,searchFilters,page,configuration,searchResult);
  return searchResultsRest;
}
Program: 51843
Project: 51843
Buggy source:
public boolean supports(Class<?> authentication){
  return authentication.equals(DSpaceAuthentication.class);
}

Fixed version (ground truth):
@Override public boolean supports(Class<?> authentication){
  return DSpaceAuthentication.class.isAssignableFrom(authentication);
}
Program: 51844
Project: 51844
Buggy source:
private Authentication authenticateNewLogin(Authentication authentication){
  Context newContext=null;
  Authentication output=null;
  if (authentication != null && authentication.getCredentials() != null) {
    try {
      newContext=new Context();
      String name=authentication.getName();
      String password=authentication.getCredentials().toString();
      int implicitStatus=authenticationService.authenticateImplicit(newContext,null,null,null,request);
      if (implicitStatus == AuthenticationMethod.SUCCESS) {
        log.info(LogManager.getHeader(newContext,"String_Node_Str","String_Node_Str"));
        output=createAuthentication(password,newContext);
      }
 else {
        int authenticateResult=authenticationService.authenticate(newContext,name,password,null,request);
        if (AuthenticationMethod.SUCCESS == authenticateResult) {
          log.info(LogManager.getHeader(newContext,"String_Node_Str","String_Node_Str"));
          output=createAuthentication(password,newContext);
        }
 else {
          log.info(LogManager.getHeader(newContext,"String_Node_Str","String_Node_Str" + name + "String_Node_Str"+ authenticateResult));
          throw new BadCredentialsException("String_Node_Str");
        }
      }
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
    }
 finally {
      if (newContext != null && newContext.isValid()) {
        try {
          newContext.complete();
        }
 catch (        SQLException e) {
          log.error(e.getMessage() + "String_Node_Str",e);
        }
      }
    }
  }
  return output;
}

Fixed version (ground truth):
private Authentication authenticateNewLogin(Authentication authentication){
  Context newContext=null;
  Authentication output=null;
  if (authentication != null) {
    try {
      newContext=new Context();
      String name=authentication.getName();
      String password=Objects.toString(authentication.getCredentials(),null);
      int implicitStatus=authenticationService.authenticateImplicit(newContext,null,null,null,request);
      if (implicitStatus == AuthenticationMethod.SUCCESS) {
        log.info(LogManager.getHeader(newContext,"String_Node_Str","String_Node_Str"));
        output=createAuthentication(password,newContext);
      }
 else {
        int authenticateResult=authenticationService.authenticate(newContext,name,password,null,request);
        if (AuthenticationMethod.SUCCESS == authenticateResult) {
          log.info(LogManager.getHeader(newContext,"String_Node_Str","String_Node_Str"));
          output=createAuthentication(password,newContext);
        }
 else {
          log.info(LogManager.getHeader(newContext,"String_Node_Str","String_Node_Str" + name + "String_Node_Str"+ authenticateResult));
          throw new BadCredentialsException("String_Node_Str");
        }
      }
    }
  finally {
      if (newContext != null && newContext.isValid()) {
        try {
          newContext.complete();
        }
 catch (        SQLException e) {
          log.error(e.getMessage() + "String_Node_Str",e);
        }
      }
    }
  }
  return output;
}
Program: 51845
Project: 51845
Buggy source:
@RequestMapping(method=RequestMethod.GET) public RootResource listDefinedEndpoint(HttpServletRequest request){
  RootRest rootRest=rootRestRepository.getRoot();
  RootResource rootResource=new RootResource(rootRest);
  halLinkService.addLinks(rootResource);
  return rootResource;
}

Fixed version (ground truth):
@RequestMapping(method=RequestMethod.GET) public RootResource listDefinedEndpoint(HttpServletRequest request){
  String restUrl=getRestURL(request);
  RootRest rootRest=rootRestRepository.getRoot(restUrl);
  RootResource rootResource=new RootResource(rootRest);
  halLinkService.addLinks(rootResource);
  return rootResource;
}
Program: 51846
Project: 51846
Buggy source:
public RootRest convert(){
  RootRest rootRest=new RootRest();
  rootRest.setDspaceName(configurationService.getProperty("String_Node_Str"));
  rootRest.setDspaceURL(configurationService.getProperty("String_Node_Str"));
  return rootRest;
}

Fixed version (ground truth):
public RootRest convert(String restUrl){
  RootRest rootRest=new RootRest();
  rootRest.setDspaceName(configurationService.getProperty("String_Node_Str"));
  rootRest.setDspaceURL(configurationService.getProperty("String_Node_Str"));
  rootRest.setDspaceRest(restUrl);
  return rootRest;
}
Program: 51847
Project: 51847
Buggy source:
protected void addLinks(RootResource halResource,LinkedList<Link> list){
  for (  Link endpointLink : discoverableEndpointsService.getDiscoverableEndpoints()) {
    list.add(buildLink(endpointLink.getRel(),endpointLink.getRel()));
  }
}

Fixed version (ground truth):
protected void addLinks(RootResource halResource,LinkedList<Link> list){
  for (  Link endpointLink : discoverableEndpointsService.getDiscoverableEndpoints()) {
    list.add(buildLink(endpointLink.getRel(),halResource.getData().getDspaceRest() + endpointLink.getHref()));
  }
}
Program: 51848
Project: 51848
Buggy source:
@Override public int hashCode(){
  return new HashCodeBuilder(17,37).append(this.getCategory()).append(this.getType()).append(this.getController()).append(this.getDspaceURL()).append(this.getDspaceURL()).toHashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return new HashCodeBuilder(17,37).append(this.getCategory()).append(this.getType()).append(this.getController()).append(this.getDspaceName()).append(this.getDspaceURL()).append(this.getDspaceRest()).toHashCode();
}
Program: 51849
Project: 51849
Buggy source:
@Override public boolean equals(Object object){
  return (object instanceof RootRest && new EqualsBuilder().append(this.getCategory(),((RootRest)object).getCategory()).append(this.getType(),((RootRest)object).getType()).append(this.getController(),((RootRest)object).getController()).append(this.getDspaceURL(),((RootRest)object).getDspaceURL()).append(this.getDspaceName(),((RootRest)object).getDspaceName()).isEquals());
}

Fixed version (ground truth):
@Override public boolean equals(Object object){
  return (object instanceof RootRest && new EqualsBuilder().append(this.getCategory(),((RootRest)object).getCategory()).append(this.getType(),((RootRest)object).getType()).append(this.getController(),((RootRest)object).getController()).append(this.getDspaceURL(),((RootRest)object).getDspaceURL()).append(this.getDspaceName(),((RootRest)object).getDspaceName()).append(this.getDspaceRest(),((RootRest)object).getDspaceRest()).isEquals());
}
Program: 51850
Project: 51850
Buggy source:
public RootRest getRoot(){
  return rootConverter.convert();
}

Fixed version (ground truth):
public RootRest getRoot(String restUrl){
  return rootConverter.convert(restUrl);
}
Program: 51851
Project: 51851
Buggy source:
@RequestMapping(method=RequestMethod.GET) public RootResource listDefinedEndpoint(HttpServletRequest request){
  RootRest rootRest=rootRestRepository.getRoot();
  RootResource rootResource=new RootResource(rootRest);
  halLinkService.addLinks(rootResource);
  return rootResource;
}

Fixed version (ground truth):
@RequestMapping(method=RequestMethod.GET) public RootResource listDefinedEndpoint(HttpServletRequest request){
  String restUrl=getRestURL(request);
  RootRest rootRest=rootRestRepository.getRoot(restUrl);
  RootResource rootResource=new RootResource(rootRest);
  halLinkService.addLinks(rootResource);
  return rootResource;
}
Program: 51852
Project: 51852
Buggy source:
public RootRest convert(){
  RootRest rootRest=new RootRest();
  rootRest.setDspaceName(configurationService.getProperty("String_Node_Str"));
  rootRest.setDspaceURL(configurationService.getProperty("String_Node_Str"));
  return rootRest;
}

Fixed version (ground truth):
public RootRest convert(String restUrl){
  RootRest rootRest=new RootRest();
  rootRest.setDspaceName(configurationService.getProperty("String_Node_Str"));
  rootRest.setDspaceURL(configurationService.getProperty("String_Node_Str"));
  rootRest.setDspaceRest(restUrl);
  return rootRest;
}
Program: 51853
Project: 51853
Buggy source:
protected void addLinks(RootResource halResource,LinkedList<Link> list){
  for (  Link endpointLink : discoverableEndpointsService.getDiscoverableEndpoints()) {
    list.add(buildLink(endpointLink.getRel(),endpointLink.getRel()));
  }
}

Fixed version (ground truth):
protected void addLinks(RootResource halResource,LinkedList<Link> list){
  for (  Link endpointLink : discoverableEndpointsService.getDiscoverableEndpoints()) {
    list.add(buildLink(endpointLink.getRel(),halResource.getData().getDspaceRest() + endpointLink.getHref()));
  }
}
Program: 51854
Project: 51854
Buggy source:
@Override public int hashCode(){
  return new HashCodeBuilder(17,37).append(this.getCategory()).append(this.getType()).append(this.getController()).append(this.getDspaceURL()).append(this.getDspaceURL()).toHashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  return new HashCodeBuilder(17,37).append(this.getCategory()).append(this.getType()).append(this.getController()).append(this.getDspaceName()).append(this.getDspaceURL()).append(this.getDspaceRest()).toHashCode();
}
Program: 51855
Project: 51855
Buggy source:
@Override public boolean equals(Object object){
  return (object instanceof RootRest && new EqualsBuilder().append(this.getCategory(),((RootRest)object).getCategory()).append(this.getType(),((RootRest)object).getType()).append(this.getController(),((RootRest)object).getController()).append(this.getDspaceURL(),((RootRest)object).getDspaceURL()).append(this.getDspaceName(),((RootRest)object).getDspaceName()).isEquals());
}

Fixed version (ground truth):
@Override public boolean equals(Object object){
  return (object instanceof RootRest && new EqualsBuilder().append(this.getCategory(),((RootRest)object).getCategory()).append(this.getType(),((RootRest)object).getType()).append(this.getController(),((RootRest)object).getController()).append(this.getDspaceURL(),((RootRest)object).getDspaceURL()).append(this.getDspaceName(),((RootRest)object).getDspaceName()).append(this.getDspaceRest(),((RootRest)object).getDspaceRest()).isEquals());
}
Program: 51856
Project: 51856
Buggy source:
public RootRest getRoot(){
  return rootConverter.convert();
}

Fixed version (ground truth):
public RootRest getRoot(String restUrl){
  return rootConverter.convert(restUrl);
}
Program: 51857
Project: 51857
Buggy source:
@Test public void testReturnCorrectClass() throws Exception {
  assertEquals(rootConverter.convert().getClass(),RootRest.class);
}

Fixed version (ground truth):
@Test public void testReturnCorrectClass() throws Exception {
  assertEquals(rootConverter.convert("String_Node_Str").getClass(),RootRest.class);
}
Program: 51858
Project: 51858
Buggy source:
@Test public void testCorrectPropertiesSetFromConfigurationService() throws Exception {
  RootRest rootRest=rootConverter.convert();
  assertEquals("String_Node_Str",rootRest.getDspaceURL());
  assertEquals("String_Node_Str",rootRest.getDspaceName());
}

Fixed version (ground truth):
@Test public void testCorrectPropertiesSetFromConfigurationService() throws Exception {
  String restUrl="String_Node_Str";
  RootRest rootRest=rootConverter.convert(restUrl);
  assertEquals("String_Node_Str",rootRest.getDspaceURL());
  assertEquals("String_Node_Str",rootRest.getDspaceName());
  assertEquals(restUrl,rootRest.getDspaceRest());
}
Program: 51859
Project: 51859
Buggy source:
@Test public void testReturnNotNull() throws Exception {
  assertNotNull(rootConverter.convert());
}

Fixed version (ground truth):
@Test public void testReturnNotNull() throws Exception {
  assertNotNull(rootConverter.convert("String_Node_Str"));
}
Program: 51860
Project: 51860
Buggy source:
public void init(){
  if (submissionConfigReader == null) {
    try {
      submissionConfigReader=new SubmissionConfigReader();
    }
 catch (    ServletException e) {
      log.error(e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
public void init(){
  if (submissionConfigReader == null) {
    try {
      submissionConfigReader=new SubmissionConfigReader();
    }
 catch (    SubmissionConfigReaderException e) {
      log.error(e.getMessage(),e);
    }
  }
}
Program: 51861
Project: 51861
Buggy source:
@Override public SubmissionStepConfig toModel(SubmissionSectionRest obj){
  init();
  SubmissionStepConfig step;
  try {
    step=submissionConfigReader.getStepConfig(obj.getId());
  }
 catch (  ServletException e) {
    throw new RuntimeException(e);
  }
  return step;
}

Fixed version (ground truth):
@Override public SubmissionStepConfig toModel(SubmissionSectionRest obj){
  init();
  SubmissionStepConfig step;
  try {
    step=submissionConfigReader.getStepConfig(obj.getId());
  }
 catch (  SubmissionConfigReaderException e) {
    throw new RuntimeException(e);
  }
  return step;
}
Program: 51862
Project: 51862
Buggy source:
public WorkspaceItemConverter() throws ServletException {
  submissionConfigReader=new SubmissionConfigReader();
}

Fixed version (ground truth):
public WorkspaceItemConverter() throws SubmissionConfigReaderException {
  submissionConfigReader=new SubmissionConfigReader();
}
Program: 51863
Project: 51863
Buggy source:
public SubmissionUploadRestRepository() throws ServletException {
  submissionConfigReader=new SubmissionConfigReader();
}

Fixed version (ground truth):
public SubmissionUploadRestRepository() throws SubmissionConfigReaderException {
  submissionConfigReader=new SubmissionConfigReader();
}
Program: 51864
Project: 51864
Buggy source:
public WorkspaceItemRestRepository() throws ServletException {
  submissionConfigReader=new SubmissionConfigReader();
}

Fixed version (ground truth):
public WorkspaceItemRestRepository() throws SubmissionConfigReaderException {
  submissionConfigReader=new SubmissionConfigReader();
}
Program: 51865
Project: 51865
Buggy source:
private EPerson updateSessionSalt(final Context context,final Date previousLoginDate) throws SQLException {
  EPerson ePerson=null;
  try {
    ePerson=context.getCurrentUser();
    if (previousLoginDate == null || (ePerson.getLastActive().getTime() - previousLoginDate.getTime() > expirationTime)) {
      ePerson.setSessionSalt(generateRandomSalt());
      ePersonService.update(context,ePerson);
    }
  }
 catch (  AuthorizeException e) {
    return null;
  }
  return ePerson;
}

Fixed version (ground truth):
private EPerson updateSessionSalt(final Context context,final Date previousLoginDate) throws SQLException {
  EPerson ePerson=null;
  try {
    ePerson=context.getCurrentUser();
    if (StringUtils.isBlank(ePerson.getSessionSalt()) || previousLoginDate == null || (ePerson.getLastActive().getTime() - previousLoginDate.getTime() > expirationTime)) {
      ePerson.setSessionSalt(generateRandomSalt());
      ePersonService.update(context,ePerson);
    }
  }
 catch (  AuthorizeException e) {
    return null;
  }
  return ePerson;
}
Program: 51867
Project: 51867
Buggy source:
/** 
 * Consume the event
 * @param context The relevant DSpace Context.
 * @param event DSpace event
 * @throws Exception if error
 */
@Override public void consume(Context context,Event event) throws Exception {
  int st=event.getSubjectType();
  int et=event.getEventType();
  UUID id=event.getSubjectID();
switch (st) {
case Constants.ITEM:
    if (et == Event.DELETE) {
      HarvestedItem hi=harvestedItemService.find(context,(Item)event.getSubject(context));
      if (hi != null) {
        log.debug("String_Node_Str" + id + "String_Node_Str"+ hi.getOaiID()+ "String_Node_Str");
        harvestedItemService.delete(context,hi);
      }
 else {
        log.debug("String_Node_Str" + id + "String_Node_Str");
      }
    }
  break;
case Constants.COLLECTION:
if (et == Event.DELETE) {
  HarvestedCollection hc=harvestedCollectionService.find(context,(Collection)event.getSubject(context));
  if (hc != null) {
    log.debug("String_Node_Str" + id + "String_Node_Str"+ hc.getOaiSource()+ "String_Node_Str"+ hc.getOaiSetId()+ "String_Node_Str");
    harvestedCollectionService.delete(context,hc);
  }
 else {
    log.debug("String_Node_Str" + id + "String_Node_Str");
  }
}
default :
log.warn("String_Node_Str" + event.toString());
}
}

Fixed version (ground truth):
/** 
 * Consume the event
 * @param context The relevant DSpace Context.
 * @param event DSpace event
 * @throws Exception if error
 */
@Override public void consume(Context context,Event event) throws Exception {
  int st=event.getSubjectType();
  int et=event.getEventType();
  UUID id=event.getSubjectID();
switch (st) {
case Constants.ITEM:
    if (et == Event.DELETE) {
      HarvestedItem hi=harvestedItemService.find(context,(Item)event.getSubject(context));
      if (hi != null) {
        log.debug("String_Node_Str" + id + "String_Node_Str"+ hi.getOaiID()+ "String_Node_Str");
        harvestedItemService.delete(context,hi);
      }
 else {
        log.debug("String_Node_Str" + id + "String_Node_Str");
      }
    }
  break;
case Constants.COLLECTION:
if (et == Event.DELETE) {
  HarvestedCollection hc=harvestedCollectionService.find(context,(Collection)event.getSubject(context));
  if (hc != null) {
    log.debug("String_Node_Str" + id + "String_Node_Str"+ hc.getOaiSource()+ "String_Node_Str"+ hc.getOaiSetId()+ "String_Node_Str");
    harvestedCollectionService.delete(context,hc);
  }
 else {
    log.debug("String_Node_Str" + id + "String_Node_Str");
  }
}
break;
default :
log.warn("String_Node_Str" + event.toString());
}
}
Program: 51868
Project: 51868
Buggy source:
protected String makeIdentifierBasedOnHistory(Context context,DSpaceObject dso,VersionHistory history) throws AuthorizeException, SQLException, DOIIdentifierException {
  if (!(dso instanceof Item)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Item item=(Item)dso;
  Version version=versionHistoryService.getVersion(context,history,item);
  String previousVersionDOI=null;
  for (  Version v : versioningService.getVersionsByHistory(context,history)) {
    previousVersionDOI=getDOIByObject(context,v.getItem());
    if (null != previousVersionDOI) {
      break;
    }
  }
  if (previousVersionDOI == null) {
    DOI doi=doiService.create(context);
    String identifier=this.getPrefix() + "String_Node_Str" + this.getNamespaceSeparator()+ doi.getID().toString();
    if (version.getVersionNumber() > 1) {
      identifier.concat(String.valueOf(DOT).concat(String.valueOf(version.getVersionNumber())));
    }
    doi.setDoi(identifier);
    doi.setDSpaceObject(dso);
    doi.setStatus(null);
    doiService.update(context,doi);
    return doi.getDoi();
  }
  assert(previousVersionDOI != null);
  String identifier=getBareDOI(previousVersionDOI);
  if (version.getVersionNumber() > 1) {
    identifier=identifier.concat(String.valueOf(DOT)).concat(String.valueOf(versionHistoryService.getVersion(context,history,item).getVersionNumber()));
  }
  loadOrCreateDOI(context,dso,identifier);
  return identifier;
}

Fixed version (ground truth):
protected String makeIdentifierBasedOnHistory(Context context,DSpaceObject dso,VersionHistory history) throws AuthorizeException, SQLException, DOIIdentifierException {
  if (!(dso instanceof Item)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Item item=(Item)dso;
  Version version=versionHistoryService.getVersion(context,history,item);
  String previousVersionDOI=null;
  for (  Version v : versioningService.getVersionsByHistory(context,history)) {
    previousVersionDOI=getDOIByObject(context,v.getItem());
    if (null != previousVersionDOI) {
      break;
    }
  }
  if (previousVersionDOI == null) {
    DOI doi=doiService.create(context);
    String identifier=this.getPrefix() + "String_Node_Str" + this.getNamespaceSeparator()+ doi.getID().toString();
    if (version.getVersionNumber() > 1) {
      identifier=identifier.concat(String.valueOf(DOT).concat(String.valueOf(version.getVersionNumber())));
    }
    doi.setDoi(identifier);
    doi.setDSpaceObject(dso);
    doi.setStatus(null);
    doiService.update(context,doi);
    return doi.getDoi();
  }
  assert(previousVersionDOI != null);
  String identifier=getBareDOI(previousVersionDOI);
  if (version.getVersionNumber() > 1) {
    identifier=identifier.concat(String.valueOf(DOT)).concat(String.valueOf(versionHistoryService.getVersion(context,history,item).getVersionNumber()));
  }
  loadOrCreateDOI(context,dso,identifier);
  return identifier;
}
Program: 51869
Project: 51869
Buggy source:
@Override public void consume(Context ctx,Event event) throws SQLException {
  if (this.toConvert == null) {
    this.toConvert=new LinkedList<>();
  }
  if (this.toDelete == null) {
    this.toDelete=new LinkedList<>();
  }
  int sType=event.getSubjectType();
  log.debug(event.getEventTypeAsString() + "String_Node_Str" + event.getSubjectTypeAsString()+ "String_Node_Str"+ event.getSubjectID());
switch (sType) {
case (Constants.BITSTREAM):
{
      this.consumeBitstream(ctx,event);
    }
case (Constants.BUNDLE):
{
    this.consumeBundles(ctx,event);
    return;
  }
case (Constants.ITEM):
{
  this.consumeCommunityCollectionItem(ctx,event);
  return;
}
case (Constants.COLLECTION):
{
this.consumeCommunityCollectionItem(ctx,event);
return;
}
case (Constants.COMMUNITY):
{
this.consumeCommunityCollectionItem(ctx,event);
return;
}
case (Constants.SITE):
{
this.consumeSite(ctx,event);
return;
}
default :
{
log.warn("String_Node_Str" + "String_Node_Str" + event.toString());
}
}
}

Fixed version (ground truth):
@Override public void consume(Context ctx,Event event) throws SQLException {
  if (this.toConvert == null) {
    this.toConvert=new LinkedList<>();
  }
  if (this.toDelete == null) {
    this.toDelete=new LinkedList<>();
  }
  int sType=event.getSubjectType();
  log.debug(event.getEventTypeAsString() + "String_Node_Str" + event.getSubjectTypeAsString()+ "String_Node_Str"+ event.getSubjectID());
switch (sType) {
case (Constants.BITSTREAM):
{
      this.consumeBitstream(ctx,event);
      return;
    }
case (Constants.BUNDLE):
{
    this.consumeBundles(ctx,event);
    return;
  }
case (Constants.ITEM):
{
  this.consumeCommunityCollectionItem(ctx,event);
  return;
}
case (Constants.COLLECTION):
{
this.consumeCommunityCollectionItem(ctx,event);
return;
}
case (Constants.COMMUNITY):
{
this.consumeCommunityCollectionItem(ctx,event);
return;
}
case (Constants.SITE):
{
this.consumeSite(ctx,event);
return;
}
default :
{
log.warn("String_Node_Str" + "String_Node_Str" + event.toString());
}
}
}
Program: 51870
Project: 51870
Buggy source:
/** 
 * A generic method to test that variable replacement is happening properly.
 */
public void testVariableReplacement(){
  Map<String,Object> l=new HashMap<String,Object>();
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  configurationService.loadConfiguration(l);
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  l=null;
}

Fixed version (ground truth):
/** 
 * A generic method to test that variable replacement is happening properly.
 */
@Test public void testVariableReplacement(){
  Map<String,Object> l=new HashMap<String,Object>();
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  l.put("String_Node_Str","String_Node_Str");
  configurationService.loadConfiguration(l);
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  assertEquals("String_Node_Str",configurationService.getProperty("String_Node_Str"));
  l=null;
}
Program: 51872
Project: 51872
Buggy source:
@Override public int compare(DSpaceObject dso1,DSpaceObject dso2){
  if (dso1 == dso2) {
    return 0;
  }
 else   if (dso1 == null) {
    return -1;
  }
 else   if (dso2 == null) {
    return 1;
  }
 else {
    String name1=StringUtils.trimToEmpty(dso1.getName());
    String name2=StringUtils.trimToEmpty(dso2.getName());
    return name1.compareToIgnoreCase(name2);
  }
}

Fixed version (ground truth):
@Override public int compare(DSpaceObject dso1,DSpaceObject dso2){
  if (dso1 == dso2) {
    return 0;
  }
 else   if (dso1 == null) {
    return -1;
  }
 else   if (dso2 == null) {
    return 1;
  }
 else {
    String name1=StringUtils.trimToEmpty(dso1.getName());
    String name2=StringUtils.trimToEmpty(dso2.getName());
    if (name1.equals(name2)) {
      return ObjectUtils.compare(dso1.getID(),dso2.getID());
    }
 else {
      return name1.compareToIgnoreCase(name2);
    }
  }
}
Program: 51873
Project: 51873
Buggy source:
@Override public void addClaimedUser(Context context,XmlWorkflowItem wfi,Step step,EPerson user) throws SQLException, AuthorizeException, IOException {
  PoolTask task=poolTaskService.findByWorkflowIdAndEPerson(context,wfi,user);
  if (task != null && task.getEperson() != null) {
    xmlWorkflowService.deletePooledTask(context,wfi,task);
  }
  InProgressUser ipu=inProgressUserService.create(context);
  ipu.setWorkflowItem(wfi);
  ipu.setUser(user);
  ipu.setFinished(false);
  inProgressUserService.update(context,ipu);
  int totalUsers=inProgressUserService.getNumberOfInProgressUsers(context,wfi) + inProgressUserService.getNumberOfFinishedUsers(context,wfi);
  if (totalUsers == step.getRequiredUsers()) {
    xmlWorkflowService.deleteAllPooledTasks(context,wfi);
  }
  xmlWorkflowItemService.update(context,wfi);
}

Fixed version (ground truth):
@Override public void addClaimedUser(Context context,XmlWorkflowItem wfi,Step step,EPerson user) throws SQLException, AuthorizeException, IOException {
  PoolTask task=poolTaskService.findByWorkflowIdAndEPerson(context,wfi,user);
  if (task != null && task.getEperson() != null) {
    xmlWorkflowService.deletePooledTask(context,wfi,task);
  }
  InProgressUser ipu=inProgressUserService.create(context);
  ipu.setWorkflowItem(wfi);
  ipu.setUser(user);
  ipu.setFinished(false);
  inProgressUserService.update(context,ipu);
  xmlWorkflowService.grantUserAllItemPolicies(context,wfi.getItem(),user);
  int totalUsers=inProgressUserService.getNumberOfInProgressUsers(context,wfi) + inProgressUserService.getNumberOfFinishedUsers(context,wfi);
  if (totalUsers == step.getRequiredUsers()) {
    xmlWorkflowService.deleteAllPooledTasks(context,wfi);
  }
  xmlWorkflowItemService.update(context,wfi);
}