nus-yam/ex-repair huggingface dataset:
Program: 4263
Project: 4263
Buggy source:
private List<Integer> generateDayCandidatesQuestionMarkSupported(int year,int month,WeekDay mondayDoWValue){
  LocalDate date=LocalDate.of(year,month,1);
  int lengthOfMonth=date.lengthOfMonth();
  Set<Integer> candidates=new HashSet<>();
  if (daysOfMonthCronField.getExpression() instanceof Always && daysOfWeekCronField.getExpression() instanceof Always) {
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
 else   if (daysOfMonthCronField.getExpression() instanceof QuestionMark) {
    candidates.addAll(createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(-1,lengthOfMonth));
  }
 else   if (daysOfWeekCronField.getExpression() instanceof QuestionMark) {
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
 else {
    candidates.addAll(createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(1,lengthOfMonth));
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
  List<Integer> candidatesList=new ArrayList<>(candidates);
  Collections.sort(candidatesList);
  return candidatesList;
}

Fixed version (ground truth):
private List<Integer> generateDayCandidatesQuestionMarkSupported(int year,int month,WeekDay mondayDoWValue){
  LocalDate date=LocalDate.of(year,month,1);
  int lengthOfMonth=date.lengthOfMonth();
  Set<Integer> candidates=new HashSet<>();
  if (daysOfMonthCronField.getExpression() instanceof Always && daysOfWeekCronField.getExpression() instanceof Always) {
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
 else   if (daysOfMonthCronField.getExpression() instanceof QuestionMark) {
    candidates.addAll(createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(0,lengthOfMonth + 1));
  }
 else   if (daysOfWeekCronField.getExpression() instanceof QuestionMark) {
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
 else {
    candidates.addAll(createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(1,lengthOfMonth));
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
  List<Integer> candidatesList=new ArrayList<>(candidates);
  Collections.sort(candidatesList);
  return candidatesList;
}
Program: 4264
Project: 4264
Buggy source:
private List<Integer> generateDayCandidatesQuestionMarkSupported(int year,int month,WeekDay mondayDoWValue){
  LocalDate date=LocalDate.of(year,month,1);
  int lengthOfMonth=date.lengthOfMonth();
  Set<Integer> candidates=new HashSet<>();
  if (daysOfMonthCronField.getExpression() instanceof Always && daysOfWeekCronField.getExpression() instanceof Always) {
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
 else   if (daysOfMonthCronField.getExpression() instanceof QuestionMark) {
    candidates.addAll(createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(-1,lengthOfMonth));
  }
 else   if (daysOfWeekCronField.getExpression() instanceof QuestionMark) {
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
 else {
    candidates.addAll(createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(1,lengthOfMonth));
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
  List<Integer> candidatesList=new ArrayList<>(candidates);
  Collections.sort(candidatesList);
  return candidatesList;
}

Fixed version (ground truth):
private List<Integer> generateDayCandidatesQuestionMarkSupported(int year,int month,WeekDay mondayDoWValue){
  LocalDate date=LocalDate.of(year,month,1);
  int lengthOfMonth=date.lengthOfMonth();
  Set<Integer> candidates=new HashSet<>();
  if (daysOfMonthCronField.getExpression() instanceof Always && daysOfWeekCronField.getExpression() instanceof Always) {
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
 else   if (daysOfMonthCronField.getExpression() instanceof QuestionMark) {
    candidates.addAll(createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(0,lengthOfMonth + 1));
  }
 else   if (daysOfWeekCronField.getExpression() instanceof QuestionMark) {
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
 else {
    candidates.addAll(createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(1,lengthOfMonth));
    candidates.addAll(createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,lengthOfMonth));
  }
  List<Integer> candidatesList=new ArrayList<>(candidates);
  Collections.sort(candidatesList);
  return candidatesList;
}
Program: 4265
Project: 4265
Buggy source:
@Test public void testDescriptionDayOfWeek(){
  assertExpression("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testDescriptionDayOfWeek(){
  assertExpression("String_Node_Str","String_Node_Str");
}
Program: 4266
Project: 4266
Buggy source:
private Every(Every every){
  this(every.getTime());
}

Fixed version (ground truth):
private Every(Every every){
  this(every.getStartValue(),every.getTime());
}
Program: 4267
Project: 4267
Buggy source:
@Override public String asString(){
  if (time.getValue() == 1) {
    return "String_Node_Str";
  }
  return String.format("String_Node_Str",getTime());
}

Fixed version (ground truth):
@Override public String asString(){
  if (time.getValue() == 1) {
    return startValue != null ? "String_Node_Str" : "String_Node_Str";
  }
  return String.format("String_Node_Str",this.startValue != null ? this.startValue.toString() : "String_Node_Str",getTime());
}
Program: 4268
Project: 4268
Buggy source:
/** 
 * Parse given expression for a single cron field
 * @param expression - String
 * @return CronFieldExpression object that with interpretation of given String parameter
 */
public FieldExpression parse(String expression){
  if (!StringUtils.containsAny(expression,specialCharsMinusStar)) {
    if ("String_Node_Str".equals(expression)) {
      return new Always();
    }
 else {
      if ("String_Node_Str".equals(expression)) {
        return new QuestionMark();
      }
      return parseOn(expression);
    }
  }
 else {
    String[] array=expression.split("String_Node_Str");
    if (array.length > 1) {
      And and=new And();
      for (      String exp : array) {
        and.and(parse(exp));
      }
      return and;
    }
 else {
      array=expression.split("String_Node_Str");
      if (array.length > 1) {
        return parseBetween(array);
      }
 else {
        String[] values=expression.split("String_Node_Str");
        if (values.length == 2) {
          String value=values[1];
          return new Every(new IntegerFieldValue(Integer.parseInt(value)));
        }
 else         if (values.length == 1) {
          throw new IllegalArgumentException("String_Node_Str" + expression);
        }
 else {
          throw new IllegalArgumentException("String_Node_Str" + expression);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Parse given expression for a single cron field
 * @param expression - String
 * @return CronFieldExpression object that with interpretation of given String parameter
 */
public FieldExpression parse(String expression){
  if (!StringUtils.containsAny(expression,specialCharsMinusStar)) {
    if ("String_Node_Str".equals(expression)) {
      return new Always();
    }
 else {
      if ("String_Node_Str".equals(expression)) {
        return new QuestionMark();
      }
      return parseOn(expression);
    }
  }
 else {
    String[] array=expression.split("String_Node_Str");
    if (array.length > 1) {
      And and=new And();
      for (      String exp : array) {
        and.and(parse(exp));
      }
      return and;
    }
 else {
      array=expression.split("String_Node_Str");
      if (array.length > 1) {
        return parseBetween(array);
      }
 else {
        String[] values=expression.split("String_Node_Str");
        if (values.length == 2) {
          String start=values[0];
          String value=values[1];
          if ("String_Node_Str".equals(start.trim())) {
            return new Always(new IntegerFieldValue(Integer.parseInt(value)));
          }
 else {
            return new Every(new IntegerFieldValue(Integer.parseInt(start)),new IntegerFieldValue(Integer.parseInt(value)));
          }
        }
 else         if (values.length == 1) {
          throw new IllegalArgumentException("String_Node_Str" + expression);
        }
 else {
          throw new IllegalArgumentException("String_Node_Str" + expression);
        }
      }
    }
  }
}
Program: 4269
Project: 4269
Buggy source:
/** 
 * Issue #79: Next execution skipping valid date: 
 */
public void testNextExecution2014(){
  String crontab="String_Node_Str";
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  CronParser parser=new CronParser(cronDefinition);
  Cron cron=parser.parse(crontab);
  DateTime date=DateTime.parse("String_Node_Str");
  ExecutionTime executionTime=ExecutionTime.forCron(cron);
  assertEquals(DateTime.parse("String_Node_Str"),executionTime.nextExecution(date));
}

Fixed version (ground truth):
/** 
 * Issue #79: Next execution skipping valid date
 */
public void testNextExecution2014(){
  String crontab="String_Node_Str";
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  CronParser parser=new CronParser(cronDefinition);
  Cron cron=parser.parse(crontab);
  DateTime date=DateTime.parse("String_Node_Str");
  ExecutionTime executionTime=ExecutionTime.forCron(cron);
  assertEquals(DateTime.parse("String_Node_Str"),executionTime.nextExecution(date));
}
Program: 4270
Project: 4270
Buggy source:
private Function<Integer,Integer> bothSameStartOfRange(final int startRange,final int endRange,final WeekDay source,final WeekDay target){
  return new Function<Integer,Integer>(){
    @Override public Integer apply(    Integer integer){
      int diff=target.getMondayDoWValue() - source.getMondayDoWValue();
      int result=integer;
      if (diff == 0) {
        return integer;
      }
      if (diff < 0) {
        result=integer + diff;
        int distanceToStartRange=startRange - result;
        if (result < startRange) {
          result=endRange + 1 - distanceToStartRange;
        }
      }
      if (diff > 0) {
        result=integer + diff;
        if (result > endRange) {
          result-=endRange;
        }
      }
      return result;
    }
  }
;
}

Fixed version (ground truth):
private Function<Integer,Integer> bothSameStartOfRange(final int startRange,final int endRange,final WeekDay source,final WeekDay target){
  return new Function<Integer,Integer>(){
    @Override public Integer apply(    Integer integer){
      int diff=target.getMondayDoWValue() - source.getMondayDoWValue();
      int result=integer + diff;
      if (result < startRange) {
        result-=(startRange - endRange + 1);
      }
      if (result > endRange) {
        result-=endRange;
      }
      return result;
    }
  }
;
}
Program: 4271
Project: 4271
Buggy source:
@Override public Integer apply(Integer integer){
  int diff=target.getMondayDoWValue() - source.getMondayDoWValue();
  int result=integer;
  if (diff == 0) {
    return integer;
  }
  if (diff < 0) {
    result=integer + diff;
    int distanceToStartRange=startRange - result;
    if (result < startRange) {
      result=endRange + 1 - distanceToStartRange;
    }
  }
  if (diff > 0) {
    result=integer + diff;
    if (result > endRange) {
      result-=endRange;
    }
  }
  return result;
}

Fixed version (ground truth):
@Override public Integer apply(Integer integer){
  int diff=target.getMondayDoWValue() - source.getMondayDoWValue();
  int result=integer + diff;
  if (result < startRange) {
    result-=(startRange - endRange + 1);
  }
  if (result > endRange) {
    result-=endRange;
  }
  return result;
}
Program: 4272
Project: 4272
Buggy source:
private int generateValue(On on,int year,int month) throws NoSuchValueException {
  int time=on.getTime().getValue();
switch (on.getSpecialChar().getValue()) {
case L:
    return new DateTime(year,month,1,1,1).dayOfMonth().getMaximumValue();
case W:
  DateTime doM=new DateTime(year,month,time,1,1);
if (doM.getDayOfWeek() == 6) {
  if (time == 1) {
    return 3;
  }
  return time - 1;
}
if (doM.getDayOfWeek() == 7) {
if ((time + 1) <= doM.dayOfMonth().getMaximumValue()) {
  return time + 1;
}
}
break;
case LW:
DateTime lastDayOfMonth=new DateTime(year,month,new DateTime(year,month,1,1,1).dayOfMonth().getMaximumValue(),1,1);
int dow=lastDayOfMonth.getDayOfWeek();
int diff=dow - 5;
if (diff > 0) {
return lastDayOfMonth.minusDays(diff).dayOfMonth().get();
}
return lastDayOfMonth.dayOfMonth().get();
}
throw new NoSuchValueException();
}

Fixed version (ground truth):
private int generateValue(On on,int year,int month) throws NoSuchValueException {
  int time=on.getTime().getValue();
switch (on.getSpecialChar().getValue()) {
case L:
    return new DateTime(year,month,1,1,1).dayOfMonth().getMaximumValue();
case W:
  DateTime doM=new DateTime(year,month,time,1,1);
if (doM.getDayOfWeek() == 6) {
  if (time == 1) {
    return 3;
  }
  return time - 1;
}
if (doM.getDayOfWeek() == 7) {
if ((time + 1) <= doM.dayOfMonth().getMaximumValue()) {
  return time + 1;
}
}
return time;
case LW:
DateTime lastDayOfMonth=new DateTime(year,month,new DateTime(year,month,1,1,1).dayOfMonth().getMaximumValue(),1,1);
int dow=lastDayOfMonth.getDayOfWeek();
int diff=dow - 5;
if (diff > 0) {
return lastDayOfMonth.minusDays(diff).dayOfMonth().get();
}
return lastDayOfMonth.dayOfMonth().get();
}
throw new NoSuchValueException();
}
Program: 4273
Project: 4273
Buggy source:
/** 
 * Issue #81: MON-SUN flags are not mapped correctly to 1-7 number representations  Fixed by adding shifting function when changing monday position. Fixed by adding shifting function when changing monday position. Fixed by adding shifting function when changing monday position.
 */
@Test public void testDayOfWeekMapping(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ);
  CronParser parser=new CronParser(cronDefinition);
  DateTime fridayMorning=new DateTime(2016,4,22,0,0,0,DateTimeZone.UTC);
  ExecutionTime numberExec=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ExecutionTime nameExec=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  assertEquals("String_Node_Str",numberExec.nextExecution(fridayMorning),nameExec.nextExecution(fridayMorning));
}

Fixed version (ground truth):
/** 
 * Issue #81: MON-SUN flags are not mapped correctly to 1-7 number representations  Fixed by adding shifting function when changing monday position.
 */
@Test public void testDayOfWeekMapping(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ);
  CronParser parser=new CronParser(cronDefinition);
  DateTime fridayMorning=new DateTime(2016,4,22,0,0,0,DateTimeZone.UTC);
  ExecutionTime numberExec=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ExecutionTime nameExec=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  assertEquals("String_Node_Str",numberExec.nextExecution(fridayMorning),nameExec.nextExecution(fridayMorning));
}
Program: 4274
Project: 4274
Buggy source:
private DateTime initDateTime(int years,int monthsOfYear,int dayOfMonth,int hoursOfDay,int minutesOfHour,int secondsOfMinute,DateTimeZone timeZone){
  return new DateTime(0,1,1,0,0,0,timeZone).plusYears(years).plusMonths(monthsOfYear - 1).plusDays(dayOfMonth - 1).plusHours(hoursOfDay).plusMinutes(minutesOfHour).plusSeconds(secondsOfMinute);
}

Fixed version (ground truth):
private DateTime initDateTime(int years,int monthsOfYear,int dayOfMonth,int hoursOfDay,int minutesOfHour,int secondsOfMinute,DateTimeZone timeZone){
  DateTime date=new DateTime(0,1,1,0,0,0,timeZone).plusYears(years).plusMonths(monthsOfYear - 1).plusDays(dayOfMonth - 1).plusHours(hoursOfDay).plusMinutes(minutesOfHour).plusSeconds(secondsOfMinute);
  if (date.getSecondOfMinute() != secondsOfMinute) {
    date=date.plusSeconds(secondsOfMinute - date.getSecondOfMinute());
  }
  if (date.getMinuteOfHour() != minutesOfHour) {
    date=date.plusMinutes(minutesOfHour - date.getMinuteOfHour());
  }
  if (date.getHourOfDay() != hoursOfDay) {
    date=date.plusHours(hoursOfDay - date.getHourOfDay());
  }
  if (date.getDayOfMonth() != dayOfMonth) {
    date=date.plusDays(dayOfMonth - date.getDayOfMonth());
  }
  if (date.getMonthOfYear() != monthsOfYear) {
    date=date.plusMonths(monthsOfYear - date.getMonthOfYear());
  }
  if (date.getYear() != years) {
    date=date.plusYears(years - date.getYear());
  }
  return date;
}
Program: 4275
Project: 4275
Buggy source:
@Test public void testDayLightSavingsSwitch(){
  try {
    String expression="String_Node_Str";
    CronParser parser=new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
    Cron cron=parser.parse(expression);
    DateTime prevRun=new DateTime(new SimpleDateFormat("String_Node_Str").parseObject("String_Node_Str"));
    ExecutionTime executionTime=ExecutionTime.forCron(cron);
    DateTime nextRun=executionTime.nextExecution(prevRun);
    assertEquals("String_Node_Str",3,nextRun.getHourOfDay());
    assertEquals("String_Node_Str",0,nextRun.getMinuteOfHour());
    nextRun=nextRun.plusMinutes(1);
    nextRun=executionTime.nextExecution(nextRun);
    assertEquals("String_Node_Str",3,nextRun.getHourOfDay());
    assertEquals("String_Node_Str",2,nextRun.getMinuteOfHour());
    prevRun=new DateTime(new SimpleDateFormat("String_Node_Str").parseObject("String_Node_Str"));
    nextRun=executionTime.nextExecution(prevRun);
    assertEquals("String_Node_Str",nextRun.getHourOfDay(),0);
    assertEquals("String_Node_Str",nextRun.getMinuteOfHour(),2);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testDayLightSavingsSwitch(){
  try {
    String expression="String_Node_Str";
    CronParser parser=new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
    Cron cron=parser.parse(expression);
    DateTimeFormatter formatter=DateTimeFormat.forPattern("String_Node_Str").withZone(DateTimeZone.forID("String_Node_Str"));
    DateTime prevRun=new DateTime(formatter.parseDateTime("String_Node_Str"));
    ExecutionTime executionTime=ExecutionTime.forCron(cron);
    DateTime nextRun=executionTime.nextExecution(prevRun);
    assertEquals("String_Node_Str",3,nextRun.getHourOfDay());
    assertEquals("String_Node_Str",0,nextRun.getMinuteOfHour());
    nextRun=nextRun.plusMinutes(1);
    nextRun=executionTime.nextExecution(nextRun);
    assertEquals("String_Node_Str",3,nextRun.getHourOfDay());
    assertEquals("String_Node_Str",2,nextRun.getMinuteOfHour());
    prevRun=new DateTime(new SimpleDateFormat("String_Node_Str").parseObject("String_Node_Str"));
    nextRun=executionTime.nextExecution(prevRun);
    assertEquals("String_Node_Str",nextRun.getHourOfDay(),0);
    assertEquals("String_Node_Str",nextRun.getMinuteOfHour(),2);
  }
 catch (  Exception e) {
    fail("String_Node_Str" + e.getMessage());
  }
}
Program: 4276
Project: 4276
Buggy source:
@Override public FieldValue apply(FieldValue fieldValue){
  if (fieldValue instanceof IntegerFieldValue) {
    return new IntegerFieldValue(ConstantsMapper.weekDayMapping(sourceDef.getMondayDoWValue(),targetDef.getMondayDoWValue(),((IntegerFieldValue)fieldValue).getValue()));
  }
 else {
    return fieldValue;
  }
}

Fixed version (ground truth):
@Override public CronField apply(final CronField field){
  FieldExpression expression=field.getExpression();
  FieldExpression dest=expression;
  if (expression instanceof QuestionMark) {
    if (!targetDef.getConstraints().getSpecialChars().contains(SpecialChar.QUESTION_MARK)) {
      dest=new Always();
    }
  }
  return new CronField(CronFieldName.DAY_OF_MONTH,dest,targetDef.getConstraints());
}
Program: 4277
Project: 4277
Buggy source:
@VisibleForTesting static Function<CronField,CronField> dayOfWeekMapping(final DayOfWeekFieldDefinition sourceDef,final DayOfWeekFieldDefinition targetDef){
  return new Function<CronField,CronField>(){
    @Override public CronField apply(    final CronField field){
      FieldExpression expression=field.getExpression().accept(new ValueMappingFieldExpressionVisitor(new Function<FieldValue,FieldValue>(){
        @Override public FieldValue apply(        FieldValue fieldValue){
          if (fieldValue instanceof IntegerFieldValue) {
            return new IntegerFieldValue(ConstantsMapper.weekDayMapping(sourceDef.getMondayDoWValue(),targetDef.getMondayDoWValue(),((IntegerFieldValue)fieldValue).getValue()));
          }
 else {
            return fieldValue;
          }
        }
      }
));
      return new CronField(CronFieldName.DAY_OF_WEEK,expression,targetDef.getConstraints());
    }
  }
;
}

Fixed version (ground truth):
@VisibleForTesting static Function<CronField,CronField> dayOfWeekMapping(final DayOfWeekFieldDefinition sourceDef,final DayOfWeekFieldDefinition targetDef){
  return new Function<CronField,CronField>(){
    @Override public CronField apply(    final CronField field){
      FieldExpression expression=field.getExpression();
      FieldExpression dest=null;
      dest=expression.accept(new ValueMappingFieldExpressionVisitor(new Function<FieldValue,FieldValue>(){
        @Override public FieldValue apply(        FieldValue fieldValue){
          if (fieldValue instanceof IntegerFieldValue) {
            return new IntegerFieldValue(ConstantsMapper.weekDayMapping(sourceDef.getMondayDoWValue(),targetDef.getMondayDoWValue(),((IntegerFieldValue)fieldValue).getValue()));
          }
          return fieldValue;
        }
      }
));
      if (expression instanceof QuestionMark) {
        if (!targetDef.getConstraints().getSpecialChars().contains(SpecialChar.QUESTION_MARK)) {
          dest=new Always();
        }
      }
      return new CronField(CronFieldName.DAY_OF_WEEK,dest,targetDef.getConstraints());
    }
  }
;
}
Program: 4278
Project: 4278
Buggy source:
/** 
 * Constructor
 * @param from - source CronDefinition;if null a NullPointerException will be raised
 * @param to - target CronDefinition;if null a NullPointerException will be raised
 */
public CronMapper(CronDefinition from,CronDefinition to){
  Validate.notNull(from,"String_Node_Str");
  this.to=Validate.notNull(to,"String_Node_Str");
  mappings=Maps.newHashMap();
  buildMappings(from,to);
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param from - source CronDefinition;if null a NullPointerException will be raised
 * @param to - target CronDefinition;if null a NullPointerException will be raised
 */
public CronMapper(CronDefinition from,CronDefinition to,Function<Cron,Cron> cronRules){
  Validate.notNull(from,"String_Node_Str");
  this.to=Validate.notNull(to,"String_Node_Str");
  this.cronRules=Validate.notNull(cronRules,"String_Node_Str");
  mappings=Maps.newHashMap();
  buildMappings(from,to);
}
Program: 4279
Project: 4279
Buggy source:
/** 
 * Maps given cron to target cron definition
 * @param cron - Instance to be mapped;if null a NullPointerException will be raised
 * @return new Cron instance, never null;
 */
public Cron map(Cron cron){
  Validate.notNull(cron,"String_Node_Str");
  List<CronField> fields=Lists.newArrayList();
  for (  CronFieldName name : CronFieldName.values()) {
    if (mappings.containsKey(name)) {
      fields.add(mappings.get(name).apply(cron.retrieve(name)));
    }
  }
  return new Cron(to,fields);
}

Fixed version (ground truth):
/** 
 * Maps given cron to target cron definition
 * @param cron - Instance to be mapped;if null a NullPointerException will be raised
 * @return new Cron instance, never null;
 */
public Cron map(Cron cron){
  Validate.notNull(cron,"String_Node_Str");
  List<CronField> fields=Lists.newArrayList();
  for (  CronFieldName name : CronFieldName.values()) {
    if (mappings.containsKey(name)) {
      fields.add(mappings.get(name).apply(cron.retrieve(name)));
    }
  }
  return cronRules.apply(new Cron(to,fields)).validate();
}
Program: 4281
Project: 4281
Buggy source:
public Cron validate(){
  for (  CronConstraint constraint : getCronDefinition().getCronConstraints()) {
    if (!constraint.validate(this)) {
      throw new RuntimeException(String.format("String_Node_Str",asString(),constraint.getDescription()));
    }
  }
  for (  Map.Entry<CronFieldName,CronField> field : retrieveFieldsAsMap().entrySet()) {
    CronFieldName fieldName=field.getKey();
    field.getValue().getExpression().accept(new ValidationFieldExpressionVisitor(getCronDefinition().getFieldDefinition(fieldName).getConstraints()));
  }
  return this;
}

Fixed version (ground truth):
public Cron validate(){
  for (  Map.Entry<CronFieldName,CronField> field : retrieveFieldsAsMap().entrySet()) {
    CronFieldName fieldName=field.getKey();
    field.getValue().getExpression().accept(new ValidationFieldExpressionVisitor(getCronDefinition().getFieldDefinition(fieldName).getConstraints(),cronDefinition.isStrictRanges()));
  }
  for (  CronConstraint constraint : getCronDefinition().getCronConstraints()) {
    if (!constraint.validate(this)) {
      throw new IllegalArgumentException(String.format("String_Node_Str",asString(),constraint.getDescription()));
    }
  }
  return this;
}
Program: 4282
Project: 4282
Buggy source:
/** 
 * Constructor
 * @param fieldDefinitions - list with field definitions. Must not be null or empty.Throws a NullPointerException if a null values is received Throws an IllegalArgumentException if an empty list is received
 * @param lastFieldOptional - boolean, value stating if last field is optional
 */
public CronDefinition(List<FieldDefinition> fieldDefinitions,Set<CronConstraint> cronConstraints,boolean lastFieldOptional){
  Validate.notNull(fieldDefinitions,"String_Node_Str");
  Validate.notNull(cronConstraints,"String_Node_Str");
  Validate.notEmpty(fieldDefinitions,"String_Node_Str");
  if (lastFieldOptional) {
    Validate.isTrue(fieldDefinitions.size() > 1,"String_Node_Str");
  }
  this.fieldDefinitions=Maps.newHashMap();
  for (  FieldDefinition field : fieldDefinitions) {
    this.fieldDefinitions.put(field.getFieldName(),field);
  }
  this.cronConstraints=Collections.unmodifiableSet(cronConstraints);
  this.lastFieldOptional=lastFieldOptional;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param fieldDefinitions - list with field definitions. Must not be null or empty.Throws a NullPointerException if a null values is received Throws an IllegalArgumentException if an empty list is received
 * @param lastFieldOptional - boolean, value stating if last field is optional
 */
public CronDefinition(List<FieldDefinition> fieldDefinitions,Set<CronConstraint> cronConstraints,boolean lastFieldOptional,boolean strictRanges){
  Validate.notNull(fieldDefinitions,"String_Node_Str");
  Validate.notNull(cronConstraints,"String_Node_Str");
  Validate.notEmpty(fieldDefinitions,"String_Node_Str");
  if (lastFieldOptional) {
    Validate.isTrue(fieldDefinitions.size() > 1,"String_Node_Str");
  }
  this.fieldDefinitions=Maps.newHashMap();
  for (  FieldDefinition field : fieldDefinitions) {
    this.fieldDefinitions.put(field.getFieldName(),field);
  }
  this.cronConstraints=Collections.unmodifiableSet(cronConstraints);
  this.lastFieldOptional=lastFieldOptional;
  this.strictRanges=strictRanges;
}
Program: 4283
Project: 4283
Buggy source:
/** 
 * Creates a new CronDefinition instance with provided field definitions
 * @return returns CronDefinition instance, never null
 */
public CronDefinition instance(){
  Set<CronConstraint> validations=new HashSet<CronConstraint>();
  validations.addAll(cronConstraints);
  return new CronDefinition(Lists.newArrayList(this.fields.values()),validations,lastFieldOptional);
}

Fixed version (ground truth):
/** 
 * Creates a new CronDefinition instance with provided field definitions
 * @return returns CronDefinition instance, never null
 */
public CronDefinition instance(){
  Set<CronConstraint> validations=new HashSet<CronConstraint>();
  validations.addAll(cronConstraints);
  return new CronDefinition(Lists.newArrayList(this.fields.values()),validations,lastFieldOptional,enforceStrictRanges);
}
Program: 4284
Project: 4284
Buggy source:
/** 
 * Creates CronDefinition instance matching cron4j specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition cron4j(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().and().withMonth().and().withDayOfWeek().withValidRange(0,6).withMondayDoWValue(1).and().instance();
}

Fixed version (ground truth):
/** 
 * Creates CronDefinition instance matching cron4j specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition cron4j(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().and().withMonth().and().withDayOfWeek().withValidRange(0,6).withMondayDoWValue(1).and().enforceStrictRanges().instance();
}
Program: 4285
Project: 4285
Buggy source:
/** 
 * Creates CronDefinition instance matching unix crontab specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition unixCrontab(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().and().withMonth().and().withDayOfWeek().withValidRange(0,7).withMondayDoWValue(1).withIntMapping(7,0).and().instance();
}

Fixed version (ground truth):
/** 
 * Creates CronDefinition instance matching unix crontab specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition unixCrontab(){
  return CronDefinitionBuilder.defineCron().withMinutes().and().withHours().and().withDayOfMonth().and().withMonth().and().withDayOfWeek().withValidRange(0,7).withMondayDoWValue(1).withIntMapping(7,0).and().enforceStrictRanges().instance();
}
Program: 4286
Project: 4286
Buggy source:
/** 
 * Constructor. lastFieldOptional is defined false.
 */
private CronDefinitionBuilder(){
  fields=Maps.newHashMap();
  cronConstraints=Sets.newHashSet();
  lastFieldOptional=false;
}

Fixed version (ground truth):
/** 
 * Constructor. lastFieldOptional is defined false.
 */
private CronDefinitionBuilder(){
  fields=Maps.newHashMap();
  cronConstraints=Sets.newHashSet();
  lastFieldOptional=false;
  enforceStrictRanges=false;
}
Program: 4287
Project: 4287
Buggy source:
/** 
 * Performs action on QuestionMark instance
 * @param questionMark - QuestionMark instance, never null
 * @return QuestionMark instance, never null
 */
QuestionMark visit(QuestionMark questionMark);

Fixed version (ground truth):
/** 
 * Performs action on QuestionMark instance
 * @param questionMark - QuestionMark instance, never null
 * @return FieldExpression instance, never null
 */
FieldExpression visit(QuestionMark questionMark);
Program: 4288
Project: 4288
Buggy source:
@Override public int generateNextValue(int reference) throws NoSuchValueException {
  Every every=(Every)expression;
  int period=every.getTime().getValue();
  return reference + period;
}

Fixed version (ground truth):
@Override public int generateNextValue(int reference) throws NoSuchValueException {
  if (reference >= expression.getConstraints().getEndRange()) {
    throw new NoSuchValueException();
  }
  Every every=(Every)expression;
  int referenceWithoutOffset=reference - offset();
  int period=every.getTime().getValue();
  int remainder=referenceWithoutOffset % period;
  int next=reference + (period - remainder);
  if (next < expression.getConstraints().getStartRange()) {
    return expression.getConstraints().getStartRange();
  }
  if (next > expression.getConstraints().getEndRange()) {
    throw new NoSuchValueException();
  }
  return next;
}
Program: 4289
Project: 4289
Buggy source:
@Test() public void testGenerateNextValue() throws Exception {
  for (int j=1; j <= 10; j++) {
    int value=time * j - 1 - ((int)(2 * Math.random()));
    assertEquals(j * time,fieldValueGenerator.generateNextValue(value));
  }
}

Fixed version (ground truth):
@Test() public void testGenerateNextValue() throws Exception {
  for (int j=1; j <= 10; j++) {
    int value=time * j - (1 + ((int)(2 * Math.random())));
    System.out.println(String.format("String_Node_Str",value,j * time,fieldValueGenerator.generateNextValue(value)));
    assertEquals(j * time,fieldValueGenerator.generateNextValue(value));
  }
}
Program: 4290
Project: 4290
Buggy source:
/** 
 * Issue #59: Incorrect next execution time for "month" and "day of week" Considers Month in range 0-11 instead of 1-12
 */
@Test public void testCorrectMonthScaleForNextExecution1(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  CronParser parser=new CronParser(cronDefinition);
  String crontab="String_Node_Str";
  Cron cron=parser.parse(crontab);
  ExecutionTime executionTime=ExecutionTime.forCron(cron);
  DateTime scanTime=DateTime.parse("String_Node_Str");
  DateTime nextExecutionTime=executionTime.nextExecution(scanTime);
  System.out.println(String.format("String_Node_Str",scanTime,nextExecutionTime));
  assertNotNull(null);
}

Fixed version (ground truth):
/** 
 * Issue #59: Incorrect next execution time for "month" and "day of week" Considers Month in range 0-11 instead of 1-12
 */
@Test public void testCorrectMonthScaleForNextExecution1(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  CronParser parser=new CronParser(cronDefinition);
  String crontab="String_Node_Str";
  Cron cron=parser.parse(crontab);
  ExecutionTime executionTime=ExecutionTime.forCron(cron);
  DateTime scanTime=DateTime.parse("String_Node_Str");
  DateTime nextExecutionTime=executionTime.nextExecution(scanTime);
  assertEquals(DateTime.parse("String_Node_Str"),nextExecutionTime);
}
Program: 4291
Project: 4291
Buggy source:
/** 
 * Issue #59: Incorrect next execution time for "day of month" in "time" situation dom "* / 4" should means 1, 5, 9, 13, 17th... of month instead of 4, 8, 12, 16th...
 */
@Test public void testCorrectMonthScaleForNextExecution2(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  CronParser parser=new CronParser(cronDefinition);
  String crontab="String_Node_Str";
  Cron cron=parser.parse(crontab);
  ExecutionTime executionTime=ExecutionTime.forCron(cron);
  DateTime scanTime=DateTime.parse("String_Node_Str");
  DateTime nextExecutionTime=executionTime.nextExecution(scanTime);
  assertEquals(DateTime.parse("String_Node_Str"),nextExecutionTime);
}

Fixed version (ground truth):
/** 
 * Issue #59: Incorrect next execution time for "day of month" in "time" situation dom "* / 4" should mean 1, 5, 9, 13, 17th... of month instead of 4, 8, 12, 16th...
 */
@Test public void testCorrectMonthScaleForNextExecution2(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  CronParser parser=new CronParser(cronDefinition);
  String crontab="String_Node_Str";
  Cron cron=parser.parse(crontab);
  ExecutionTime executionTime=ExecutionTime.forCron(cron);
  DateTime scanTime=DateTime.parse("String_Node_Str");
  DateTime nextExecutionTime=executionTime.nextExecution(scanTime);
  assertEquals(DateTime.parse("String_Node_Str"),nextExecutionTime);
}
Program: 4292
Project: 4292
Buggy source:
private DateTime initDateTime(int years,int monthsOfYear,int dayOfMonth,int hoursOfDay,int minutesOfHour,int secondsOfMinute){
  return new DateTime(0,1,1,0,0,0).plusYears(years).plusMonths(monthsOfYear - 1).plusDays(dayOfMonth - 1).plusHours(hoursOfDay).plusMinutes(minutesOfHour).plusSeconds(secondsOfMinute);
}

Fixed version (ground truth):
private DateTime initDateTime(int years,int monthsOfYear,int dayOfMonth,int hoursOfDay,int minutesOfHour,int secondsOfMinute,DateTimeZone timeZone){
  return new DateTime(0,1,1,0,0,0,timeZone).plusYears(years).plusMonths(monthsOfYear - 1).plusDays(dayOfMonth - 1).plusHours(hoursOfDay).plusMinutes(minutesOfHour).plusSeconds(secondsOfMinute);
}
Program: 4295
Project: 4295
Buggy source:
/** 
 * Issue #38: every 2 min schedule doesn't roll over to next hour
 */
public void testEveryTwoMinRollsOverHour(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  Cron cron=new CronParser(cronDefinition).parse("String_Node_Str");
  ExecutionTime executionTime=ExecutionTime.forCron(cron);
  DateTime time=DateTime.parse("String_Node_Str");
  time=time.toDateTime(DateTime.now().getZone());
  DateTime next=executionTime.nextExecution(time);
  DateTime shouldBeInNextHour=executionTime.nextExecution(next);
  assertEquals(next.plusMinutes(2),shouldBeInNextHour);
}

Fixed version (ground truth):
/** 
 * Issue #38: every 2 min schedule doesn't roll over to next hour
 */
@Test public void testEveryTwoMinRollsOverHour(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  Cron cron=new CronParser(cronDefinition).parse("String_Node_Str");
  ExecutionTime executionTime=ExecutionTime.forCron(cron);
  DateTime time=DateTime.parse("String_Node_Str");
  time=time.toDateTime(DateTime.now().getZone());
  DateTime next=executionTime.nextExecution(time);
  DateTime shouldBeInNextHour=executionTime.nextExecution(next);
  assertEquals(next.plusMinutes(2),shouldBeInNextHour);
}
Program: 4296
Project: 4296
Buggy source:
/** 
 * We return same reference value if matches or previous one if does not match. Then we start applying shifts. This way we ensure same value is returned if no shift is requested.
 * @param reference - reference value
 * @param shiftsToApply - shifts to apply
 * @return NearestValue instance, never null. Holds information on nearest (backward) value and shifts performed.
 */
@VisibleForTesting NearestValue getNearestBackwardValue(int reference,int shiftsToApply){
  List<Integer> values=new ArrayList<Integer>(this.values);
  Collections.reverse(values);
  int index=0;
  boolean foundSmaller=false;
  if (!values.contains(reference)) {
    for (    Integer value : values) {
      if (value < reference) {
        index=values.indexOf(value);
        shiftsToApply--;
        foundSmaller=true;
        break;
      }
    }
    if (!foundSmaller) {
      shiftsToApply++;
    }
  }
 else {
    index=values.indexOf(reference);
  }
  AtomicInteger shift=new AtomicInteger(0);
  int value=values.get(index);
  for (int j=0; j < shiftsToApply; j++) {
    value=getValueFromList(values,index + 1,shift);
    index=values.indexOf(value);
  }
  return new NearestValue(value,shift.get());
}

Fixed version (ground truth):
/** 
 * We return same reference value if matches or previous one if does not match. Then we start applying shifts. This way we ensure same value is returned if no shift is requested.
 * @param reference - reference value
 * @param shiftsToApply - shifts to apply
 * @return NearestValue instance, never null. Holds information on nearest (backward) value and shifts performed.
 */
@VisibleForTesting NearestValue getNearestBackwardValue(int reference,int shiftsToApply){
  List<Integer> values=new ArrayList<Integer>(this.values);
  Collections.reverse(values);
  int index=0;
  boolean foundSmaller=false;
  AtomicInteger shift=new AtomicInteger(0);
  if (!values.contains(reference)) {
    for (    Integer value : values) {
      if (value < reference) {
        index=values.indexOf(value);
        shiftsToApply--;
        foundSmaller=true;
        break;
      }
    }
    if (!foundSmaller) {
      shift.incrementAndGet();
    }
  }
 else {
    index=values.indexOf(reference);
  }
  int value=values.get(index);
  for (int j=0; j < shiftsToApply; j++) {
    value=getValueFromList(values,index + 1,shift);
    index=values.indexOf(value);
  }
  return new NearestValue(value,shift.get());
}
Program: 4297
Project: 4297
Buggy source:
@Test public void testGetPreviousValue() throws Exception {
  assertResult(LIST_START_VALUE,0,timeNode.getPreviousValue(LIST_START_VALUE,0));
  assertResult(LIST_MEDIUM_VALUE,0,timeNode.getPreviousValue(LIST_MEDIUM_VALUE,0));
  assertResult(LIST_END_VALUE,0,timeNode.getPreviousValue(LIST_END_VALUE,0));
  assertResult(LIST_END_VALUE,1,timeNode.getPreviousValue(LIST_START_VALUE,1));
  assertResult(LIST_START_VALUE,0,timeNode.getPreviousValue(LIST_MEDIUM_VALUE,1));
  assertResult(LIST_MEDIUM_VALUE,0,timeNode.getPreviousValue(LIST_END_VALUE,1));
  assertResult(LIST_END_VALUE,1,timeNode.getPreviousValue(LIST_MEDIUM_VALUE,2));
}

Fixed version (ground truth):
@Test public void testGetPreviousValue() throws Exception {
  assertResult(LIST_START_VALUE,0,timeNode.getPreviousValue(LIST_START_VALUE,0));
  assertResult(LIST_MEDIUM_VALUE,0,timeNode.getPreviousValue(LIST_MEDIUM_VALUE,0));
  assertResult(LIST_END_VALUE,0,timeNode.getPreviousValue(LIST_END_VALUE,0));
  assertResult(LIST_END_VALUE,1,timeNode.getPreviousValue(LIST_START_VALUE,1));
  assertResult(LIST_START_VALUE,0,timeNode.getPreviousValue(LIST_MEDIUM_VALUE,1));
  assertResult(LIST_MEDIUM_VALUE,0,timeNode.getPreviousValue(LIST_END_VALUE,1));
  assertResult(LIST_END_VALUE,1,timeNode.getPreviousValue(LIST_MEDIUM_VALUE,2));
  assertResult(LIST_MEDIUM_VALUE,0,timeNode.getPreviousValue(HIGH_INTERMEDIATE_VALUE,1));
  assertResult(LIST_END_VALUE,1,timeNode.getPreviousValue(LOW_INTERMEDIATE_VALUE,0));
}
Program: 4299
Project: 4299
Buggy source:
public static FieldValueGenerator createDayOfWeekValueGeneratorInstance(CronField cronField,int year,int month,WeekDay mondayDoWValue){
  FieldExpression fieldExpression=cronField.getExpression();
  if (fieldExpression instanceof On) {
    return new OnDayOfWeekValueGenerator(cronField,year,month,mondayDoWValue);
  }
  if (fieldExpression instanceof Between) {
    return new BetweenDayOfWeekValueGenerator(cronField,year,month,mondayDoWValue);
  }
  return forCronField(cronField);
}

Fixed version (ground truth):
public static FieldValueGenerator createDayOfWeekValueGeneratorInstance(CronField cronField,int year,int month,WeekDay mondayDoWValue){
  FieldExpression fieldExpression=cronField.getExpression();
  if (fieldExpression instanceof On) {
    return new OnDayOfWeekValueGenerator(cronField,year,month,mondayDoWValue);
  }
  if (fieldExpression instanceof Between) {
    return new BetweenDayOfWeekValueGenerator(cronField,year,month,mondayDoWValue);
  }
  if (fieldExpression instanceof And) {
    return new AndDayOfWeekValueGenerator(cronField,year,month,mondayDoWValue);
  }
  return forCronField(cronField);
}
Program: 4300
Project: 4300
Buggy source:
/** 
 * Parse given expression for a single cron field
 * @param expression - String
 * @return CronFieldExpression object that with interpretation of given String parameter
 */
public FieldExpression parse(String expression){
  if (!StringUtils.containsAny(expression,specialCharsMinusStar)) {
    if ("String_Node_Str".equals(expression)) {
      return new Always(constraints);
    }
 else {
      constraints.validateAllCharsValid(expression);
      return parseOn(expression);
    }
  }
 else {
    String[] array=expression.split("String_Node_Str");
    if (array.length > 1) {
      And and=new And();
      for (      String exp : array) {
        and.and(parse(exp));
      }
      return and;
    }
 else {
      array=expression.split("String_Node_Str");
      if (array.length > 1) {
        return parseBetween(array);
      }
 else {
        String value=expression.split("String_Node_Str")[1];
        constraints.validateAllCharsValid(value);
        return new Every(constraints,new IntegerFieldValue(Integer.parseInt(value)));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Parse given expression for a single cron field
 * @param expression - String
 * @return CronFieldExpression object that with interpretation of given String parameter
 */
public FieldExpression parse(String expression){
  if (!StringUtils.containsAny(expression,specialCharsMinusStar)) {
    if ("String_Node_Str".equals(expression)) {
      return new Always(constraints);
    }
 else {
      return parseOn(expression);
    }
  }
 else {
    String[] array=expression.split("String_Node_Str");
    if (array.length > 1) {
      And and=new And();
      for (      String exp : array) {
        and.and(parse(exp));
      }
      return and;
    }
 else {
      array=expression.split("String_Node_Str");
      if (array.length > 1) {
        return parseBetween(array);
      }
 else {
        String value=expression.split("String_Node_Str")[1];
        constraints.validateAllCharsValid(value);
        return new Every(constraints,new IntegerFieldValue(Integer.parseInt(value)));
      }
    }
  }
}
Program: 4301
Project: 4301
Buggy source:
private Between parseBetween(String[] array){
  if (array[1].contains("String_Node_Str")) {
    String[] every=array[1].split("String_Node_Str");
    return new Between(constraints,map(constraints,array[0]),map(constraints,every[0]),mapToIntegerFieldValue(every[1]));
  }
 else {
    String from=array[0];
    String to=array[1];
    constraints.validateAllCharsValid(from);
    constraints.validateAllCharsValid(to);
    return new Between(constraints,map(constraints,from),map(constraints,to));
  }
}

Fixed version (ground truth):
private Between parseBetween(String[] array){
  if (array[1].contains("String_Node_Str")) {
    String[] every=array[1].split("String_Node_Str");
    return new Between(constraints,map(constraints,array[0]),map(constraints,every[0]),mapToIntegerFieldValue(every[1]));
  }
 else {
    String from=array[0];
    String to=array[1];
    return new Between(constraints,map(constraints,from),map(constraints,to));
  }
}
Program: 4302
Project: 4302
Buggy source:
private On parseOn(String exp){
  constraints.validateAllCharsValid(exp);
  SpecialCharFieldValue specialChar=new SpecialCharFieldValue(SpecialChar.NONE);
  IntegerFieldValue nth=new IntegerFieldValue(-1);
  IntegerFieldValue time=new IntegerFieldValue(-1);
  String expression=exp;
  if (exp.contains("String_Node_Str")) {
    specialChar=new SpecialCharFieldValue(SpecialChar.HASH);
    String[] array=exp.split("String_Node_Str");
    nth=mapToIntegerFieldValue(array[1]);
    if (array[0].isEmpty()) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    expression=array[0];
  }
  if (exp.contains("String_Node_Str")) {
    specialChar=new SpecialCharFieldValue(SpecialChar.LW);
    exp=exp.replace("String_Node_Str","String_Node_Str");
    if ("String_Node_Str".equals(exp)) {
      expression=null;
    }
 else {
      expression=exp;
    }
  }
  if (exp.contains("String_Node_Str")) {
    specialChar=new SpecialCharFieldValue(SpecialChar.L);
    exp=exp.replace("String_Node_Str","String_Node_Str");
    if ("String_Node_Str".equals(exp)) {
      expression=null;
    }
 else {
      expression=exp;
    }
  }
  if (exp.contains("String_Node_Str")) {
    specialChar=new SpecialCharFieldValue(SpecialChar.W);
    expression=exp.replace("String_Node_Str","String_Node_Str");
  }
  constraints.validateSpecialCharAllowed(specialChar.getValue());
  if (expression != null) {
    return new On(constraints,mapToIntegerFieldValue(expression),specialChar,nth);
  }
 else {
    return new On(constraints,time,specialChar,nth);
  }
}

Fixed version (ground truth):
private On parseOn(String exp){
  constraints.validateAllCharsValid(exp);
  if (exp.contains("String_Node_Str")) {
    return parseOnWithHash(exp);
  }
  if (exp.contains("String_Node_Str")) {
    return parseOnWithLW(exp);
  }
  if (lPattern.matcher(exp).find() || exp.equalsIgnoreCase("String_Node_Str")) {
    return parseOnWithL(exp);
  }
  if (wPattern.matcher(exp).find()) {
    return parseOnWithW(exp);
  }
  return new On(constraints,mapToIntegerFieldValue(exp),new SpecialCharFieldValue(SpecialChar.NONE),new IntegerFieldValue(-1));
}