Program: 40455
Project: 40455
Buggy source:
@Override protected void executeWithConfig(CommandEvent commandEvent,Config config){
  final User user=commandEvent.getAuthor();
  final String userName=user.getName();
  final String[] args=commandEvent.getArgs().split("String_Node_Str");
  String whatToChange=args[0].trim().toLowerCase();
  String whatToChangeTo;
  StringBuilder gymNameBuilder;
  String gymName;
  Gym gym;
  Raid raid;
  LocalTime endsAtTime;
  LocalDateTime endsAt;
switch (whatToChange) {
case "String_Node_Str":
    whatToChangeTo=args[1].trim().toLowerCase();
  gymNameBuilder=new StringBuilder();
for (int i=2; i < args.length; i++) {
  gymNameBuilder.append(args[i]).append("String_Node_Str");
}
gymName=gymNameBuilder.toString().trim();
gym=gymRepository.search(user,gymName,config.getRegion());
raid=raidRepository.getActiveRaidOrFallbackToExRaid(gym,config.getRegion(),user);
verifyPermission(commandEvent,user,raid);
endsAtTime=parseTime(user,whatToChangeTo,localeService);
endsAt=LocalDateTime.of(LocalDate.now(),endsAtTime);
assertTimeNotInNoRaidTimespan(user,endsAtTime,localeService);
assertTimeNotMoreThanXHoursFromNow(user,endsAtTime,localeService,2);
assertCreateRaidTimeNotBeforeNow(user,endsAt,localeService);
raid=raidRepository.changeEndOfRaid(raid.getId(),endsAt,user);
break;
case "String_Node_Str":
whatToChangeTo=args[1].trim().toLowerCase();
gymNameBuilder=new StringBuilder();
for (int i=2; i < args.length; i++) {
gymNameBuilder.append(args[i]).append("String_Node_Str");
}
gymName=gymNameBuilder.toString().trim();
gym=gymRepository.search(user,gymName,config.getRegion());
raid=raidRepository.getActiveRaidOrFallbackToExRaid(gym,config.getRegion(),user);
final Pokemon pokemon=pokemonRepository.search(whatToChangeTo,user);
if (Utils.isRaidExPokemon(raid.getPokemon().getName())) {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.EX_NO_CHANGE_POKEMON,localeService.getLocaleForUser(user)));
}
verifyPermission(commandEvent,user,raid);
if (pokemon.getName().equalsIgnoreCase("String_Node_Str")) {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.EX_CANT_CHANGE_RAID_TYPE,localeService.getLocaleForUser(user)));
}
raid=raidRepository.changePokemon(raid,pokemon);
break;
case "String_Node_Str":
gymNameBuilder=new StringBuilder();
for (int i=1; i < args.length; i++) {
gymNameBuilder.append(args[i]).append("String_Node_Str");
}
gymName=gymNameBuilder.toString().trim();
gym=gymRepository.search(user,gymName,config.getRegion());
raid=raidRepository.getActiveRaidOrFallbackToExRaid(gym,config.getRegion(),user);
verifyPermission(commandEvent,user,raid);
final boolean userIsNotAdministrator=!isUserAdministrator(commandEvent);
if (userIsNotAdministrator && raid.getSignUps().size() > 0) {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.ONLY_ADMINS_REMOVE_RAID,localeService.getLocaleForUser(user)));
}
if (raidRepository.delete(raid)) {
raid=null;
}
 else {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.RAID_NOT_EXISTS,localeService.getLocaleForUser(user)));
}
break;
case "String_Node_Str":
whatToChangeTo=args[1].trim().toLowerCase();
gymNameBuilder=new StringBuilder();
for (int i=2; i < args.length; i++) {
gymNameBuilder.append(args[i]).append("String_Node_Str");
}
gymName=gymNameBuilder.toString().trim();
gym=gymRepository.search(user,gymName,config.getRegion());
raid=raidRepository.getActiveRaidOrFallbackToExRaid(gym,config.getRegion(),user);
verifyPermission(commandEvent,user,raid);
LocalTime newTime=parseTime(user,whatToChangeTo,localeService);
LocalDateTime newDateTime=LocalDateTime.of(LocalDate.now(),newTime);
assertTimeNotInNoRaidTimespan(user,newTime,localeService);
assertTimeNotMoreThanXHoursFromNow(user,newTime,localeService,2);
assertCreateRaidTimeNotBeforeNow(user,newDateTime,localeService);
boolean groupChanged=false;
for (Object o : botService.getBot().getRegisteredListeners()) {
if (o instanceof EmoticonSignUpMessageListener) {
EmoticonSignUpMessageListener listener=(EmoticonSignUpMessageListener)o;
final String raidId=raid.getId();
final boolean isCorrectRaid=raidId.equals(listener.getRaidId());
final boolean isUsersGroup=user.getId().equals(listener.getUserId());
if (isCorrectRaid && (isUsersGroup || isUserAdministrator(commandEvent))) {
final LocalDateTime currentStartAt=listener.getStartAt();
raidRepository.moveAllSignUpsForTimeToNewTime(raidId,currentStartAt,newDateTime,user);
listener.setStartAt(newDateTime);
groupChanged=true;
replyBasedOnConfigAndRemoveAfter(config,commandEvent,localeService.getMessageFor(LocaleService.MOVED_GROUP,localeService.getLocaleForUser(user),printTimeIfSameDay(currentStartAt),printTimeIfSameDay(newDateTime),raid.getGym().getName()),30);
}
}
}
if (!groupChanged) {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.BAD_SYNTAX,localeService.getLocaleForUser(user)));
}
break;
default :
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.BAD_SYNTAX,localeService.getLocaleForUser(user)));
}
commandEvent.reactSuccess();
}

