nus-yam/ex-repair huggingface dataset:
Program: 164578
Project: 164578
Buggy source:
public void sendTicketByEmail(Ticket ticket,Event event,Locale locale,TextTemplateBuilder textBuilder,PDFTemplateBuilder ticketBuilder) throws DocumentException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ticketBuilder.build().createPDF(baos);
  Mailer.Attachment attachment=new Mailer.Attachment("String_Node_Str" + ticket.getUuid() + "String_Node_Str",new ByteArrayResource(baos.toByteArray()),"String_Node_Str");
  mailer.send(ticket.getEmail(),messageSource.getMessage("String_Node_Str",new Object[]{event.getShortName()},locale),textBuilder.build(),Optional.empty(),attachment);
}

Fixed version (ground truth):
public void sendTicketByEmail(Ticket ticket,Event event,Locale locale,PartialTicketTextGenerator textBuilder,PartialTicketPDFGenerator ticketBuilder) throws DocumentException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  ticketBuilder.generate(ticket).createPDF(baos);
  Mailer.Attachment attachment=new Mailer.Attachment("String_Node_Str" + ticket.getUuid() + "String_Node_Str",new ByteArrayResource(baos.toByteArray()),"String_Node_Str");
  mailer.send(ticket.getEmail(),messageSource.getMessage("String_Node_Str",new Object[]{event.getShortName()},locale),textBuilder.generate(ticket),Optional.empty(),attachment);
}
Program: 164579
Project: 164579
Buggy source:
public void sendSimpleEmail(String recipient,String subject,TextTemplateBuilder textBuilder){
  mailer.send(recipient,subject,textBuilder.build(),Optional.empty());
}

Fixed version (ground truth):
public void sendSimpleEmail(String recipient,String subject,String text){
  mailer.send(recipient,subject,text,Optional.empty());
}
Program: 164580
Project: 164580
Buggy source:
public void updateTicketOwner(Ticket ticket,Locale locale,Event event,UpdateTicketOwnerForm updateTicketOwner,TextTemplateBuilder confirmationTextBuilder,TextTemplateBuilder ownerChangeTextBuilder,PDFTemplateBuilder pdfTemplateBuilder){
  String newEmail=updateTicketOwner.getEmail().trim();
  String newFullName=updateTicketOwner.getFullName().trim();
  ticketRepository.updateTicketOwner(ticket.getUuid(),newEmail,newFullName);
  ticketRepository.updateOptionalTicketInfo(ticket.getUuid(),updateTicketOwner.getJobTitle(),updateTicketOwner.getCompany(),updateTicketOwner.getPhoneNumber(),updateTicketOwner.getAddress(),updateTicketOwner.getCountry(),updateTicketOwner.getTShirtSize(),updateTicketOwner.getNotes(),locale.getLanguage());
  if (!StringUtils.equalsIgnoreCase(newEmail,ticket.getEmail()) || !StringUtils.equalsIgnoreCase(newFullName,ticket.getFullName())) {
    sendTicketByEmail(ticketRepository.findByUUID(ticket.getUuid()),locale,event,confirmationTextBuilder,pdfTemplateBuilder);
  }
  if (StringUtils.isNotBlank(ticket.getEmail()) && !StringUtils.equalsIgnoreCase(newEmail,ticket.getEmail())) {
    String subject=messageSource.getMessage("String_Node_Str",new Object[]{event.getShortName()},locale);
    notificationManager.sendSimpleEmail(ticket.getEmail(),subject,ownerChangeTextBuilder);
  }
}

Fixed version (ground truth):
public void updateTicketOwner(Ticket ticket,Locale locale,Event event,UpdateTicketOwnerForm updateTicketOwner,PartialTicketTextGenerator confirmationTextBuilder,PartialTicketTextGenerator ownerChangeTextBuilder,PartialTicketPDFGenerator pdfTemplateGenerator){
  String newEmail=updateTicketOwner.getEmail().trim();
  String newFullName=updateTicketOwner.getFullName().trim();
  ticketRepository.updateTicketOwner(ticket.getUuid(),newEmail,newFullName);
  ticketRepository.updateOptionalTicketInfo(ticket.getUuid(),updateTicketOwner.getJobTitle(),updateTicketOwner.getCompany(),updateTicketOwner.getPhoneNumber(),updateTicketOwner.getAddress(),updateTicketOwner.getCountry(),updateTicketOwner.getTShirtSize(),updateTicketOwner.getNotes(),locale.getLanguage());
  Ticket newTicket=ticketRepository.findByUUID(ticket.getUuid());
  if (!StringUtils.equalsIgnoreCase(newEmail,ticket.getEmail()) || !StringUtils.equalsIgnoreCase(newFullName,ticket.getFullName())) {
    sendTicketByEmail(newTicket,locale,event,confirmationTextBuilder,pdfTemplateGenerator);
  }
  if (StringUtils.isNotBlank(ticket.getEmail()) && !StringUtils.equalsIgnoreCase(newEmail,ticket.getEmail())) {
    String subject=messageSource.getMessage("String_Node_Str",new Object[]{event.getShortName()},locale);
    notificationManager.sendSimpleEmail(ticket.getEmail(),subject,ownerChangeTextBuilder.generate(newTicket));
  }
}
Program: 164581
Project: 164581
Buggy source:
private void sendTicketByEmail(Ticket ticket,Locale locale,Event event,TextTemplateBuilder confirmationTextBuilder,PDFTemplateBuilder pdfTemplateBuilder){
  try {
    notificationManager.sendTicketByEmail(ticket,event,locale,confirmationTextBuilder,pdfTemplateBuilder);
  }
 catch (  DocumentException e) {
    throw new IllegalStateException(e);
  }
}

Fixed version (ground truth):
private void sendTicketByEmail(Ticket ticket,Locale locale,Event event,PartialTicketTextGenerator confirmationTextBuilder,PartialTicketPDFGenerator pdfTemplateGenerator){
  try {
    notificationManager.sendTicketByEmail(ticket,event,locale,confirmationTextBuilder,pdfTemplateGenerator);
  }
 catch (  DocumentException e) {
    throw new IllegalStateException(e);
  }
}
Program: 164582
Project: 164582
Buggy source:
public boolean hasBeenSold(){
  return status == TicketStatus.ACQUIRED || status == TicketStatus.CANCELLED || status == TicketStatus.CHECKED_IN;
}

