nus-yam/ex-repair huggingface dataset:
Program: 4303
Project: 4303
Buggy source:
/** 
 * Issue #27: single day of week string mapping is valid
 */
public void testDayOfWeekMappingIsValid(){
  for (  String dow : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) {
    String expression=String.format("String_Node_Str",dow);
    assertTrue(String.format("String_Node_Str",expression),validator.isValid(expression));
  }
}

Fixed version (ground truth):
/** 
 * Issue #27: single day of week string mapping is valid
 */
@Test public void testDayOfWeekMappingIsValid(){
  for (  String dow : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"}) {
    String expression=String.format("String_Node_Str",dow);
    assertTrue(String.format("String_Node_Str",expression),validator.isValid(expression));
  }
}
Program: 4304
Project: 4304
Buggy source:
/** 
 * Issue #27: single month string mapping is valid
 */
public void testSingleMonthMappingIsValid(){
  DateTime date=new DateTime(2015,1,1,1,1);
  for (int j=0; j < 12; j++) {
    String expression=String.format("String_Node_Str",date.plusMonths(j).toString("String_Node_Str",Locale.US).toUpperCase());
    assertTrue(String.format("String_Node_Str",expression),validator.isValid(expression));
  }
}

Fixed version (ground truth):
/** 
 * Issue #27: single month string mapping is valid
 */
@Test public void testSingleMonthMappingIsValid(){
  DateTime date=new DateTime(2015,1,1,1,1);
  for (int j=0; j < 12; j++) {
    String expression=String.format("String_Node_Str",date.plusMonths(j).toString("String_Node_Str",Locale.US).toUpperCase());
    assertTrue(String.format("String_Node_Str",expression),validator.isValid(expression));
  }
}
Program: 4305
Project: 4305
Buggy source:
/** 
 * Provide description for day of month
 * @param fields - fields to describe;
 * @return description - String
 */
