Program: 164562
Project: 164562
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public String showEvent(@PathVariable("String_Node_Str") String eventName,Model model,HttpServletRequest request,Locale locale){
  Optional<Event> maybeEvent=eventRepository.findOptionalByShortName(eventName);
  if (!maybeEvent.isPresent()) {
    return REDIRECT + "String_Node_Str";
  }
  Event event=maybeEvent.get();
  Optional<String> maybeSpecialCode=SessionUtil.retrieveSpecialPriceCode(request);
  Optional<SpecialPrice> specialCode=maybeSpecialCode.flatMap((trimmedCode) -> optionally(() -> specialPriceRepository.getByCode(trimmedCode)));
  Optional<PromoCodeDiscount> promoCodeDiscount=SessionUtil.retrievePromotionCodeDiscount(request).flatMap((code) -> optionally(() -> promoCodeRepository.findPromoCodeInEvent(event.getId(),code)));
  final ZonedDateTime now=ZonedDateTime.now(event.getZoneId());
  final int maxTickets=configurationManager.getIntConfigValue(Configuration.maxAmountOfTicketsByReservation(event),5);
  List<SaleableTicketCategory> ticketCategories=ticketCategoryRepository.findAllTicketCategories(event.getId()).stream().filter((c) -> !c.isAccessRestricted() || (specialCode.isPresent() && specialCode.get().getTicketCategoryId() == c.getId())).map((m) -> new SaleableTicketCategory(m,ticketCategoryDescriptionRepository.findByTicketCategoryIdAndLocale(m.getId(),locale.getLanguage()).orElse("String_Node_Str"),now,event,ticketReservationManager.countAvailableTickets(event,m),maxTickets,promoCodeDiscount)).collect(Collectors.toList());
  LocationDescriptor ld=LocationDescriptor.fromGeoData(event.getLatLong(),TimeZone.getTimeZone(event.getTimeZone()),configurationManager.getStringConfigValue(Configuration.mapsClientApiKey()));
  final boolean hasAccessPromotions=ticketCategoryRepository.countAccessRestrictedRepositoryByEventId(event.getId()) > 0 || promoCodeRepository.countByEventId(event.getId()) > 0;
  String eventDescription=eventDescriptionRepository.findDescriptionByEventIdTypeAndLocale(event.getId(),EventDescription.EventDescriptionType.DESCRIPTION,locale.getLanguage()).orElse("String_Node_Str");
  final EventDescriptor eventDescriptor=new EventDescriptor(event,eventDescription);
  List<SaleableTicketCategory> expiredCategories=ticketCategories.stream().filter(SaleableTicketCategory::getExpired).collect(Collectors.toList());
  List<SaleableTicketCategory> validCategories=ticketCategories.stream().filter(tc -> !tc.getExpired()).collect(Collectors.toList());
  model.addAttribute("String_Node_Str",eventDescriptor).addAttribute("String_Node_Str",organizationRepository.getById(event.getOrganizationId())).addAttribute("String_Node_Str",validCategories).addAttribute("String_Node_Str",expiredCategories).addAttribute("String_Node_Str",!expiredCategories.isEmpty()).addAttribute("String_Node_Str",validCategories.isEmpty()).addAttribute("String_Node_Str",hasAccessPromotions).addAttribute("String_Node_Str",specialCode.map(SpecialPrice::getCode).orElse(null)).addAttribute("String_Node_Str",ld).addAttribute("String_Node_Str","String_Node_Str").addAttribute("String_Node_Str",promoCodeDiscount.isPresent()).addAttribute("String_Node_Str",promoCodeDiscount.orElse(null)).addAttribute("String_Node_Str",EventUtil.displayWaitingQueueForm(event,ticketCategories,configurationManager)).addAttribute("String_Node_Str",EventUtil.isPreSales(event,ticketCategories)).addAttribute("String_Node_Str",locale.getLanguage()).addAttribute("String_Node_Str",ticketCategories.stream().noneMatch(SaleableTicketCategory::getSaleable));
  model.asMap().putIfAbsent("String_Node_Str",false);
  return "String_Node_Str";
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET) public String showEvent(@PathVariable("String_Node_Str") String eventName,Model model,HttpServletRequest request,Locale locale){
  Optional<Event> maybeEvent=eventRepository.findOptionalByShortName(eventName);
  if (!maybeEvent.isPresent()) {
    return REDIRECT + "String_Node_Str";
  }
  Event event=maybeEvent.get();
  Optional<String> maybeSpecialCode=SessionUtil.retrieveSpecialPriceCode(request);
  Optional<SpecialPrice> specialCode=maybeSpecialCode.flatMap((trimmedCode) -> optionally(() -> specialPriceRepository.getByCode(trimmedCode)));
  Optional<PromoCodeDiscount> promoCodeDiscount=SessionUtil.retrievePromotionCodeDiscount(request).flatMap((code) -> optionally(() -> promoCodeRepository.findPromoCodeInEvent(event.getId(),code)));
  final ZonedDateTime now=ZonedDateTime.now(event.getZoneId());
  final int maxTickets=configurationManager.getIntConfigValue(Configuration.maxAmountOfTicketsByReservation(event),5);
  List<SaleableTicketCategory> ticketCategories=ticketCategoryRepository.findAllTicketCategories(event.getId()).stream().filter((c) -> !c.isAccessRestricted() || (specialCode.isPresent() && specialCode.get().getTicketCategoryId() == c.getId())).map((m) -> new SaleableTicketCategory(m,ticketCategoryDescriptionRepository.findByTicketCategoryIdAndLocale(m.getId(),locale.getLanguage()).orElse("String_Node_Str"),now,event,ticketReservationManager.countAvailableTickets(event,m),maxTickets,promoCodeDiscount)).collect(Collectors.toList());
  LocationDescriptor ld=LocationDescriptor.fromGeoData(event.getLatLong(),TimeZone.getTimeZone(event.getTimeZone()),configurationManager.getStringConfigValue(Configuration.mapsClientApiKey()));
  final boolean hasAccessPromotions=ticketCategoryRepository.countAccessRestrictedRepositoryByEventId(event.getId()) > 0 || promoCodeRepository.countByEventId(event.getId()) > 0;
  String eventDescription=eventDescriptionRepository.findDescriptionByEventIdTypeAndLocale(event.getId(),EventDescription.EventDescriptionType.DESCRIPTION,locale.getLanguage()).orElse("String_Node_Str");
  final EventDescriptor eventDescriptor=new EventDescriptor(event,eventDescription);
  List<SaleableTicketCategory> expiredCategories=ticketCategories.stream().filter(SaleableTicketCategory::getExpired).collect(Collectors.toList());
  List<SaleableTicketCategory> validCategories=ticketCategories.stream().filter(tc -> !tc.getExpired()).collect(Collectors.toList());
  model.addAttribute("String_Node_Str",eventDescriptor).addAttribute("String_Node_Str",organizationRepository.getById(event.getOrganizationId())).addAttribute("String_Node_Str",validCategories).addAttribute("String_Node_Str",expiredCategories).addAttribute("String_Node_Str",!expiredCategories.isEmpty()).addAttribute("String_Node_Str",validCategories.isEmpty()).addAttribute("String_Node_Str",hasAccessPromotions).addAttribute("String_Node_Str",specialCode.map(SpecialPrice::getCode).orElse(null)).addAttribute("String_Node_Str",ld).addAttribute("String_Node_Str","String_Node_Str").addAttribute("String_Node_Str",promoCodeDiscount.isPresent()).addAttribute("String_Node_Str",promoCodeDiscount.orElse(null)).addAttribute("String_Node_Str",EventUtil.displayWaitingQueueForm(event,ticketCategories,configurationManager,eventStatisticsManager.noSeatsAvailable())).addAttribute("String_Node_Str",EventUtil.isPreSales(event,ticketCategories)).addAttribute("String_Node_Str",locale.getLanguage()).addAttribute("String_Node_Str",ticketCategories.stream().noneMatch(SaleableTicketCategory::getSaleable));
  model.asMap().putIfAbsent("String_Node_Str",false);
  return "String_Node_Str";
}