Fixed version (ground truth):
public boolean hasBeenSold(){
  return SOLD_STATUSES.contains(status);
}
Program: 164583
Project: 164583
Buggy source:
public void updateEventPrices(int eventId,EventModification em,String username){
  final Event original=eventRepository.findById(eventId);
  checkOwnership(original,username,em.getOrganizationId());
  if (original.getAvailableSeats() > em.getAvailableSeats()) {
    final EventWithStatistics eventWithStatistics=fillWithStatistics(original);
    int allocatedSeats=eventWithStatistics.getTicketCategories().stream().mapToInt(TicketCategoryWithStatistic::getMaxTickets).sum();
    if (em.getAvailableSeats() < allocatedSeats) {
      throw new IllegalArgumentException(format("String_Node_Str",em.getAvailableSeats(),allocatedSeats));
    }
  }
  String paymentProxies=collectPaymentProxies(em);
  int actualPrice=evaluatePrice(em.getPriceInCents(),em.getVat(),em.isVatIncluded(),em.isFreeOfCharge());
  BigDecimal vat=em.isFreeOfCharge() ? BigDecimal.ZERO : em.getVat();
  eventRepository.updatePrices(actualPrice,em.getCurrency(),em.getAvailableSeats(),em.isVatIncluded(),vat,paymentProxies);
}

Fixed version (ground truth):
public void updateEventPrices(int eventId,EventModification em,String username){
  final Event original=eventRepository.findById(eventId);
  checkOwnership(original,username,em.getOrganizationId());
  if (original.getAvailableSeats() > em.getAvailableSeats()) {
    final EventWithStatistics eventWithStatistics=fillWithStatistics(original);
    int allocatedSeats=eventWithStatistics.getTicketCategories().stream().mapToInt(TicketCategoryWithStatistic::getMaxTickets).sum();
    if (em.getAvailableSeats() < allocatedSeats) {
      throw new IllegalArgumentException(format("String_Node_Str",em.getAvailableSeats(),allocatedSeats));
    }
  }
  String paymentProxies=collectPaymentProxies(em);
  int actualPrice=evaluatePrice(em.getPriceInCents(),em.getVat(),em.isVatIncluded(),em.isFreeOfCharge());
  BigDecimal vat=em.isFreeOfCharge() ? BigDecimal.ZERO : em.getVat();
  eventRepository.updatePrices(actualPrice,em.getCurrency(),em.getAvailableSeats(),em.isVatIncluded(),vat,paymentProxies,eventId);
}
Program: 164584
Project: 164584
Buggy source:
@Query("String_Node_Str") int updatePrices(@Bind("String_Node_Str") int regular_price,@Bind("String_Node_Str") String currency,@Bind("String_Node_Str") int available_seats,@Bind("String_Node_Str") boolean vat_included,@Bind("String_Node_Str") BigDecimal vat,@Bind("String_Node_Str") String allowedPaymentProxies);

Fixed version (ground truth):
@Query("String_Node_Str") int updatePrices(@Bind("String_Node_Str") int regular_price,@Bind("String_Node_Str") String currency,@Bind("String_Node_Str") int available_seats,@Bind("String_Node_Str") boolean vat_included,@Bind("String_Node_Str") BigDecimal vat,@Bind("String_Node_Str") String allowedPaymentProxies,@Bind("String_Node_Str") int eventId);
Program: 164585
Project: 164585
Buggy source:
public static ValidationResult validateEventPrices(EventModification ev,Errors errors){
  if (!ev.isFreeOfCharge()) {
    if (isCollectionEmpty(ev.getAllowedPaymentProxies())) {
      errors.reject("String_Node_Str","String_Node_Str");
    }
    if (ev.getRegularPrice() == null || BigDecimal.ZERO.compareTo(ev.getRegularPrice()) <= 0) {
      errors.reject("String_Node_Str","String_Node_Str");
    }
    if (ev.getVat() == null || BigDecimal.ZERO.compareTo(ev.getRegularPrice()) < 0) {
      errors.reject("String_Node_Str","String_Node_Str");
    }
    ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  }
  if (ev.getAvailableSeats() < 1) {
    errors.reject("String_Node_Str","String_Node_Str");
  }
  return evaluateValidationResult(errors);
}

Fixed version (ground truth):
public static ValidationResult validateEventPrices(EventModification ev,Errors errors){
  if (!ev.isFreeOfCharge()) {
    if (isCollectionEmpty(ev.getAllowedPaymentProxies())) {
      errors.rejectValue("String_Node_Str","String_Node_Str");
    }
    if (ev.getRegularPrice() == null || BigDecimal.ZERO.compareTo(ev.getRegularPrice()) <= 0) {
      errors.rejectValue("String_Node_Str","String_Node_Str");
    }
    if (ev.getVat() == null || BigDecimal.ZERO.compareTo(ev.getRegularPrice()) < 0) {
      errors.rejectValue("String_Node_Str","String_Node_Str");
    }
    ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  }
  if (ev.getAvailableSeats() < 1) {
    errors.rejectValue("String_Node_Str","String_Node_Str");
  }
  return evaluateValidationResult(errors);
}
Program: 164586
Project: 164586
Buggy source:
public static ValidationResult validateTicketAssignment(UpdateTicketOwnerForm form,Errors errors){
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  String email=form.getEmail();
  if (StringUtils.isNotEmpty(email) && !SIMPLE_E_MAIL_PATTERN.matcher(email).matches()) {
    errors.reject("String_Node_Str","String_Node_Str");
  }
  if (StringUtils.isBlank(form.getFullName()) || StringUtils.length(form.getFullName()) > 255) {
    errors.reject("String_Node_Str","String_Node_Str");
  }
  if (StringUtils.isNotBlank(form.getNotes()) && StringUtils.length(form.getNotes()) > 1024) {
    errors.reject("String_Node_Str","String_Node_Str");
  }
  return evaluateValidationResult(errors);
}

