Program: 5233
Project: 5233
Buggy source:
private MetadataSearchResponse search(Set<MetadataScope> scopes,String namespaceId,String searchQuery,Set<EntityTypeSimpleName> types,SortInfo sortInfo,int offset,int limit,int numCursors,String cursor,boolean showHidden,Set<EntityScope> entityScope) throws BadRequestException {
  if (offset < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (limit < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<MetadataEntry> results=new LinkedList<>();
  List<String> cursors=new LinkedList<>();
  List<MetadataEntry> allResults=new LinkedList<>();
  for (  MetadataScope scope : scopes) {
    SearchResults searchResults=getSearchResults(scope,namespaceId,searchQuery,types,sortInfo,offset,limit,numCursors,cursor,showHidden,entityScope);
    results.addAll(searchResults.getResults());
    cursors.addAll(searchResults.getCursors());
    allResults.addAll(searchResults.getAllResults());
  }
  Set<NamespacedEntityId> sortedEntities=getSortedEntities(results,sortInfo);
  int total=getSortedEntities(allResults,sortInfo).size();
  if (SortInfo.DEFAULT.equals(sortInfo)) {
    int startIndex=Math.min(offset,sortedEntities.size());
    int endIndex=(int)Math.min(Integer.MAX_VALUE,(long)offset + limit);
    endIndex=Math.min(endIndex,sortedEntities.size());
    sortedEntities=new LinkedHashSet<>(ImmutableList.copyOf(sortedEntities).subList(startIndex,endIndex));
  }
  Map<NamespacedEntityId,Metadata> systemMetadata=fetchMetadata(sortedEntities,MetadataScope.SYSTEM);
  Map<NamespacedEntityId,Metadata> userMetadata=fetchMetadata(sortedEntities,MetadataScope.USER);
  return new MetadataSearchResponse(sortInfo.getSortBy() + "String_Node_Str" + sortInfo.getSortOrder(),offset,limit,numCursors,total,addMetadataToEntities(sortedEntities,systemMetadata,userMetadata),cursors,showHidden,entityScope);
}

Fixed version (ground truth):
private MetadataSearchResponse search(Set<MetadataScope> scopes,String namespaceId,String searchQuery,Set<EntityTypeSimpleName> types,SortInfo sortInfo,int offset,int limit,int numCursors,String cursor,boolean showHidden,Set<EntityScope> entityScope) throws BadRequestException {
  if (offset < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (limit < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<MetadataEntry> resultsFromOffset=new LinkedList<>();
  List<String> cursors=new LinkedList<>();
  List<MetadataEntry> resultsFromBeginning=new LinkedList<>();
  for (  MetadataScope scope : scopes) {
    SearchResults searchResults=getSearchResults(scope,namespaceId,searchQuery,types,sortInfo,offset,limit,numCursors,cursor,showHidden,entityScope);
    resultsFromOffset.addAll(searchResults.getResultsFromOffset());
    cursors.addAll(searchResults.getCursors());
    resultsFromBeginning.addAll(searchResults.getResultsFromBeginning());
  }
  Set<NamespacedEntityId> sortedEntities=getSortedEntities(resultsFromOffset,sortInfo);
  int total=getSortedEntities(resultsFromBeginning,sortInfo).size();
  if (SortInfo.DEFAULT.equals(sortInfo)) {
    int startIndex=Math.min(offset,sortedEntities.size());
    int endIndex=(int)Math.min(Integer.MAX_VALUE,(long)offset + limit);
    endIndex=Math.min(endIndex,sortedEntities.size());
    sortedEntities=new LinkedHashSet<>(ImmutableList.copyOf(sortedEntities).subList(startIndex,endIndex));
  }
  Map<NamespacedEntityId,Metadata> systemMetadata=fetchMetadata(sortedEntities,MetadataScope.SYSTEM);
  Map<NamespacedEntityId,Metadata> userMetadata=fetchMetadata(sortedEntities,MetadataScope.USER);
  return new MetadataSearchResponse(sortInfo.getSortBy() + "String_Node_Str" + sortInfo.getSortOrder(),offset,limit,numCursors,total,addMetadataToEntities(sortedEntities,systemMetadata,userMetadata),cursors,showHidden,entityScope);
}