private String describeDayOfMonth(Map<CronFieldName,CronField> fields){
  return String.format(DescriptionStrategyFactory.daysOfMonthInstance(bundle,fields.containsKey(CronFieldName.DAY_OF_MONTH) ? fields.get(CronFieldName.DAY_OF_MONTH).getExpression() : null).describe(),bundle.getString("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Provide description for day of month
 * @param fields - fields to describe;
 * @return description - String
 */
private String describeDayOfMonth(Map<CronFieldName,CronField> fields){
  String description=DescriptionStrategyFactory.daysOfMonthInstance(bundle,fields.containsKey(CronFieldName.DAY_OF_MONTH) ? fields.get(CronFieldName.DAY_OF_MONTH).getExpression() : null).describe();
  return addTimeExpressions(description,bundle.getString("String_Node_Str"),bundle.getString("String_Node_Str"));
}
Program: 4306
Project: 4306
Buggy source:
/** 
 * Provide description for month
 * @param fields - fields to describe;
 * @return description - String
 */
private String describeMonth(Map<CronFieldName,CronField> fields){
  return String.format(DescriptionStrategyFactory.monthsInstance(bundle,fields.containsKey(CronFieldName.MONTH) ? fields.get(CronFieldName.MONTH).getExpression() : null).describe(),bundle.getString("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Provide description for month
 * @param fields - fields to describe;
 * @return description - String
 */
private String describeMonth(Map<CronFieldName,CronField> fields){
  String description=DescriptionStrategyFactory.monthsInstance(bundle,fields.containsKey(CronFieldName.MONTH) ? fields.get(CronFieldName.MONTH).getExpression() : null).describe();
  return addTimeExpressions(description,bundle.getString("String_Node_Str"),bundle.getString("String_Node_Str"));
}
Program: 4307
Project: 4307
Buggy source:
/** 
 * Creates CronDefinition instance matching quartz specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition quartz(){
  return CronDefinitionBuilder.defineCron().withSeconds().and().withMinutes().and().withHours().and().withDayOfMonth().supportsHash().supportsL().supportsW().and().withMonth().and().withDayOfWeek().withValidRange(1,7).withMondayDoWValue(2).supportsHash().supportsL().supportsW().and().withYear().withValidRange(1970,2099).and().lastFieldOptional().instance();
}

Fixed version (ground truth):
/** 
 * Creates CronDefinition instance matching quartz specification;
 * @return CronDefinition instance, never null;
 */
private static CronDefinition quartz(){
  return CronDefinitionBuilder.defineCron().withSeconds().and().withMinutes().and().withHours().and().withDayOfMonth().supportsHash().supportsL().supportsW().supportsLW().supportsQuestionMark().and().withMonth().and().withDayOfWeek().withValidRange(1,7).withMondayDoWValue(2).supportsHash().supportsL().supportsW().supportsQuestionMark().and().withYear().withValidRange(1970,2099).and().lastFieldOptional().instance();
}
Program: 4308
Project: 4308
Buggy source:
/** 
 * Performs action on On instance
 * @param on - On instance, never null
 * @return On instance, never null
 */
On visit(On on);

Fixed version (ground truth):
/** 
 * Performs action on QuestionMark instance
 * @param questionMark - QuestionMark instance, never null
 * @return QuestionMark instance, never null
 */
QuestionMark visit(QuestionMark questionMark);
Program: 4309
Project: 4309
Buggy source:
@Override public FieldExpression visit(FieldExpression expression){
  if (expression instanceof Always) {
    return visit((Always)expression);
  }
  if (expression instanceof And) {
    return visit((And)expression);
  }
  if (expression instanceof Between) {
    return visit((Between)expression);
  }
  if (expression instanceof Every) {
    return visit((Every)expression);
  }
  if (expression instanceof On) {
    return visit((On)expression);
  }
  return expression;
}

Fixed version (ground truth):
@Override public FieldExpression visit(FieldExpression expression){
  if (expression instanceof Always) {
    return visit((Always)expression);
  }
  if (expression instanceof And) {
    return visit((And)expression);
  }
  if (expression instanceof Between) {
    return visit((Between)expression);
  }
  if (expression instanceof Every) {
    return visit((Every)expression);
  }
  if (expression instanceof On) {
    return visit((On)expression);
  }
  if (expression instanceof QuestionMark) {
    return visit((QuestionMark)expression);
  }
  return expression;
}
Program: 4310
Project: 4310
Buggy source:
public NearestValue getPreviousValue(int reference,int shifts){
  return getNearestValues(reference,shifts,new Function<Integer,Integer>(){
    @Override public Integer apply(    Integer integer){
      return integer - 1;
    }
  }
);
}

Fixed version (ground truth):
public NearestValue getPreviousValue(int reference,int shifts){
  return getNearestBackwardValue(reference,shifts);
}
Program: 4311
Project: 4311
Buggy source:
public NearestValue getNextValue(int reference,int shifts){
  return getNearestValues(reference,shifts,new Function<Integer,Integer>(){
    @Override public Integer apply(    Integer integer){
      return integer + 1;
    }
  }
);
}

Fixed version (ground truth):
public NearestValue getNextValue(int reference,int shifts){
  return getNearestForwardValue(reference,shifts);
}
Program: 4312
Project: 4312
Buggy source:
@Override public int generatePreviousValue(int reference) throws NoSuchValueException {
  return new EveryFieldValueGenerator(expression).generatePreviousValue(reference);
}

Fixed version (ground truth):
@Override public int generatePreviousValue(int reference) throws NoSuchValueException {
  Always always=(Always)expression;
  return new EveryFieldValueGenerator(always.getEvery()).generatePreviousValue(reference);
}
Program: 4313
Project: 4313
Buggy source:
@Override public int generateNextValue(int reference) throws NoSuchValueException {
  return new EveryFieldValueGenerator(expression).generateNextValue(reference);
}

Fixed version (ground truth):
@Override public int generateNextValue(int reference) throws NoSuchValueException {
  Always always=(Always)expression;
  return new EveryFieldValueGenerator(always.getEvery()).generateNextValue(reference);
}
Program: 4314
Project: 4314
Buggy source:
@Override public int generatePreviousValue(final int reference) throws NoSuchValueException {
  List<Integer> candidates=computeCandidates(new Function<FieldValueGenerator,Integer>(){
    @Override public Integer apply(    FieldValueGenerator candidateGenerator){
      try {
        return candidateGenerator.generatePreviousValue(reference);
      }
 catch (      NoSuchValueException e) {
        return NO_VALUE;
      }
    }
  }
);
  return candidates.get(candidates.size() - 1);
}

Fixed version (ground truth):
@Override public int generatePreviousValue(final int reference) throws NoSuchValueException {
  List<Integer> candidates=computeCandidates(new Function<FieldValueGenerator,Integer>(){
    @Override public Integer apply(    FieldValueGenerator candidateGenerator){
      try {
        return candidateGenerator.generatePreviousValue(reference);
      }
 catch (      NoSuchValueException e) {
        return NO_VALUE;
      }
    }
  }
);
  if (candidates.isEmpty()) {
    throw new NoSuchValueException();
  }
 else {
    return candidates.get(candidates.size() - 1);
  }
}
Program: 4315
Project: 4315
Buggy source:
@Override public int generateNextValue(final int reference) throws NoSuchValueException {
  return computeCandidates(new Function<FieldValueGenerator,Integer>(){
    @Override public Integer apply(    FieldValueGenerator fieldValueGenerator){
      try {
        return fieldValueGenerator.generateNextValue(reference);
      }
 catch (      NoSuchValueException e) {
        return NO_VALUE;
      }
    }
  }
).get(0);
}

Fixed version (ground truth):
@Override public int generateNextValue(final int reference) throws NoSuchValueException {
  List<Integer> candidates=computeCandidates(new Function<FieldValueGenerator,Integer>(){
    @Override public Integer apply(    FieldValueGenerator fieldValueGenerator){
      try {
        return fieldValueGenerator.generateNextValue(reference);
      }
 catch (      NoSuchValueException e) {
        return NO_VALUE;
      }
    }
  }
);
  if (candidates.isEmpty()) {
    throw new NoSuchValueException();
  }
 else {
    return candidates.get(0);
  }
}
Program: 4316
Project: 4316
Buggy source:
@Override public boolean apply(Integer integer){
  return integer > 0;
}

Fixed version (ground truth):
@Override public boolean apply(Integer integer){
  return integer >= 0;
}
Program: 4317
Project: 4317
Buggy source:
private List<Integer> computeCandidates(Function<FieldValueGenerator,Integer> function){
  And and=(And)expression;
  List<Integer> candidates=Lists.newArrayList();
  for (  FieldExpression expression : and.getExpressions()) {
    candidates.add(function.apply(createCandidateGeneratorInstance(expression)));
  }
  candidates=new ArrayList<Integer>(Collections2.filter(candidates,new Predicate<Integer>(){
    @Override public boolean apply(    Integer integer){
      return integer > 0;
    }
  }
));
  Collections.sort(candidates);
  return candidates;
}

Fixed version (ground truth):
private List<Integer> computeCandidates(Function<FieldValueGenerator,Integer> function){
  And and=(And)expression;
  List<Integer> candidates=Lists.newArrayList();
  for (  FieldExpression expression : and.getExpressions()) {
    candidates.add(function.apply(createCandidateGeneratorInstance(expression)));
  }
  candidates=new ArrayList<Integer>(Collections2.filter(candidates,new Predicate<Integer>(){
    @Override public boolean apply(    Integer integer){
      return integer >= 0;
    }
  }
));
  Collections.sort(candidates);
  return candidates;
}
Program: 4318
Project: 4318
Buggy source:
@Override public int generatePreviousValue(int reference) throws NoSuchValueException {
  Between between=(Between)expression;
  int candidate=new EveryFieldValueGenerator(between.getEvery()).generatePreviousValue(reference);
  if (candidate < between.getFrom() || candidate > between.getTo()) {
    return between.getTo();
  }
  return candidate;
}

Fixed version (ground truth):
@Override public int generatePreviousValue(int reference) throws NoSuchValueException {
  Between between=(Between)expression;
  int candidate=new EveryFieldValueGenerator(between.getEvery()).generatePreviousValue(reference);
  if (candidate < between.getFrom()) {
    throw new NoSuchValueException();
  }
  return candidate;
}
Program: 4319
Project: 4319
Buggy source:
@Override public int generateNextValue(int reference) throws NoSuchValueException {
  Between between=(Between)expression;
  int candidate=new EveryFieldValueGenerator(between.getEvery()).generateNextValue(reference);
  if (candidate < between.getFrom() || candidate > between.getTo()) {
    return between.getFrom();
  }
  return candidate;
}

Fixed version (ground truth):
@Override public int generateNextValue(int reference) throws NoSuchValueException {
  Between between=(Between)expression;
  int candidate=new EveryFieldValueGenerator(between.getEvery()).generateNextValue(reference);
  if (candidate > between.getTo()) {
    throw new NoSuchValueException();
  }
  return candidate;
}
Program: 4320
Project: 4320
Buggy source:
public abstract int generatePreviousValue(int reference) throws NoSuchValueException ;

Fixed version (ground truth):
/** 
 * Generates previous valid value from reference
 * @param reference - reference value
 * @return generated value - Integer
 * @throws NoSuchValueException - if there is no previous value
 */
public abstract int generatePreviousValue(int reference) throws NoSuchValueException ;
Program: 4321
Project: 4321
Buggy source:
public abstract int generateNextValue(int reference) throws NoSuchValueException ;

Fixed version (ground truth):
/** 
 * Generates next valid value from reference
 * @param reference - reference value
 * @return generated value - Integer
 * @throws NoSuchValueException - if there is no next value
 */
public abstract int generateNextValue(int reference) throws NoSuchValueException ;
Program: 4322
Project: 4322
Buggy source:
public FieldValueGenerator(FieldExpression expression){
  this.expression=Validate.notNull(expression);
}

Fixed version (ground truth):
public FieldValueGenerator(FieldExpression expression){
  Validate.notNull(expression);
  Validate.isTrue(matchesFieldExpressionClass(expression),"String_Node_Str");
  this.expression=expression;
}
Program: 4323
Project: 4323
Buggy source:
private int generateValue(On on,int year,int month) throws NoSuchValueException {
switch (on.getSpecialChar()) {
case L:
    return new DateTime(year,month,1,1,1).dayOfMonth().getMaximumValue();
case W:
  DateTime doM=new DateTime(year,month,on.getTime(),1,1);
if (doM.getDayOfWeek() == 6) {
  if (on.getTime() == 1) {
    return 3;
  }
  return on.getTime() - 1;
}
if (doM.getDayOfWeek() == 7) {
if ((on.getTime() + 1) <= doM.dayOfMonth().getMaximumValue()) {
  return on.getTime() + 1;
}
}
break;
}
throw new NoSuchElementException();
}

Fixed version (ground truth):
private int generateValue(On on,int year,int month) throws NoSuchValueException {
switch (on.getSpecialChar()) {
case L:
    return new DateTime(year,month,1,1,1).dayOfMonth().getMaximumValue();
case W:
  DateTime doM=new DateTime(year,month,on.getTime(),1,1);
if (doM.getDayOfWeek() == 6) {
  if (on.getTime() == 1) {
    return 3;
  }
  return on.getTime() - 1;
}
if (doM.getDayOfWeek() == 7) {
if ((on.getTime() + 1) <= doM.dayOfMonth().getMaximumValue()) {
  return on.getTime() + 1;
}
}
break;
case NONE:
return on.getTime();
}
throw new NoSuchElementException();
}
Program: 4324
Project: 4324
Buggy source:
public OnDayOfMonthValueGenerator(CronField cronField,int year,int month){
  super(cronField.getExpression());
  Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()));
  this.year=year;
  this.month=month;
}

Fixed version (ground truth):
public OnDayOfMonthValueGenerator(CronField cronField,int year,int month){
  super(cronField.getExpression());
  Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()),"String_Node_Str");
  this.year=year;
  this.month=month;
}
Program: 4325
Project: 4325
Buggy source:
public OnDayOfWeekValueGenerator(CronField cronField,int year,int month){
  super(cronField.getExpression());
  Validate.isTrue(CronFieldName.DAY_OF_MONTH.equals(cronField.getField()));
  this.year=year;
  this.month=month;
}

Fixed version (ground truth):
public OnDayOfWeekValueGenerator(CronField cronField,int year,int month){
  super(cronField.getExpression());
  Validate.isTrue(CronFieldName.DAY_OF_WEEK.equals(cronField.getField()),"String_Node_Str");
  this.year=year;
  this.month=month;
}
Program: 4326
Project: 4326
Buggy source:
private int generateValue(On on,int year,int month) throws NoSuchValueException {
switch (on.getSpecialChar()) {
case HASH:
    return generateHashValues(on,year,month);
case L:
  return generateLValues(on,year,month);
}
throw new NoSuchValueException();
}

Fixed version (ground truth):
private int generateValue(On on,int year,int month) throws NoSuchValueException {
switch (on.getSpecialChar()) {
case HASH:
    return generateHashValues(on,year,month);
case L:
  return generateLValues(on,year,month);
case NONE:
return on.getTime();
}
throw new NoSuchValueException();
}
Program: 4327
Project: 4327
Buggy source:
public static int weekDayMapping(WeekDay from,WeekDay to,int weekday){
  return from.map(to,weekday);
}

Fixed version (ground truth):
public static int weekDayMapping(WeekDay from,WeekDay to,int weekday){
  return to.map(from,weekday);
}
Program: 4328
Project: 4328
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");
  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){
  Validate.notNull(from,"String_Node_Str");
  this.to=Validate.notNull(to,"String_Node_Str");
  mappings=Maps.newHashMap();
  buildMappings(from,to);
}
Program: 4329
Project: 4329
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(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 new Cron(to,fields);
}
Program: 4330
Project: 4330
Buggy source:
public WeekDay(int monday,boolean firstDayIsZero){
  this.monday=monday;
  this.firstDayIsZero=firstDayIsZero;
}

Fixed version (ground truth):
public WeekDay(int mondayDoWValue,boolean firstDayIsZero){
  Validate.isTrue(mondayDoWValue >= 0,"String_Node_Str");
  this.mondayDoWValue=mondayDoWValue;
  this.firstDayIsZero=firstDayIsZero;
}
Program: 4331
Project: 4331
Buggy source:
public int map(WeekDay weekDay,int day){
  int result=monday - weekDay.getMonday() + day;
  if (result == 0) {
    if (firstDayIsZero) {
      result=0;
    }
 else {
      result=7;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Maps given WeekDay to representation hold by this instance.
 * @param weekDay - referred weekDay
 * @param dayOfWeek - day of week to be mapped
 * @return - int result
 */
public int map(WeekDay weekDay,int dayOfWeek){
  int result=mondayDoWValue - weekDay.getMondayDoWValue() + dayOfWeek;
  if (result == 0) {
    if (firstDayIsZero) {
      result=0;
    }
 else {
      result=7;
    }
  }
  return result;
}
Program: 4332
Project: 4332
Buggy source:
public Cron(List<CronField> fields){
  this.fields=Maps.newHashMap();
  Validate.notNull(fields,"String_Node_Str");
  for (  CronField field : fields) {
    this.fields.put(field.getField(),field);
  }
}

Fixed version (ground truth):
public Cron(CronDefinition cronDefinition,List<CronField> fields){
  this.cronDefinition=Validate.notNull(cronDefinition,"String_Node_Str");
  Validate.notNull(fields,"String_Node_Str");
  this.fields=Maps.newHashMap();
  for (  CronField field : fields) {
    this.fields.put(field.getField(),field);
  }
}
Program: 4333
Project: 4333
Buggy source:
/** 
 * Validate if special char is allowed. If not, a RuntimeException will be raised.
 * @param specialChar - char to be validated
 */
public void validateSpecialCharAllowed(SpecialChar specialChar){
  if (!specialChars.contains(specialChar)) {
    throw new RuntimeException(String.format("String_Node_Str",specialChar));
  }
}

Fixed version (ground truth):
/** 
 * Validate if special char is allowed. If not, a RuntimeException will be raised.
 * @param specialChar - char to be validated
 */
public void validateSpecialCharAllowed(SpecialChar specialChar){
  if (!isSpecialCharAllowed(specialChar)) {
    throw new RuntimeException(String.format("String_Node_Str",specialChar));
  }
}
Program: 4334
Project: 4334
Buggy source:
/** 
 * Validate if given number is >= start range and <= end range
 * @param number - to be validated
 * @return - same number being validated if in range,throws RuntimeException if number out of range
 */
public int validateInRange(int number){
  if (number >= startRange && number <= endRange) {
    return number;
  }
  throw new RuntimeException(String.format("String_Node_Str",number,startRange,endRange));
}

Fixed version (ground truth):
/** 
 * Validate if given number is >= start range and <= end range
 * @param number - to be validated
 * @return - same number being validated if in range,throws RuntimeException if number out of range
 */
public int validateInRange(int number){
  if (isInRange(number)) {
    return number;
  }
  throw new RuntimeException(String.format("String_Node_Str",number,startRange,endRange));
}
Program: 4335
Project: 4335
Buggy source:
/** 
 * Constructor
 * @param fieldName   - CronFieldName; name of the fieldif null, a NullPointerException will be raised.
 * @param constraints - FieldConstraints, constraints;
 */
public DayOfWeekFieldDefinition(CronFieldName fieldName,FieldConstraints constraints,int mondayDoWValue){
  super(fieldName,constraints);
  constraints.validateInRange(mondayDoWValue);
  this.mondayDoWValue=mondayDoWValue;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param fieldName   - CronFieldName; name of the fieldif null, a NullPointerException will be raised.
 * @param constraints - FieldConstraints, constraints;
 */
public DayOfWeekFieldDefinition(CronFieldName fieldName,FieldConstraints constraints,WeekDay mondayDoWValue){
  super(fieldName,constraints);
  constraints.validateInRange(mondayDoWValue.getMondayDoWValue());
  this.mondayDoWValue=mondayDoWValue;
}
Program: 4336
Project: 4336
Buggy source:
public int getMondayDoWValue(){
  return mondayDoWValue;
}

Fixed version (ground truth):
public WeekDay getMondayDoWValue(){
  return mondayDoWValue;
}
Program: 4337
Project: 4337
Buggy source:
/** 
 * Registers CronField in ParserDefinitionBuilder and returns its instance
 * @return ParserDefinitionBuilder instance obtained from constructor
 */
public CronDefinitionBuilder and(){
  cronDefinitionBuilder.register(new DayOfWeekFieldDefinition(fieldName,constraints.createConstraintsInstance(),mondayDoWValue));
  return cronDefinitionBuilder;
}

Fixed version (ground truth):
/** 
 * Registers CronField in ParserDefinitionBuilder and returns its instance
 * @return ParserDefinitionBuilder instance obtained from constructor
 */
public CronDefinitionBuilder and(){
  boolean zeroInRange=constraints.createConstraintsInstance().isInRange(0);
  cronDefinitionBuilder.register(new DayOfWeekFieldDefinition(fieldName,constraints.createConstraintsInstance(),new WeekDay(mondayDoWValue,zeroInRange)));
  return cronDefinitionBuilder;
}
Program: 4338
Project: 4338
Buggy source:
@VisibleForTesting ExecutionTime(FieldValueGenerator yearsValueGenerator,CronField daysOfWeekCronField,CronField daysOfMonthCronField,TimeNode months,TimeNode hours,TimeNode minutes,TimeNode seconds){
  this.yearsValueGenerator=yearsValueGenerator;
  this.daysOfWeekCronField=daysOfWeekCronField;
  this.daysOfMonthCronField=daysOfMonthCronField;
  this.months=months;
  this.hours=hours;
  this.minutes=minutes;
  this.seconds=seconds;
}

Fixed version (ground truth):
@VisibleForTesting ExecutionTime(CronDefinition cronDefinition,FieldValueGenerator yearsValueGenerator,CronField daysOfWeekCronField,CronField daysOfMonthCronField,TimeNode months,TimeNode hours,TimeNode minutes,TimeNode seconds){
  this.yearsValueGenerator=yearsValueGenerator;
  this.daysOfWeekCronField=daysOfWeekCronField;
  this.daysOfMonthCronField=daysOfMonthCronField;
  this.months=months;
  this.hours=hours;
  this.minutes=minutes;
  this.seconds=seconds;
}
Program: 4340
Project: 4340
Buggy source:
/** 
 * Creates execution time for given Cron
 * @param cron - Cron instance
 * @return ExecutionTime instance
 */
public static ExecutionTime forCron(Cron cron){
  Map<CronFieldName,CronField> fields=cron.retrieveFieldsAsMap();
  ExecutionTimeBuilder executionTimeBuilder=new ExecutionTimeBuilder();
  if (fields.containsKey(CronFieldName.SECOND)) {
    executionTimeBuilder.forSecondsMatching(fields.get(CronFieldName.SECOND));
  }
  executionTimeBuilder.forMinutesMatching(fields.get(CronFieldName.MINUTE)).forHoursMatching(fields.get(CronFieldName.HOUR)).forDaysOfMonthMatching(fields.get(CronFieldName.DAY_OF_MONTH)).forDaysOfWeekMatching(fields.get(CronFieldName.DAY_OF_WEEK)).forMonthsMatching(fields.get(CronFieldName.MONTH));
  if (fields.containsKey(CronFieldName.YEAR)) {
    executionTimeBuilder.forYearsMatching(fields.get(CronFieldName.YEAR));
  }
  return executionTimeBuilder.build();
}

Fixed version (ground truth):
/** 
 * Creates execution time for given Cron
 * @param cron - Cron instance
 * @return ExecutionTime instance
 */
public static ExecutionTime forCron(Cron cron){
  Map<CronFieldName,CronField> fields=cron.retrieveFieldsAsMap();
  ExecutionTimeBuilder executionTimeBuilder=new ExecutionTimeBuilder(cron.getCronDefinition());
  if (fields.containsKey(CronFieldName.SECOND)) {
    executionTimeBuilder.forSecondsMatching(fields.get(CronFieldName.SECOND));
  }
  executionTimeBuilder.forMinutesMatching(fields.get(CronFieldName.MINUTE)).forHoursMatching(fields.get(CronFieldName.HOUR)).forDaysOfMonthMatching(fields.get(CronFieldName.DAY_OF_MONTH)).forDaysOfWeekMatching(fields.get(CronFieldName.DAY_OF_WEEK)).forMonthsMatching(fields.get(CronFieldName.MONTH));
  if (fields.containsKey(CronFieldName.YEAR)) {
    executionTimeBuilder.forYearsMatching(fields.get(CronFieldName.YEAR));
  }
  return executionTimeBuilder.build();
}
Program: 4342
Project: 4342
Buggy source:
private List<Integer> generateDayCandidates(int year,int month){
  DateTime date=new DateTime(year,month,1,1,1);
  List<Integer> candidates=Lists.newArrayList();
  candidates.addAll(FieldValueGeneratorFactory.forCronField(daysOfMonthCronField,year,month).generateCandidates(1,date.dayOfMonth().getMaximumValue()));
  candidates.addAll(FieldValueGeneratorFactory.forCronField(daysOfWeekCronField,year,month).generateCandidates(1,date.dayOfMonth().getMaximumValue()));
  return candidates;
}

Fixed version (ground truth):
private List<Integer> generateDayCandidates(int year,int month,WeekDay mondayDoWValue){
  DateTime date=new DateTime(year,month,1,1,1);
  List<Integer> candidates=Lists.newArrayList();
  candidates.addAll(FieldValueGeneratorFactory.createDayOfMonthValueGeneratorInstance(daysOfMonthCronField,year,month).generateCandidates(1,date.dayOfMonth().getMaximumValue()));
  candidates.addAll(FieldValueGeneratorFactory.createDayOfWeekValueGeneratorInstance(daysOfWeekCronField,year,month,mondayDoWValue).generateCandidates(1,date.dayOfMonth().getMaximumValue()));
  return candidates;
}
Program: 4343
Project: 4343
Buggy source:
ExecutionTime build(){
  return new ExecutionTime(yearsValueGenerator,daysOfWeekCronField,daysOfMonthCronField,months,hours,minutes,seconds);
}

Fixed version (ground truth):
ExecutionTime build(){
  return new ExecutionTime(cronDefinition,yearsValueGenerator,daysOfWeekCronField,daysOfMonthCronField,months,hours,minutes,seconds);
}
Program: 4344
Project: 4344
Buggy source:
ExecutionTimeBuilder(){
  seconds=new TimeNode(FieldValueGeneratorFactory.forCronField(new CronField(CronFieldName.SECOND,new On(FieldConstraintsBuilder.instance().forField(CronFieldName.SECOND).createConstraintsInstance(),"String_Node_Str"))).generateCandidates(1,60));
  yearsValueGenerator=FieldValueGeneratorFactory.forCronField(new CronField(CronFieldName.YEAR,new Always(FieldConstraintsBuilder.instance().forField(CronFieldName.YEAR).createConstraintsInstance())));
}

Fixed version (ground truth):
ExecutionTimeBuilder(CronDefinition cronDefinition){
  this.cronDefinition=cronDefinition;
  seconds=new TimeNode(FieldValueGeneratorFactory.forCronField(new CronField(CronFieldName.SECOND,new On(FieldConstraintsBuilder.instance().forField(CronFieldName.SECOND).createConstraintsInstance(),"String_Node_Str"))).generateCandidates(1,60));
  yearsValueGenerator=FieldValueGeneratorFactory.forCronField(new CronField(CronFieldName.YEAR,new Always(FieldConstraintsBuilder.instance().forField(CronFieldName.YEAR).createConstraintsInstance())));
}
Program: 4345
Project: 4345
Buggy source:
/** 
 * Parse string with cron expression
 * @param expression - cron expression, never null
 * @return Cron instance, corresponding to cron expression received
 */
public Cron parse(String expression){
  Validate.notNull(expression,"String_Node_Str");
  if (StringUtils.isEmpty(expression)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  expression=expression.toUpperCase();
  expression=expression.replace("String_Node_Str","String_Node_Str");
  String[] expressionParts=expression.split("String_Node_Str");
  if (expressions.containsKey(expressionParts.length)) {
    List<CronField> results=new ArrayList<CronField>();
    List<CronParserField> fields=expressions.get(expressionParts.length);
    for (int j=0; j < fields.size(); j++) {
      results.add(fields.get(j).parse(expressionParts[j]));
    }
    return new Cron(cronDefinition,results);
  }
 else {
    throw new IllegalArgumentException(String.format("String_Node_Str",expressionParts.length,expressions.keySet()));
  }
}

Fixed version (ground truth):
/** 
 * Parse string with cron expression
 * @param expression - cron expression, never null
 * @return Cron instance, corresponding to cron expression received
 */
public Cron parse(String expression){
  Validate.notNull(expression,"String_Node_Str");
  expression=expression.replaceAll("String_Node_Str","String_Node_Str").trim();
  if (StringUtils.isEmpty(expression)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  expression=expression.toUpperCase();
  expression=expression.replace("String_Node_Str","String_Node_Str");
  String[] expressionParts=expression.split("String_Node_Str");
  if (expressions.containsKey(expressionParts.length)) {
    List<CronField> results=new ArrayList<CronField>();
    List<CronParserField> fields=expressions.get(expressionParts.length);
    for (int j=0; j < fields.size(); j++) {
      results.add(fields.get(j).parse(expressionParts[j]));
    }
    return new Cron(cronDefinition,results);
  }
 else {
    throw new IllegalArgumentException(String.format("String_Node_Str",expressionParts.length,expressions.keySet()));
  }
}
Program: 4346
Project: 4346
Buggy source:
public List<Long> getOrCreateNode(Long start,Long end,GraphDatabaseService db){
  List<Long> relList=relationshipCache.getIfPresent(start);
  Node startNode=db.getNodeById(start);
  if (relList == null) {
    List<Long> nodeList=new ArrayList<>();
    for (    Node endNodes : db.traversalDescription().depthFirst().relationships(withName(relationshipType),Direction.OUTGOING).evaluator(Evaluators.fromDepth(1)).evaluator(Evaluators.toDepth(1)).traverse(startNode).nodes()) {
      nodeList.add(endNodes.getId());
    }
    relationshipCache.put(start,nodeList);
    relList=nodeList;
  }
  if (!relList.contains(end)) {
    Transaction tx=db.beginTx();
    try {
      Node endNode=db.getNodeById(end);
      startNode.createRelationshipTo(endNode,withName(relationshipType));
      tx.success();
    }
 catch (    final Exception e) {
      tx.failure();
    }
 finally {
      tx.finish();
      relList.add(end);
      relationshipCache.put(start,relList);
    }
  }
  return relList;
}

Fixed version (ground truth):
public List<Long> getOrCreateNode(Long start,Long end,GraphDatabaseService db){
  List<Long> relList=relationshipCache.getIfPresent(start);
  Node startNode=db.getNodeById(start);
  if (relList == null) {
    List<Long> nodeList=new ArrayList<>();
    for (    Node endNodes : db.traversalDescription().depthFirst().relationships(withName(relationshipType),Direction.OUTGOING).evaluator(Evaluators.fromDepth(1)).evaluator(Evaluators.toDepth(1)).traverse(startNode).nodes()) {
      nodeList.add(endNodes.getId());
    }
    startNode.setProperty("String_Node_Str",nodeList.size());
    relationshipCache.put(start,nodeList);
    relList=nodeList;
  }
  if (!relList.contains(end)) {
    Transaction tx=db.beginTx();
    try {
      Node endNode=db.getNodeById(end);
      startNode.createRelationshipTo(endNode,withName(relationshipType));
      startNode.setProperty("String_Node_Str",relList.size());
      tx.success();
    }
 catch (    final Exception e) {
      tx.failure();
    }
 finally {
      tx.finish();
      relList.add(end);
      relationshipCache.put(start,relList);
    }
  }
  return relList;
}
Program: 4347
Project: 4347
Buggy source:
@Override public boolean tryAdvance(Consumer<? super List<I>> action){
  boolean hadElements=source.tryAdvance(curElem -> {
    if (!isSameSlide(curElem)) {
      action.accept(currentSlide);
      currentSlide=new ArrayList<>();
    }
    currentSlide.add(curElem);
  }
);
  if (!hadElements && !currentSlide.isEmpty()) {
    action.accept(currentSlide);
    currentSlide=new ArrayList<>();
  }
  return hadElements;
}

Fixed version (ground truth):
@Override public boolean tryAdvance(Consumer<? super List<I>> action){
  boolean hadElements;
  do {
    hadElements=source.tryAdvance(curElem -> {
      wasSameSlide=isSameSlide(curElem);
      if (!wasSameSlide) {
        action.accept(currentSlide);
        currentSlide=new ArrayList<>();
      }
      currentSlide.add(curElem);
    }
);
  }
 while (wasSameSlide && hadElements);
  if (!hadElements && !currentSlide.isEmpty()) {
    action.accept(currentSlide);
    currentSlide=new ArrayList<>();
  }
  return hadElements;
}
Program: 4348
Project: 4348
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) {
    return false;
  }
  final Indexed other=(Indexed)obj;
  return Objects.equals(this.index,other.index) && Objects.equals(this.value,other.value);
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null || getClass() != obj.getClass()) {
    return false;
  }
  final Indexed other=(Indexed)obj;
  return Objects.equals(index,other.index) && Objects.equals(value,other.value);
}
Program: 4349
Project: 4349
Buggy source:
static String message(Response response){
  try {
    return response.errorBody().string();
  }
 catch (  IOException e) {
    return response.message();
  }
}

Fixed version (ground truth):
static String message(Response response){
  try {
    ResponseBody responseBody=response.errorBody();
    return responseBody == null ? response.message() : responseBody.string();
  }
 catch (  IOException e) {
    return response.message();
  }
}
Program: 4350
Project: 4350
Buggy source:
private static EventResponse eventResponse(Response<List<Event>> response){
  String indexHeaderValue=response.headers().get("String_Node_Str");
  BigInteger index=new BigInteger(indexHeaderValue);
  return ImmutableEventResponse.of(response.body(),index);
}

Fixed version (ground truth):
private static EventResponse eventResponse(Response<List<Event>> response){
  String indexHeaderValue=response.headers().get("String_Node_Str");
  BigInteger index=indexHeaderValue == null ? BigInteger.ZERO : new BigInteger(indexHeaderValue);
  return ImmutableEventResponse.of(response.body(),index);
}
Program: 4351
Project: 4351
Buggy source:
@PUT("String_Node_Str") Call<Boolean> putValue(@Path("String_Node_Str") String key,@Body String data,@QueryMap Map<String,Object> query);

Fixed version (ground truth):
@PUT("String_Node_Str") Call<Boolean> putValue(@Path("String_Node_Str") String key,@Body RequestBody data,@QueryMap Map<String,Object> query);
Program: 4352
Project: 4352
Buggy source:
@JsonIgnore @org.immutables.value.Value.Lazy public Optional<String> getValueAsString(){
  if (getValue().isPresent()) {
    return Optional.of(unquote(new String(BaseEncoding.base64().decode(getValue().get()))));
  }
 else {
    return Optional.absent();
  }
}

Fixed version (ground truth):
@JsonIgnore @org.immutables.value.Value.Lazy public Optional<String> getValueAsString(){
  if (getValue().isPresent()) {
    return Optional.of(new String(BaseEncoding.base64().decode(getValue().get())));
  }
 else {
    return Optional.absent();
  }
}
Program: 4353
Project: 4353
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Optional<String> deserialize(JsonParser p,DeserializationContext ctxt) throws IOException {
  String value=p.getValueAsString();
  if (StringUtils.isNotEmpty(value)) {
    return Optional.of(unquote(new String(BaseEncoding.base64().decode(value))));
  }
  return Optional.absent();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public Optional<String> deserialize(JsonParser p,DeserializationContext ctxt) throws IOException {
  String value=p.getValueAsString();
  if (StringUtils.isNotEmpty(value)) {
    return Optional.of(new String(BaseEncoding.base64().decode(value)));
  }
  return Optional.absent();
}
Program: 4354
Project: 4354
Buggy source:
@Override public void onFailure(Throwable throwable){
  LOGGER.error("String_Node_Str",backoffDelayQty,backoffDelayUnit,throwable);
  executorService.schedule(new Runnable(){
    @Override public void run(){
      runCallback();
    }
  }
,backoffDelayQty,backoffDelayUnit);
}

Fixed version (ground truth):
@Override public void onFailure(Throwable throwable){
  LOGGER.error(String.format("String_Node_Str",backoffDelayQty,backoffDelayUnit),throwable);
  executorService.schedule(new Runnable(){
    @Override public void run(){
      runCallback();
    }
  }
,backoffDelayQty,backoffDelayUnit);
}
Program: 4355
Project: 4355
Buggy source:
ConsulCache(Function<V,K> keyConversion,CallbackConsumer<V> callbackConsumer,final long backoffDelayQty,final TimeUnit backoffDelayUnit){
  this.keyConversion=keyConversion;
  this.callBackConsumer=callbackConsumer;
  this.responseCallback=new ConsulResponseCallback<List<V>>(){
    @Override public void onComplete(    ConsulResponse<List<V>> consulResponse){
      updateIndex(consulResponse);
      ImmutableMap<K,V> full=convertToMap(consulResponse);
      boolean changed=!full.equals(lastState.get());
      if (changed) {
        lastState.set(full);
      }
      if (initialized.compareAndSet(false,true)) {
        initLatch.countDown();
      }
      if (changed) {
        for (        Listener<K,V> l : listeners) {
          l.notify(full);
        }
      }
      runCallback();
    }
    @Override public void onFailure(    Throwable throwable){
      LOGGER.error("String_Node_Str",backoffDelayQty,backoffDelayUnit,throwable);
      executorService.schedule(new Runnable(){
        @Override public void run(){
          runCallback();
        }
      }
,backoffDelayQty,backoffDelayUnit);
    }
  }
;
}

Fixed version (ground truth):
ConsulCache(Function<V,K> keyConversion,CallbackConsumer<V> callbackConsumer,final long backoffDelayQty,final TimeUnit backoffDelayUnit){
  this.keyConversion=keyConversion;
  this.callBackConsumer=callbackConsumer;
  this.responseCallback=new ConsulResponseCallback<List<V>>(){
    @Override public void onComplete(    ConsulResponse<List<V>> consulResponse){
      updateIndex(consulResponse);
      ImmutableMap<K,V> full=convertToMap(consulResponse);
      boolean changed=!full.equals(lastState.get());
      if (changed) {
        lastState.set(full);
      }
      if (initialized.compareAndSet(false,true)) {
        initLatch.countDown();
      }
      if (changed) {
        for (        Listener<K,V> l : listeners) {
          l.notify(full);
        }
      }
      runCallback();
    }
    @Override public void onFailure(    Throwable throwable){
      LOGGER.error(String.format("String_Node_Str",backoffDelayQty,backoffDelayUnit),throwable);
      executorService.schedule(new Runnable(){
        @Override public void run(){
          runCallback();
        }
      }
,backoffDelayQty,backoffDelayUnit);
    }
  }
;
}
Program: 4356
Project: 4356
Buggy source:
@Override public void pushFile(File localFrom,String remoteTo){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  try {
    if (device.getSyncService() == null)     throw new RuntimeException("String_Node_Str");
    device.getSyncService().pushFile(localFrom.getAbsolutePath(),remoteTo,SyncService.getNullProgressMonitor());
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    throw new RuntimeException(ex);
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void pushFile(File localFrom,String remoteTo){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  try {
    if (device.getSyncService() == null)     throw new AndroidScreenCastRuntimeException("String_Node_Str");
    device.getSyncService().pushFile(localFrom.getAbsolutePath(),remoteTo,SyncService.getNullProgressMonitor());
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    throw new AndroidScreenCastRuntimeException(ex);
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
}
Program: 4357
Project: 4357
Buggy source:
@Override public void pullFile(String removeFrom,File localTo){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  try {
    if (device.getSyncService() == null)     throw new RuntimeException("String_Node_Str");
    Method m=device.getSyncService().getClass().getDeclaredMethod("String_Node_Str",String.class,String.class,ISyncProgressMonitor.class);
    m.setAccessible(true);
    device.getSyncService();
    m.invoke(device.getSyncService(),removeFrom,localTo.getAbsolutePath(),SyncService.getNullProgressMonitor());
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    throw new RuntimeException(ex);
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void pullFile(String removeFrom,File localTo){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  try {
    if (device.getSyncService() == null)     throw new RuntimeException("String_Node_Str");
    Method m=device.getSyncService().getClass().getDeclaredMethod("String_Node_Str",String.class,String.class,ISyncProgressMonitor.class);
    m.setAccessible(true);
    device.getSyncService();
    m.invoke(device.getSyncService(),removeFrom,localTo.getAbsolutePath(),SyncService.getNullProgressMonitor());
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    throw new AndroidScreenCastRuntimeException(ex);
  }
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
}
Program: 4358
Project: 4358
Buggy source:
@Override public List<FileInfo> list(String path){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  try {
    String s=executeCommand("String_Node_Str" + path);
    String[] entries=s.split("String_Node_Str");
    Vector<FileInfo> liste=new Vector<>();
    for (    String entry : entries) {
      String[] data=entry.split("String_Node_Str");
      if (data.length < 4)       continue;
      String attributes=data[0];
      boolean directory=attributes.startsWith("String_Node_Str");
      String name=data[data.length - 1];
      FileInfo fi=new FileInfo();
      fi.attribs=attributes;
      fi.directory=directory;
      fi.name=name;
      fi.path=path;
      fi.device=this;
      liste.add(fi);
    }
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
    return liste;
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    throw new RuntimeException(ex);
  }
}

Fixed version (ground truth):
@Override public List<FileInfo> list(String path){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  try {
    String s=executeCommand("String_Node_Str" + path);
    String[] entries=s.split("String_Node_Str");
    List<FileInfo> fileInfos=new ArrayList<>();
    for (    String entry : entries) {
      String[] data=entry.split("String_Node_Str");
      if (data.length < 4)       continue;
      String attributes=data[0];
      boolean directory=attributes.charAt(0) == 'd';
      String name=data[data.length - 1];
      FileInfo fi=new FileInfo();
      fi.attribs=attributes;
      fi.directory=directory;
      fi.name=name;
      fi.path=path;
      fi.device=this;
      fileInfos.add(fi);
    }
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
    return fileInfos;
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    throw new AndroidScreenCastRuntimeException(ex);
  }
}
Program: 4359
Project: 4359
Buggy source:
@Override public String executeCommand(String cmd){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  ByteArrayOutputStream bos=new ByteArrayOutputStream();
  try {
    device.executeShellCommand(cmd,new OutputStreamShellOutputReceiver(bos));
    String returnString=new String(bos.toByteArray(),"String_Node_Str");
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
    return returnString;
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    throw new ExecuteCommandException(cmd);
  }
}

Fixed version (ground truth):
@Override public String executeCommand(String cmd){
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str");
  }
  try (ByteArrayOutputStream bos=new ByteArrayOutputStream()){
    device.executeShellCommand(cmd,new OutputStreamShellOutputReceiver(bos));
    String returnString=new String(bos.toByteArray(),"String_Node_Str");
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str");
    }
    return returnString;
  }
 catch (  Exception ex) {
    logger.error("String_Node_Str",ex);
    throw new ExecuteCommandException(cmd);
  }
}
Program: 4360
Project: 4360
Buggy source:
public File downloadTemporary(){
  try {
    File tempFile=File.createTempFile("String_Node_Str",name);
    device.pullFile(path + name,tempFile);
    tempFile.deleteOnExit();
    return tempFile;
  }
 catch (  Exception ex) {
    throw new RuntimeException(ex);
  }
}

Fixed version (ground truth):
public File downloadTemporary(){
  try {
    File tempFile=File.createTempFile("String_Node_Str",name);
    device.pullFile(path + name,tempFile);
    tempFile.deleteOnExit();
    return tempFile;
  }
 catch (  IOException ex) {
    throw new IORuntimeException(ex);
  }
}