Fixed version (ground truth):
public static ValidationResult validateTicketAssignment(UpdateTicketOwnerForm form,Errors errors){
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  String email=form.getEmail();
  if (StringUtils.isNotEmpty(email) && !SIMPLE_E_MAIL_PATTERN.matcher(email).matches()) {
    errors.rejectValue("String_Node_Str","String_Node_Str");
  }
  if (StringUtils.isBlank(form.getFullName()) || StringUtils.length(form.getFullName()) > 255) {
    errors.rejectValue("String_Node_Str","String_Node_Str");
  }
  if (StringUtils.isNotBlank(form.getNotes()) && StringUtils.length(form.getNotes()) > 1024) {
    errors.rejectValue("String_Node_Str","String_Node_Str");
  }
  return evaluateValidationResult(errors);
}
Program: 164587
Project: 164587
Buggy source:
public static ValidationResult validateCategory(TicketCategoryModification category,Errors errors){
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  if (category.getMaxTickets() < 1) {
    errors.reject("String_Node_Str","String_Node_Str");
  }
  if (!category.getInception().isBefore(category.getExpiration())) {
    errors.reject("String_Node_Str","String_Node_Str");
  }
  return evaluateValidationResult(errors);
}

Fixed version (ground truth):
public static ValidationResult validateCategory(TicketCategoryModification category,Errors errors){
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  if (category.getMaxTickets() < 1) {
    errors.rejectValue("String_Node_Str","String_Node_Str");
  }
  if (!category.getInception().isBefore(category.getExpiration())) {
    errors.rejectValue("String_Node_Str","String_Node_Str");
  }
  return evaluateValidationResult(errors);
}
Program: 164588
Project: 164588
Buggy source:
public static ValidationResult validateEventHeader(EventModification ev,Errors errors){
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  if (ev.getOrganizationId() < 0) {
    errors.reject("String_Node_Str","String_Node_Str");
  }
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  if (!StringUtils.startsWith(ev.getImageUrl(),"String_Node_Str")) {
    errors.reject("String_Node_Str","String_Node_Str");
  }
  return evaluateValidationResult(errors);
}

Fixed version (ground truth):
public static ValidationResult validateEventHeader(EventModification ev,Errors errors){
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  if (ev.getOrganizationId() < 0) {
    errors.rejectValue("String_Node_Str","String_Node_Str");
  }
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  ValidationUtils.rejectIfEmptyOrWhitespace(errors,"String_Node_Str","String_Node_Str");
  if (!StringUtils.startsWith(ev.getImageUrl(),"String_Node_Str")) {
    errors.rejectValue("String_Node_Str","String_Node_Str");
  }
  return evaluateValidationResult(errors);
}
Program: 164589
Project: 164589
Buggy source:
/** 
 * Get the total cost with VAT if it's not included in the ticket price.
 * @param reservationId
 * @return
 */
public TotalPrice totalReservationCostWithVAT(String reservationId){
  Event event=eventRepository.findByReservationId(reservationId);
  int total=totalFrom(ticketRepository.findTicketsInReservation(reservationId));
  if (event.isVatIncluded()) {
    final int vat=MonetaryUtil.calcVat(total,event.getVat());
    return new TotalPrice(total + vat,vat);
  }
 else {
    int priceWithVAT=MonetaryUtil.addVAT(total,event.getVat());
    return new TotalPrice(priceWithVAT,priceWithVAT - total);
  }
}

Fixed version (ground truth):
/** 
 * Get the total cost with VAT if it's not included in the ticket price.
 * @param reservationId
 * @return
 */
