Program: 35314
Project: 35314
Buggy source:
protected SearchCacheEntry getSearchCacheEntry(SearchRequest searchRequest){
  SearchCacheEntry searchCacheEntry;
  if (searchRequest.getOffset().orElse(0) == 0 || !searchRequestCache.containsKey(searchRequest.hashCode())) {
    SearchEntity searchEntity=new SearchEntity();
    searchEntity.setSource(searchRequest.getSource());
    searchEntity.setCategoryName(searchRequest.getCategory().getName());
    searchEntity.setQuery(searchRequest.getQuery().orElse(null));
    searchEntity.setIdentifiers(searchRequest.getIdentifiers().entrySet().stream().map(x -> new IdentifierKeyValuePair(x.getKey().name(),x.getValue())).collect(Collectors.toSet()));
    searchEntity.setSeason(searchRequest.getSeason().orElse(null));
    searchEntity.setEpisode(searchRequest.getEpisode().orElse(null));
    searchEntity.setSearchType(searchRequest.getSearchType());
    searchEntity.setUsernameOrIp(searchRequest.getInternalData().getUsernameOrIp());
    searchEntity.setUserAgent(searchRequest.getInternalData().getUserAgent());
    searchEntity.setTitle(searchRequest.getTitle().orElse(null));
    searchEntity.setAuthor(searchRequest.getAuthor().orElse(null));
    searchRequest.extractExcludedWordsFromQuery();
    searchRepository.save(searchEntity);
    IndexerForSearchSelection pickingResult=indexerPicker.pickIndexers(searchRequest);
    searchCacheEntry=new SearchCacheEntry(searchRequest,pickingResult,searchEntity);
  }
 else {
    searchCacheEntry=searchRequestCache.get(searchRequest.hashCode());
    searchCacheEntry.setLastAccessed(Instant.now());
    searchCacheEntry.setSearchRequest(searchRequest);
  }
  return searchCacheEntry;
}

Fixed version (ground truth):
protected SearchCacheEntry getSearchCacheEntry(SearchRequest searchRequest){
  SearchCacheEntry searchCacheEntry;
  if (searchRequest.getOffset().orElse(0) == 0 || !searchRequestCache.containsKey(searchRequest.hashCode())) {
    SearchEntity searchEntity=new SearchEntity();
    searchEntity.setSource(searchRequest.getSource());
    searchEntity.setCategoryName(searchRequest.getCategory().getName());
    searchEntity.setQuery(searchRequest.getQuery().orElse(null));
    searchEntity.setIdentifiers(searchRequest.getIdentifiers().entrySet().stream().map(x -> new IdentifierKeyValuePair(x.getKey().name(),x.getValue())).collect(Collectors.toSet()));
    searchEntity.setSeason(searchRequest.getSeason().orElse(null));
    searchEntity.setEpisode(searchRequest.getEpisode().orElse(null));
    searchEntity.setSearchType(searchRequest.getSearchType());
    searchEntity.setUsernameOrIp(searchRequest.getInternalData().getUsernameOrIp());
    searchEntity.setUserAgent(searchRequest.getInternalData().getUserAgent());
    searchEntity.setTitle(searchRequest.getTitle().orElse(null));
    searchEntity.setAuthor(searchRequest.getAuthor().orElse(null));
    searchRequest.extractForbiddenWords();
    searchRepository.save(searchEntity);
    IndexerForSearchSelection pickingResult=indexerPicker.pickIndexers(searchRequest);
    searchCacheEntry=new SearchCacheEntry(searchRequest,pickingResult,searchEntity);
  }
 else {
    searchCacheEntry=searchRequestCache.get(searchRequest.hashCode());
    searchCacheEntry.setLastAccessed(Instant.now());
    searchCacheEntry.setSearchRequest(searchRequest);
  }
  return searchCacheEntry;
}