Fixed version (ground truth):
@Override protected void executeWithConfig(CommandEvent commandEvent,Config config){
  final User user=commandEvent.getAuthor();
  final String userName=user.getName();
  final String[] args=commandEvent.getArgs().split("String_Node_Str");
  String whatToChange=args[0].trim().toLowerCase();
  String whatToChangeTo;
  StringBuilder gymNameBuilder;
  String gymName;
  Gym gym;
  Raid raid;
  LocalTime endsAtTime;
  LocalDateTime endsAt;
switch (whatToChange) {
case "String_Node_Str":
    whatToChangeTo=args[1].trim().toLowerCase();
  gymNameBuilder=new StringBuilder();
for (int i=2; i < args.length; i++) {
  gymNameBuilder.append(args[i]).append("String_Node_Str");
}
gymName=gymNameBuilder.toString().trim();
gym=gymRepository.search(user,gymName,config.getRegion());
raid=raidRepository.getActiveRaidOrFallbackToExRaid(gym,config.getRegion(),user);
verifyPermission(commandEvent,user,raid);
endsAtTime=parseTime(user,whatToChangeTo,localeService);
endsAt=LocalDateTime.of(LocalDate.now(),endsAtTime);
assertTimeNotInNoRaidTimespan(user,endsAtTime,localeService);
assertTimeNotMoreThanXHoursFromNow(user,endsAtTime,localeService,2);
assertCreateRaidTimeNotBeforeNow(user,endsAt,localeService);
raid=raidRepository.changeEndOfRaid(raid.getId(),endsAt);
break;
case "String_Node_Str":
whatToChangeTo=args[1].trim().toLowerCase();
gymNameBuilder=new StringBuilder();
for (int i=2; i < args.length; i++) {
gymNameBuilder.append(args[i]).append("String_Node_Str");
}
gymName=gymNameBuilder.toString().trim();
gym=gymRepository.search(user,gymName,config.getRegion());
raid=raidRepository.getActiveRaidOrFallbackToExRaid(gym,config.getRegion(),user);
final Pokemon pokemon=pokemonRepository.search(whatToChangeTo,user);
if (Utils.isRaidExPokemon(raid.getPokemon().getName())) {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.EX_NO_CHANGE_POKEMON,localeService.getLocaleForUser(user)));
}
verifyPermission(commandEvent,user,raid);
if (pokemon.getName().equalsIgnoreCase("String_Node_Str")) {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.EX_CANT_CHANGE_RAID_TYPE,localeService.getLocaleForUser(user)));
}
raid=raidRepository.changePokemon(raid,pokemon);
break;
case "String_Node_Str":
gymNameBuilder=new StringBuilder();
for (int i=1; i < args.length; i++) {
gymNameBuilder.append(args[i]).append("String_Node_Str");
}
gymName=gymNameBuilder.toString().trim();
gym=gymRepository.search(user,gymName,config.getRegion());
raid=raidRepository.getActiveRaidOrFallbackToExRaid(gym,config.getRegion(),user);
verifyPermission(commandEvent,user,raid);
final boolean userIsNotAdministrator=!isUserAdministrator(commandEvent);
if (userIsNotAdministrator && raid.getSignUps().size() > 0) {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.ONLY_ADMINS_REMOVE_RAID,localeService.getLocaleForUser(user)));
}
if (raidRepository.delete(raid)) {
raid=null;
}
 else {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.RAID_NOT_EXISTS,localeService.getLocaleForUser(user)));
}
break;
case "String_Node_Str":
whatToChangeTo=args[1].trim().toLowerCase();
gymNameBuilder=new StringBuilder();
for (int i=2; i < args.length; i++) {
gymNameBuilder.append(args[i]).append("String_Node_Str");
}
gymName=gymNameBuilder.toString().trim();
gym=gymRepository.search(user,gymName,config.getRegion());
raid=raidRepository.getActiveRaidOrFallbackToExRaid(gym,config.getRegion(),user);
verifyPermission(commandEvent,user,raid);
LocalTime newTime=parseTime(user,whatToChangeTo,localeService);
LocalDateTime newDateTime=LocalDateTime.of(LocalDate.now(),newTime);
assertTimeNotInNoRaidTimespan(user,newTime,localeService);
assertTimeNotMoreThanXHoursFromNow(user,newTime,localeService,2);
assertCreateRaidTimeNotBeforeNow(user,newDateTime,localeService);
boolean groupChanged=false;
for (Object o : botService.getBot().getRegisteredListeners()) {
if (o instanceof EmoticonSignUpMessageListener) {
EmoticonSignUpMessageListener listener=(EmoticonSignUpMessageListener)o;
final String raidId=raid.getId();
final boolean isCorrectRaid=raidId.equals(listener.getRaidId());
final boolean isUsersGroup=user.getId().equals(listener.getUserId());
if (isCorrectRaid && (isUsersGroup || isUserAdministrator(commandEvent))) {
final LocalDateTime currentStartAt=listener.getStartAt();
if (currentStartAt != null) {
raidRepository.moveAllSignUpsForTimeToNewTime(raidId,currentStartAt,newDateTime,user);
listener.setStartAt(newDateTime);
groupChanged=true;
replyBasedOnConfigAndRemoveAfter(config,commandEvent,localeService.getMessageFor(LocaleService.MOVED_GROUP,localeService.getLocaleForUser(user),printTimeIfSameDay(currentStartAt),printTimeIfSameDay(newDateTime),raid.getGym().getName()),30);
}
 else {
replyBasedOnConfigAndRemoveAfter(config,commandEvent,"String_Node_Str" + "String_Node_Str",15);
}
}
}
}
if (!groupChanged) {
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.BAD_SYNTAX,localeService.getLocaleForUser(user)));
}
break;
default :
throw new UserMessedUpException(userName,localeService.getMessageFor(LocaleService.BAD_SYNTAX,localeService.getLocaleForUser(user)));
}
commandEvent.reactSuccess();
}