public TotalPrice totalReservationCostWithVAT(String reservationId){
  Event event=eventRepository.findByReservationId(reservationId);
  List<Ticket> tickets=ticketRepository.findTicketsInReservation(reservationId);
  int net=totalFrom(tickets);
  int vat=totalVat(tickets,event.getVat());
  return new TotalPrice(net + vat,vat);
}
Program: 164590
Project: 164590
Buggy source:
@Override public void onStartup(ServletContext servletContext) throws ServletException {
  super.onStartup(servletContext);
  configureSessionCookie(servletContext);
  Dynamic redirectFilter=servletContext.addFilter("String_Node_Str",RedirectToHttpsFilter.class);
  redirectFilter.setAsyncSupported(true);
  redirectFilter.addMappingForUrlPatterns(null,false,"String_Node_Str");
  if (System.getProperty("String_Node_Str") != null) {
    Class<?> cls;
    try {
      cls=ClassUtils.getClass("String_Node_Str");
      MethodUtils.invokeStaticMethod(cls,"String_Node_Str",new Object[]{new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}});
    }
 catch (    ReflectiveOperationException e) {
      log.warn("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void onStartup(ServletContext servletContext) throws ServletException {
  super.onStartup(servletContext);
  configureSessionCookie(servletContext);
  CharacterEncodingFilter cef=new CharacterEncodingFilter();
  cef.setEncoding("String_Node_Str");
  cef.setForceEncoding(true);
  Dynamic characterEncodingFilter=servletContext.addFilter("String_Node_Str",cef);
  characterEncodingFilter.setAsyncSupported(true);
  characterEncodingFilter.addMappingForUrlPatterns(null,false,"String_Node_Str");
  Dynamic redirectFilter=servletContext.addFilter("String_Node_Str",RedirectToHttpsFilter.class);
  redirectFilter.setAsyncSupported(true);
  redirectFilter.addMappingForUrlPatterns(null,false,"String_Node_Str");
  if (System.getProperty("String_Node_Str") != null) {
    Class<?> cls;
    try {
      cls=ClassUtils.getClass("String_Node_Str");
      MethodUtils.invokeStaticMethod(cls,"String_Node_Str",new Object[]{new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}});
    }
 catch (    ReflectiveOperationException e) {
      log.warn("String_Node_Str",e);
    }
  }
}
Program: 164591
Project: 164591
Buggy source:
public String getRequiredValue(ConfigurationKeys key){
  return optionally(() -> configurationRepository.findByKey(key.getValue())).map(Configuration::getValue).orElseThrow(IllegalArgumentException::new);
}

Fixed version (ground truth):
public String getRequiredValue(ConfigurationKeys key){
  return optionally(() -> configurationRepository.findByKey(key.getValue())).map(Configuration::getValue).orElseThrow(() -> new IllegalArgumentException("String_Node_Str" + key + "String_Node_Str"));
}
Program: 164592
Project: 164592
Buggy source:
public BigDecimal getFinalPrice(){
  if (event.isVatIncluded()) {
    return MonetaryUtil.addVAT(ticketCategory.getPrice(),event.getVat());
  }
  return ticketCategory.getPrice();
}

Fixed version (ground truth):
public String getFinalPrice(){
  if (event.isVatIncluded()) {
    return formatCents(addVAT(ticketCategory.getPriceInCents(),event.getVat()));
  }
  return formatCents(ticketCategory.getPriceInCents());
}
Program: 164593
Project: 164593
Buggy source:
@Override protected void configure(HttpSecurity http) throws Exception {
  http.sessionManagement().invalidSessionUrl("String_Node_Str").and().csrf().csrfTokenRepository(getCsrfTokenRepository()).and().authorizeRequests().antMatchers(ADMIN_API + "String_Node_Str",ADMIN_API + "String_Node_Str",ADMIN_API + "String_Node_Str").hasRole(ROLE_ADMIN).antMatchers("String_Node_Str").hasAnyRole(ROLE_ADMIN,ROLE_OWNER).antMatchers("String_Node_Str").permitAll().and().formLogin();
}

Fixed version (ground truth):
@Override protected void configure(HttpSecurity http) throws Exception {
  http.exceptionHandling().accessDeniedPage("String_Node_Str").and().csrf().csrfTokenRepository(getCsrfTokenRepository()).and().authorizeRequests().antMatchers(ADMIN_API + "String_Node_Str",ADMIN_API + "String_Node_Str",ADMIN_API + "String_Node_Str").hasRole(ROLE_ADMIN).antMatchers("String_Node_Str").hasAnyRole(ROLE_ADMIN,ROLE_OWNER).antMatchers("String_Node_Str").permitAll().and().formLogin();
}
Program: 164594
Project: 164594
Buggy source:
@Bean public MessageSource messageSource(){
  ResourceBundleMessageSource source=new ResourceBundleMessageSource();
  source.setBasenames("String_Node_Str","String_Node_Str");
  source.setFallbackToSystemLocale(false);
  return source;
}

Fixed version (ground truth):
@Bean public MessageSource messageSource(){
  ResourceBundleMessageSource source=new ResourceBundleMessageSource();
  source.setBasenames("String_Node_Str","String_Node_Str");
  source.setFallbackToSystemLocale(false);
  source.setAlwaysUseMessageFormat(true);
  return source;
}
Program: 164595
Project: 164595
Buggy source:
public int getPriceInCents(){
  return freeOfCharge ? 0 : price.multiply(EventManager.HUNDRED).intValueExact();
}

Fixed version (ground truth):
public int getPriceInCents(){
  return freeOfCharge ? 0 : MonetaryUtil.unitToCents(price);
}
Program: 164596
Project: 164596
Buggy source:
public BigDecimal getNotSoldTicketsPercent(){
  return EventManager.HUNDRED.subtract(soldTicketsPercent);
}

Fixed version (ground truth):
public BigDecimal getNotSoldTicketsPercent(){
  return MonetaryUtil.HUNDRED.subtract(soldTicketsPercent);
}
Program: 164597
Project: 164597
Buggy source:
public TicketCategoryWithStatistic(TicketCategory ticketCategory,int soldTickets,List<SpecialPrice> tokenStatus){
  this.ticketCategory=ticketCategory;
  this.soldTickets=soldTickets;
  this.tokenStatus=tokenStatus;
  this.soldTicketsPercent=BigDecimal.valueOf(soldTickets).divide(BigDecimal.valueOf(ticketCategory.getMaxTickets()),2,RoundingMode.HALF_UP);
}

Fixed version (ground truth):
public TicketCategoryWithStatistic(TicketCategory ticketCategory,int soldTickets,List<SpecialPrice> tokenStatus){
  this.ticketCategory=ticketCategory;
  this.soldTickets=soldTickets;
  this.tokenStatus=tokenStatus;
  this.soldTicketsPercent=BigDecimal.valueOf(soldTickets).divide(BigDecimal.valueOf(ticketCategory.getMaxTickets()),2,RoundingMode.HALF_UP).multiply(MonetaryUtil.HUNDRED);
}
Program: 164598
Project: 164598
Buggy source:
public int getPriceInCents(){
  return price.multiply(EventManager.HUNDRED).intValueExact();
}

Fixed version (ground truth):
public int getPriceInCents(){
  return freeOfCharge ? 0 : price.multiply(EventManager.HUNDRED).intValueExact();
}
Program: 164599
Project: 164599
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ac_refresh_recycler_view);
  if (getSupportActionBar() != null) {
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
  }
  mWrapperRecyclerView=(WrapperRecyclerView)findViewById(R.id.recycler_view);
  final LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
  mWrapperRecyclerView.setLayoutManager(linearLayoutManager);
  mAdapter=new SimpleAdapter(new ArrayList<String>());
  mAdapter.setLoadMoreFooterView(new DefaultLoadMoreFooterView(this));
  mWrapperRecyclerView.setAdapter(mAdapter);
  mWrapperRecyclerView.setRecyclerViewListener(this);
  mWrapperRecyclerView.post(new Runnable(){
    @Override public void run(){
      mWrapperRecyclerView.autoRefresh();
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ac_refresh_recycler_view);
  if (getSupportActionBar() != null) {
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
  }
  mWrapperRecyclerView=(WrapperRecyclerView)findViewById(R.id.recycler_view);
  final LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this);
  mWrapperRecyclerView.setLayoutManager(linearLayoutManager);
  mAdapter=new SimpleAdapter(new ArrayList<String>());
  mAdapter.setLoadMoreFooterView(new DefaultLoadMoreFooterView(this));
  mWrapperRecyclerView.setAdapter(mAdapter);
  addHeaderView();
  addFooterView();
  mWrapperRecyclerView.setRecyclerViewListener(this);
  mWrapperRecyclerView.post(new Runnable(){
    @Override public void run(){
      mWrapperRecyclerView.autoRefresh();
    }
  }
);
}
Program: 164601
Project: 164601
Buggy source:
@Override public int getSpanSize(int position){
  if (!mAdapter.isContentView(position)) {
    return layoutManager.getSpanCount();
  }
 else {
    return 1;
  }
}

Fixed version (ground truth):
@Override public int getSpanSize(int position){
  if (mAdapter.isContentView(position)) {
    return 1;
  }
 else {
    return layoutManager.getSpanCount();
  }
}
Program: 164602
Project: 164602
Buggy source:
public void showNoMoreDataView(){
  if (mLoadMoreFooterView == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mLoadMoreFooterView.showNoMoreData();
  if (showLoadMoreView) {
  }
 else {
    this.showLoadMoreView=true;
    notifyItemInserted(getBasicItemCount());
  }
}

Fixed version (ground truth):
public void showNoMoreDataView(){
  if (mLoadMoreFooterView == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mLoadMoreFooterView.showNoMoreData();
  if (showLoadMoreView) {
  }
 else {
    this.showLoadMoreView=true;
    notifyItemInserted(getItemCount());
  }
}
Program: 164603
Project: 164603
Buggy source:
public void hideFooterView(){
  if (mLoadMoreFooterView == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (showLoadMoreView) {
    this.showLoadMoreView=false;
    notifyItemRemoved(getItemCount());
  }
}

Fixed version (ground truth):
public void hideFooterView(){
  if (mLoadMoreFooterView == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (showLoadMoreView) {
    this.showLoadMoreView=false;
    notifyDataSetChanged();
  }
}
Program: 164604
Project: 164604
Buggy source:
public void showLoadMoreView(){
  if (mLoadMoreFooterView == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mLoadMoreFooterView.showLoading();
  if (showLoadMoreView) {
  }
 else {
    this.showLoadMoreView=true;
    notifyItemInserted(getBasicItemCount());
  }
}

Fixed version (ground truth):
public void showLoadMoreView(){
  if (mLoadMoreFooterView == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mLoadMoreFooterView.showLoading();
  if (showLoadMoreView) {
  }
 else {
    this.showLoadMoreView=true;
    notifyItemInserted(getItemCount());
  }
}
Program: 164605
Project: 164605
Buggy source:
@SuppressWarnings("String_Node_Str") void addResult(@Nullable Object value){
  if (value == null) {
    getResults().addReturnValueResult(null);
  }
 else   if (isReplacementInstance(value)) {
    if (recordPhase != null) {
      Map<Object,Object> replacementMap=recordPhase.getReplacementMap();
      replacementMap.put(invocation.instance,value);
    }
    invocation.replacementInstance=value;
  }
 else   if (value instanceof Throwable) {
    getResults().addThrowable((Throwable)value);
  }
 else   if (value instanceof mockit.Delegate) {
    getResults().addDelegatedResult((mockit.Delegate<?>)value);
  }
 else {
    Class<?> rt=getReturnType();
    if (rt.isInstance(value)) {
      getResults().addReturnValueResult(value);
    }
 else {
      new ReturnTypeConversion(this,rt,value).addConvertedValue();
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") void addResult(@Nullable Object value){
}
Program: 164606
Project: 164606
Buggy source:
Expectation(@Nullable RecordPhase recordPhase,@Nonnull ExpectedInvocation invocation,boolean nonStrict){
  this.recordPhase=recordPhase;
  this.invocation=invocation;
  constraints=new InvocationConstraints(nonStrict);
}

Fixed version (ground truth):
Expectation(@Nonnull RecordPhase recordPhase,@Nonnull ExpectedInvocation invocation,boolean nonStrict){
  this.recordPhase=recordPhase;
  this.invocation=invocation;
  constraints=new InvocationConstraints(nonStrict);
}
Program: 164607
Project: 164607
Buggy source:
@Nonnull public static String extractNames(@Nonnull Class<?> classOfInterest){
  String className=classOfInterest.getName();
  String classDesc=className.replace('.','/');
  if (!ParameterNames.hasNamesForClass(classDesc)) {
    byte[] classfile=JAVA_VERSION < 1.7F ? ClassFile.readBytesFromClassFile(classDesc) : ClassFile.getClassFile(classOfInterest);
    ClassMetadataReader cmr=new ClassMetadataReader(classfile,PARAMETERS);
    List<MethodInfo> methods=cmr.getMethods();
    for (    MethodInfo method : methods) {
      if (!method.isSynthetic()) {
        String[] parameters=method.parameters;
        if (parameters != null) {
          ParameterNames.register(classDesc,method.name,method.desc,parameters);
        }
      }
    }
  }
  return classDesc;
}

Fixed version (ground truth):
@Nonnull public static String extractNames(@Nonnull Class<?> classOfInterest){
  String className=classOfInterest.getName();
  String classDesc=className.replace('.','/');
  if (!ParameterNames.hasNamesForClass(classDesc)) {
    byte[] classfile=ClassFile.readBytesFromClassFile(classDesc);
    ClassMetadataReader cmr=new ClassMetadataReader(classfile,PARAMETERS);
    List<MethodInfo> methods=cmr.getMethods();
    for (    MethodInfo method : methods) {
      if (!method.isSynthetic()) {
        String[] parameters=method.parameters;
        if (parameters != null) {
          ParameterNames.register(classDesc,method.name,method.desc,parameters);
        }
      }
    }
  }
  return classDesc;
}
Program: 164608
Project: 164608
Buggy source:
@Nullable CommonDataSource createIfDataSourceDefinitionAvailable(@Nonnull TestedClass testedClass){
  if (dsName == null) {
    return null;
  }
  TestedClass testedClassToBeSearched=testedClass;
  do {
    createFromTestedClassOrASuperclass(testedClassToBeSearched);
    if (ds != null) {
      return ds;
    }
    testedClassToBeSearched=testedClassToBeSearched.parent;
  }
 while (testedClassToBeSearched != null);
  throw new IllegalStateException("String_Node_Str" + dsName + "String_Node_Str"+ testedClass.nameOfTestedClass+ "String_Node_Str");
}

Fixed version (ground truth):
@Nullable CommonDataSource createIfDataSourceDefinitionAvailable(@Nonnull TestedClass testedClass){
  TestedClass testedClassWithDataSource=testedClass.parent;
  if (testedClassWithDataSource == null || dsName == null) {
    return null;
  }
  TestedClass testedClassToBeSearched=testedClassWithDataSource;
  do {
    createFromTestedClassOrASuperclass(testedClassToBeSearched);
    if (ds != null) {
      return ds;
    }
    testedClassToBeSearched=testedClassToBeSearched.parent;
  }
 while (testedClassToBeSearched != null);
  throw new IllegalStateException("String_Node_Str" + dsName + "String_Node_Str"+ testedClassWithDataSource.nameOfTestedClass+ "String_Node_Str");
}
Program: 164610
Project: 164610
Buggy source:
@Nonnegative private int readAllLabelsInCodeBlock(@Nonnegative int u,@Nonnegative int codeLength,@Nonnegative int codeStart,@Nonnegative int codeEnd){
  byte[] b=code;
  readLabel(codeLength + 1);
  while (u < codeEnd) {
    int offset=u - codeStart;
    int opcode=b[u] & 0xFF;
switch (TYPE[opcode]) {
case NOARG:
case IMPLVAR:
      u++;
    break;
case LABEL:
  readLabel(offset + readShort(u + 1));
u+=3;
break;
case LABELW:
readLabel(offset + readInt(u + 1));
u+=5;
break;
case InstructionType.WIDE:
opcode=b[u + 1] & 0xFF;
u+=opcode == IINC ? 6 : 4;
break;
case TABL:
u=readSwitchInstruction(u,offset,true);
break;
case LOOK:
u=readSwitchInstruction(u,offset,false);
break;
case VAR:
case SBYTE:
case InstructionType.LDC:
u+=2;
break;
case SHORT:
case LDCW:
case FIELDORMETH:
case InstructionType.TYPE:
case IINC:
u+=3;
break;
case ITFMETH:
case INDYMETH:
u+=5;
break;
default :
u+=4;
break;
}
}
return u;
}

Fixed version (ground truth):
@Nonnegative private int readAllLabelsInCodeBlock(@Nonnegative int u,@Nonnegative int codeLength,@Nonnegative int codeStart,@Nonnegative int codeEnd){
  byte[] b=code;
  readLabel(codeLength + 1);
  while (u < codeEnd) {
    int offset=u - codeStart;
    int opcode=b[u] & 0xFF;
switch (TYPE[opcode]) {
case NOARG:
case IMPLVAR:
      u++;
    break;
case LABEL:
  readLabel(offset + readShort(u + 1));
u+=3;
break;
case LABELW:
readLabel(offset + readInt(u + 1));
u+=5;
break;
case WIDE_INSN:
opcode=b[u + 1] & 0xFF;
u+=opcode == IINC ? 6 : 4;
break;
case TABL_INSN:
u=readSwitchInstruction(u,offset,true);
break;
case LOOK_INSN:
u=readSwitchInstruction(u,offset,false);
break;
case VAR:
case SBYTE:
case LDC_INSN:
u+=2;
break;
case SHORT:
case LDCW_INSN:
case FIELDORMETH:
case TYPE_INSN:
case IINC_INSN:
u+=3;
break;
case ITFMETH:
case INDYMETH:
u+=5;
break;
case MANA_INSN:
default :
u+=4;
break;
}
}
return u;
}
Program: 164611
Project: 164611
Buggy source:
/** 
 * Reads a method and makes the given visitor visit it.
 * @param u the start offset of the method in the class file.
 * @return the offset of the first byte following the method in the class.
 */
@Nonnegative private int readMethod(@Nonnegative int u){
  u=readMethodDeclaration(u);
  int u0=u;
  int code=0;
  int exception=0;
  exceptions=null;
  String signature=null;
  int anns=0;
  int annDefault=0;
  int paramAnns=0;
  char[] c=buf;
  for (int i=readUnsignedShort(u); i > 0; i--) {
    String attrName=readUTF8(u + 2,c);
    if ("String_Node_Str".equals(attrName)) {
      code=u + 8;
    }
 else     if ("String_Node_Str".equals(attrName)) {
      exception=readExceptionsInThrowsClause(u);
    }
 else     if ("String_Node_Str".equals(attrName)) {
      signature=readUTF8(u + 8,c);
    }
 else     if ("String_Node_Str".equals(attrName)) {
      access=Access.asDeprecated(access);
    }
 else     if ("String_Node_Str".equals(attrName)) {
      anns=u + 8;
    }
 else     if ("String_Node_Str".equals(attrName)) {
      annDefault=u + 8;
    }
 else     if ("String_Node_Str".equals(attrName)) {
      access=Access.asSynthetic(access);
    }
 else     if ("String_Node_Str".equals(attrName)) {
      paramAnns=u + 8;
    }
    u+=6 + readInt(u + 4);
  }
  u+=2;
  readMethodBody(u0,u,code,exception,signature,anns,annDefault,paramAnns);
  return u;
}

Fixed version (ground truth):
/** 
 * Reads a method and makes the given visitor visit it.
 * @param u the start offset of the method in the class file.
 * @return the offset of the first byte following the method in the class.
 */
@Nonnegative private int readMethod(@Nonnegative int u){
  u=readMethodDeclaration(u);
  int u0=u;
  int code=0;
  int exception=0;
  exceptions=null;
  String signature=null;
  int anns=0;
  int annDefault=0;
  int paramAnns=0;
  char[] c=buf;
  for (int attributeCount=readUnsignedShort(u); attributeCount > 0; attributeCount--) {
    String attrName=readUTF8(u + 2,c);
    if ("String_Node_Str".equals(attrName)) {
      code=u + 8;
    }
 else     if ("String_Node_Str".equals(attrName)) {
      exception=readExceptionsInThrowsClause(u);
    }
 else     if ("String_Node_Str".equals(attrName)) {
      signature=readUTF8(u + 8,c);
    }
 else     if ("String_Node_Str".equals(attrName)) {
      access=Access.asDeprecated(access);
    }
 else     if ("String_Node_Str".equals(attrName)) {
      anns=u + 8;
    }
 else     if ("String_Node_Str".equals(attrName)) {
      annDefault=u + 8;
    }
 else     if ("String_Node_Str".equals(attrName)) {
      access=Access.asSynthetic(access);
    }
 else     if ("String_Node_Str".equals(attrName)) {
      paramAnns=u + 8;
    }
    u+=6 + readInt(u + 4);
  }
  u+=2;
  readMethodBody(u0,u,code,exception,signature,anns,annDefault,paramAnns);
  return u;
}
Program: 164612
Project: 164612
Buggy source:
@Nonnull private Class<?> getTargetReturnType(){
  String methodNameAndDescription=invocation.getMethodNameAndDescription();
  int rightParen=methodNameAndDescription.indexOf(')') + 1;
  String returnTypeDesc=methodNameAndDescription.substring(rightParen);
  if (returnTypeDesc.length() == 1) {
    char typeCode=returnTypeDesc.charAt(0);
    return getPrimitiveType(typeCode);
  }
  String returnTypeInternalName=returnTypeDesc.substring(1,returnTypeDesc.length() - 1);
  return ClassLoad.loadByInternalName(returnTypeInternalName);
}

Fixed version (ground truth):
@Nonnull private Class<?> getTargetReturnType(){
  Type returnType=Type.getReturnType(invocation.getMethodNameAndDescription());
  Class<?> classForType=TypeDescriptor.getClassForType(returnType);
  return classForType;
}
Program: 164613
Project: 164613
Buggy source:
void delegate(){
}

Fixed version (ground truth):
byte[] delegate(){
  return bytes;
}
Program: 164614
Project: 164614
Buggy source:
@Nullable public static Object matchedArgument(@Nonnegative int parameterIndex){
  RecordAndReplayExecution instance=TestRun.getRecordAndReplayForRunningTest();
  if (instance != null) {
    BaseVerificationPhase verificationPhase=(BaseVerificationPhase)instance.getCurrentTestOnlyPhase();
    if (verificationPhase != null) {
      return verificationPhase.getArgumentValueForCurrentVerification(parameterIndex);
    }
  }
  return null;
}

Fixed version (ground truth):
@Nullable public static Object matchedArgument(@Nonnegative int parameterIndex,@Nullable String argTypeDesc){
  RecordAndReplayExecution instance=TestRun.getRecordAndReplayForRunningTest();
  if (instance != null) {
    BaseVerificationPhase verificationPhase=(BaseVerificationPhase)instance.getCurrentTestOnlyPhase();
    if (verificationPhase != null) {
      Object value=verificationPhase.getArgumentValueForCurrentVerification(parameterIndex);
      if (value == null && argTypeDesc != null) {
        value=DefaultValues.computeForWrapperType(argTypeDesc);
      }
      return value;
    }
  }
  return null;
}
Program: 164615
Project: 164615
Buggy source:
/** 
 * Generates bytecode that will be responsible for performing the following steps: 1. Get the argument value (an Object) for the last matched invocation. 2. Cast to a reference type or unbox to a primitive type, as needed. 3. Store the converted value in its local variable.
 */
void generateCodeToStoreCapturedValue(){
  if (opcode != ALOAD) {
    mw.visitIntInsn(SIPUSH,parameterIndex);
    invocationBlockModifier.generateCallToActiveInvocationsMethod("String_Node_Str","String_Node_Str");
    Type argType=getArgumentType();
    generateCastOrUnboxing(mw,argType,opcode);
    mw.visitVarInsn(opcode,varIndex);
  }
}

Fixed version (ground truth):
/** 
 * Generates bytecode that will be responsible for performing the following steps: 1. Get the argument value (an Object) for the last matched invocation. 2. Cast to a reference type or unbox to a primitive type, as needed. 3. Store the converted value in its local variable.
 */
void generateCodeToStoreCapturedValue(){
  if (opcode != ALOAD) {
    mw.visitIntInsn(SIPUSH,parameterIndex);
    if (typeToCapture == null) {
      mw.visitInsn(ACONST_NULL);
    }
 else {
      mw.visitLdcInsn(typeToCapture);
    }
    invocationBlockModifier.generateCallToActiveInvocationsMethod("String_Node_Str","String_Node_Str");
    Type argType=getArgumentType();
    generateCastOrUnboxing(mw,argType,opcode);
    mw.visitVarInsn(opcode,varIndex);
  }
}
Program: 164616
Project: 164616
Buggy source:
@Nonnull private Type getArgumentType(){
  if (typeToCapture == null) {
    return invocationBlockModifier.argumentMatching.getParameterType(parameterIndex);
  }
 else   if (typeToCapture.charAt(0) == '[') {
    return Type.getType(typeToCapture);
  }
 else {
    return Type.getType('L' + typeToCapture + ';');
  }
}

Fixed version (ground truth):
@Nonnull private Type getArgumentType(){
  if (typeToCapture == null) {
    return invocationBlockModifier.argumentMatching.getParameterType(parameterIndex);
  }
  if (typeToCapture.charAt(0) == '[') {
    return Type.getType(typeToCapture);
  }
  return Type.getType('L' + typeToCapture + ';');
}
Program: 164618
Project: 164618
Buggy source:
@Nullable public static Object computeForType(@Nonnull Class<?> type){
  if (type.isArray()) {
    return Array.newInstance(type.getComponentType(),0);
  }
 else   if (type != void.class && type.isPrimitive()) {
    return defaultValueForPrimitiveType(type);
  }
  return computeForWrapperType(type);
}

Fixed version (ground truth):
@Nullable public static Object computeForType(@Nonnull Class<?> type){
  if (type.isArray()) {
    return Array.newInstance(type.getComponentType(),0);
  }
  if (type != void.class && type.isPrimitive()) {
    return defaultValueForPrimitiveType(type);
  }
  return computeForWrapperType(type);
}
Program: 164619
Project: 164619
Buggy source:
@SuppressWarnings("String_Node_Str") @Nullable public static <T>T computeForWrapperType(@Nonnull java.lang.reflect.Type type){
  if (type == Integer.class) {
    return (T)ZERO_INT;
  }
 else   if (type == Boolean.class) {
    return (T)Boolean.FALSE;
  }
 else   if (type == Long.class) {
    return (T)ZERO_LONG;
  }
 else   if (type == Double.class) {
    return (T)ZERO_DOUBLE;
  }
 else   if (type == Float.class) {
    return (T)ZERO_FLOAT;
  }
 else   if (type == Character.class) {
    return (T)ZERO_CHAR;
  }
 else   if (type == Byte.class) {
    return (T)ZERO_BYTE;
  }
 else   if (type == Short.class) {
    return (T)ZERO_SHORT;
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Nullable public static <T>T computeForWrapperType(@Nonnull String typeDesc){
  if ("String_Node_Str".equals(typeDesc)) {
    return (T)ZERO_INT;
  }
  if ("String_Node_Str".equals(typeDesc)) {
    return (T)Boolean.FALSE;
  }
  if ("String_Node_Str".equals(typeDesc)) {
    return (T)ZERO_LONG;
  }
  if ("String_Node_Str".equals(typeDesc)) {
    return (T)ZERO_DOUBLE;
  }
  if ("String_Node_Str".equals(typeDesc)) {
    return (T)ZERO_FLOAT;
  }
  if ("String_Node_Str".equals(typeDesc)) {
    return (T)ZERO_CHAR;
  }
  if ("String_Node_Str".equals(typeDesc)) {
    return (T)ZERO_BYTE;
  }
  if ("String_Node_Str".equals(typeDesc)) {
    return (T)ZERO_SHORT;
  }
  return null;
}
Program: 164620
Project: 164620
Buggy source:
Unmocked(@SuppressWarnings("String_Node_Str") String s){
}

Fixed version (ground truth):
Unmocked(@SuppressWarnings("String_Node_Str") boolean b){
}
Program: 164621
Project: 164621
Buggy source:
@Nonnull protected final Expectation expectationBeingVerified(){
  return currentVerification;
}

Fixed version (ground truth):
@Nullable protected final Expectation expectationBeingVerified(){
  return currentVerification;
}
Program: 164622
Project: 164622
Buggy source:
@Nullable public final Object getArgumentValueForCurrentVerification(int parameterIndex){
  List<VerifiedExpectation> verifiedExpectations=recordAndReplay.executionState.verifiedExpectations;
  if (verifiedExpectations.isEmpty()) {
    return expectationBeingVerified().invocation.getArgumentValues()[parameterIndex];
  }
  VerifiedExpectation lastMatched=verifiedExpectations.get(verifiedExpectations.size() - 1);
  return lastMatched.arguments[parameterIndex];
}

Fixed version (ground truth):
@Nullable public final Object getArgumentValueForCurrentVerification(int parameterIndex){
  List<VerifiedExpectation> verifiedExpectations=recordAndReplay.executionState.verifiedExpectations;
  if (verifiedExpectations.isEmpty()) {
    Expectation expectation=expectationBeingVerified();
    return expectation == null ? null : expectation.invocation.getArgumentValues()[parameterIndex];
  }
  VerifiedExpectation lastMatched=verifiedExpectations.get(verifiedExpectations.size() - 1);
  return lastMatched.arguments[parameterIndex];
}
Program: 164623
Project: 164623
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void handleInvocationCountConstraint(int minInvocations,int maxInvocations){
  Error errorThrown=pendingError;
  pendingError=null;
  if (errorThrown != null && minInvocations > 0) {
    throw errorThrown;
  }
  Expectation verifying=expectationBeingVerified();
  ExpectedInvocation invocation=verifying.invocation;
  argMatchers=invocation.arguments.getMatchers();
  int invocationCount=1;
  while (replayIndex < expectationCount) {
    Expectation replayExpectation=expectationsInReplayOrder.get(replayIndex);
    if (replayExpectation != null && matchesCurrentVerification(replayExpectation)) {
      invocationCount++;
      verifying.constraints.invocationCount++;
      if (invocationCount > maxInvocations) {
        if (maxInvocations >= 0) {
          throw replayExpectation.invocation.errorForUnexpectedInvocation();
        }
        break;
      }
    }
 else     if (invocationCount >= minInvocations) {
      break;
    }
    replayIndex++;
  }
  argMatchers=null;
  int n=minInvocations - invocationCount;
  if (n > 0) {
    throw invocation.errorForMissingInvocations(n,Collections.<ExpectedInvocation>emptyList());
  }
  verifyMaxInvocations(maxInvocations);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void handleInvocationCountConstraint(int minInvocations,int maxInvocations){
  Error errorThrown=pendingError;
  pendingError=null;
  if (errorThrown != null && minInvocations > 0) {
    throw errorThrown;
  }
  Expectation verifying=expectationBeingVerified();
  if (verifying == null) {
    return;
  }
  ExpectedInvocation invocation=verifying.invocation;
  argMatchers=invocation.arguments.getMatchers();
  int invocationCount=1;
  while (replayIndex < expectationCount) {
    Expectation replayExpectation=expectationsInReplayOrder.get(replayIndex);
    if (replayExpectation != null && matchesCurrentVerification(invocation,replayExpectation)) {
      invocationCount++;
      verifying.constraints.invocationCount++;
      if (invocationCount > maxInvocations) {
        if (maxInvocations >= 0) {
          throw replayExpectation.invocation.errorForUnexpectedInvocation();
        }
        break;
      }
    }
 else     if (invocationCount >= minInvocations) {
      break;
    }
    replayIndex++;
  }
  argMatchers=null;
  int n=minInvocations - invocationCount;
  if (n > 0) {
    throw invocation.errorForMissingInvocations(n,Collections.<ExpectedInvocation>emptyList());
  }
  verifyMaxInvocations(verifying,maxInvocations);
}
Program: 164624
Project: 164624
Buggy source:
private boolean matchesCurrentVerification(@Nonnull Expectation replayExpectation){
  ExpectedInvocation invocation=expectationBeingVerified().invocation;
  Object mock=invocation.instance;
  String mockClassDesc=invocation.getClassDesc();
  String mockNameAndDesc=invocation.getMethodNameAndDescription();
  Object[] args=invocation.arguments.getValues();
  matchInstance=invocation.matchInstance;
  if (recordAndReplay.executionState.isToBeMatchedOnInstance(mock,mockNameAndDesc)) {
    matchInstance=true;
  }
  Object replayInstance=invocationInstancesInReplayOrder.get(replayIndex);
  Object[] replayArgs=invocationArgumentsInReplayOrder.get(replayIndex);
  return matches(mock,mockClassDesc,mockNameAndDesc,args,replayExpectation,replayInstance,replayArgs);
}

Fixed version (ground truth):
private boolean matchesCurrentVerification(@Nonnull ExpectedInvocation invocation,@Nonnull Expectation replayExpectation){
  Object mock=invocation.instance;
  String mockClassDesc=invocation.getClassDesc();
  String mockNameAndDesc=invocation.getMethodNameAndDescription();
  Object[] args=invocation.arguments.getValues();
  matchInstance=invocation.matchInstance;
  if (recordAndReplay.executionState.isToBeMatchedOnInstance(mock,mockNameAndDesc)) {
    matchInstance=true;
  }
  Object replayInstance=invocationInstancesInReplayOrder.get(replayIndex);
  Object[] replayArgs=invocationArgumentsInReplayOrder.get(replayIndex);
  return matches(mock,mockClassDesc,mockNameAndDesc,args,replayExpectation,replayInstance,replayArgs);
}
Program: 164625
Project: 164625
Buggy source:
private void verifyMaxInvocations(int maxInvocations){
  if (maxInvocations >= 0) {
    Expectation verifying=expectationBeingVerified();
    int n=verifying.constraints.invocationCount - maxInvocations;
    if (n > 0) {
      Object[] replayArgs=invocationArgumentsInReplayOrder.get(replayIndex - 1);
      throw verifying.invocation.errorForUnexpectedInvocations(replayArgs,n);
    }
  }
}

Fixed version (ground truth):
private void verifyMaxInvocations(@Nonnull Expectation verifying,int maxInvocations){
  if (maxInvocations >= 0) {
    int n=verifying.constraints.invocationCount - maxInvocations;
    if (n > 0) {
      Object[] replayArgs=invocationArgumentsInReplayOrder.get(replayIndex - 1);
      throw verifying.invocation.errorForUnexpectedInvocations(replayArgs,n);
    }
  }
}