nus-yam/ex-repair huggingface dataset:
Program: 78742
Project: 78742
Buggy source:
/** 
 * Gets the value of the specified field from this instant as an   {@code int}. <p> This queries this instant for the value for the specified field. The returned value will always be within the valid range of values for the field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time, except  {@code INSTANT_SECONDS} which is toolarge to fit in an  {@code int} and throws a {@code DateTimeException}. All other   {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained orthe value is outside the range of valid values for the field
 * @throws UnsupportedTemporalTypeException if the field is not supported orthe range of values exceeds an  {@code int}
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public int get(TemporalField field){
}

Fixed version (ground truth):
/** 
 * Gets the value of the specified field from this instant as an   {@code int}. <p> This queries this instant for the value of the specified field. The returned value will always be within the valid range of values for the field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time, except  {@code INSTANT_SECONDS} which is toolarge to fit in an  {@code int} and throws a {@code DateTimeException}. All other   {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained orthe value is outside the range of valid values for the field
 * @throws UnsupportedTemporalTypeException if the field is not supported orthe range of values exceeds an  {@code int}
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public int get(TemporalField field){
}
Program: 78743
Project: 78743
Buggy source:
/** 
 * Gets the value of the specified field from this instant as a   {@code long}. <p> This queries this instant for the value for the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
}

Fixed version (ground truth):
/** 
 * Gets the value of the specified field from this instant as a   {@code long}. <p> This queries this instant for the value of the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date-time. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
}
Program: 78744
Project: 78744
Buggy source:
/** 
 * Obtains an instance of   {@code LocalDate} from a year and day-of-year.<p> This returns a  {@code LocalDate} with the specified year and day-of-year.The day-of-year must be valid for the year, otherwise an exception will be thrown.
 * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
 * @param dayOfYear  the day-of-year to represent, from 1 to 366
 * @return the local date, not null
 * @throws DateTimeException if the value of any field is out of range,or if the day-of-year is invalid for the month-year
 */
public static LocalDate ofYearDay(int year,int dayOfYear){
  YEAR.checkValidValue(year);
  DAY_OF_YEAR.checkValidValue(dayOfYear);
  boolean leap=IsoChronology.INSTANCE.isLeapYear(year);
  if (dayOfYear == 366 && leap == false) {
    throw new DateTimeException("String_Node_Str" + year + "String_Node_Str");
  }
  Month moy=Month.of((dayOfYear - 1) / 31 + 1);
  int monthEnd=moy.firstDayOfYear(leap) + moy.length(leap) - 1;
  if (dayOfYear > monthEnd) {
    moy=moy.plus(1);
  }
  int dom=dayOfYear - moy.firstDayOfYear(leap) + 1;
  return new LocalDate(year,moy.getValue(),dom);
}

Fixed version (ground truth):
/** 
 * Obtains an instance of   {@code LocalDate} from a year and day-of-year.<p> This returns a  {@code LocalDate} with the specified year and day-of-year.The day-of-year must be valid for the year, otherwise an exception will be thrown.
 * @param year  the year to represent, from MIN_YEAR to MAX_YEAR
 * @param dayOfYear  the day-of-year to represent, from 1 to 366
 * @return the local date, not null
 * @throws DateTimeException if the value of any field is out of range,or if the day-of-year is invalid for the year
 */
public static LocalDate ofYearDay(int year,int dayOfYear){
  YEAR.checkValidValue(year);
  DAY_OF_YEAR.checkValidValue(dayOfYear);
  boolean leap=IsoChronology.INSTANCE.isLeapYear(year);
  if (dayOfYear == 366 && leap == false) {
    throw new DateTimeException("String_Node_Str" + year + "String_Node_Str");
  }
  Month moy=Month.of((dayOfYear - 1) / 31 + 1);
  int monthEnd=moy.firstDayOfYear(leap) + moy.length(leap) - 1;
  if (dayOfYear > monthEnd) {
    moy=moy.plus(1);
  }
  int dom=dayOfYear - moy.firstDayOfYear(leap) + 1;
  return new LocalDate(year,moy.getValue(),dom);
}
Program: 78745
Project: 78745
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in months added.<p> This method adds the specified amount to the months field in three steps: <ol> <li>Add the input months to the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2007-03-31 plus one month would result in the invalid date 2007-04-31. Instead of returning an invalid result, the last valid day of the month, 2007-04-30, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param monthsToAdd  the months to add, may be negative
 * @return a {@code LocalDate} based on this date with the months added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusMonths(long monthsToAdd){
  if (monthsToAdd == 0) {
    return this;
  }
  long monthCount=year * 12L + (month - 1);
  long calcMonths=monthCount + monthsToAdd;
  int newYear=YEAR.checkValidIntValue(Math.floorDiv(calcMonths,12));
  int newMonth=(int)Math.floorMod(calcMonths,12) + 1;
  return resolvePreviousValid(newYear,newMonth,day);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of months added.<p> This method adds the specified amount to the months field in three steps: <ol> <li>Add the input months to the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2007-03-31 plus one month would result in the invalid date 2007-04-31. Instead of returning an invalid result, the last valid day of the month, 2007-04-30, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param monthsToAdd  the months to add, may be negative
 * @return a {@code LocalDate} based on this date with the months added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusMonths(long monthsToAdd){
  if (monthsToAdd == 0) {
    return this;
  }
  long monthCount=year * 12L + (month - 1);
  long calcMonths=monthCount + monthsToAdd;
  int newYear=YEAR.checkValidIntValue(Math.floorDiv(calcMonths,12));
  int newMonth=(int)Math.floorMod(calcMonths,12) + 1;
  return resolvePreviousValid(newYear,newMonth,day);
}
Program: 78746
Project: 78746
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in years added.<p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param yearsToAdd  the years to add, may be negative
 * @return a {@code LocalDate} based on this date with the years added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusYears(long yearsToAdd){
  if (yearsToAdd == 0) {
    return this;
  }
  int newYear=YEAR.checkValidIntValue(year + yearsToAdd);
  return resolvePreviousValid(newYear,month,day);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of years added.<p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param yearsToAdd  the years to add, may be negative
 * @return a {@code LocalDate} based on this date with the years added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusYears(long yearsToAdd){
  if (yearsToAdd == 0) {
    return this;
  }
  int newYear=YEAR.checkValidIntValue(year + yearsToAdd);
  return resolvePreviousValid(newYear,month,day);
}
Program: 78747
Project: 78747
Buggy source:
/** 
 * Checks if the specified unit is supported. <p> This checks if the specified unit can be added to, or subtracted from, this date-time. If false, then calling the   {@link #plus(long,TemporalUnit)} and{@link #minus(long,TemporalUnit) minus} methods will throw an exception.<p> If the unit is a  {@link ChronoUnit} then the query is implemented here.The supported units are: <ul> <li> {@code DAYS}<li>  {@code WEEKS}<li>  {@code MONTHS}<li>  {@code YEARS}<li>  {@code DECADES}<li>  {@code CENTURIES}<li>  {@code MILLENNIA}<li>  {@code ERAS}</ul> All other   {@code ChronoUnit} instances will return false.<p> If the unit is not a  {@code ChronoUnit}, then the result of this method is obtained by invoking   {@code TemporalUnit.isSupportedBy(Temporal)}passing   {@code this} as the argument.Whether the unit is supported is determined by the unit.
 * @param unit  the unit to check, null returns false
 * @return true if the unit can be added/subtracted, false if not
 */
@Override public boolean isSupported(TemporalUnit unit){
  return ChronoLocalDate.super.isSupported(unit);
}

Fixed version (ground truth):
/** 
 * Checks if the specified unit is supported. <p> This checks if the specified unit can be added to, or subtracted from, this date. If false, then calling the   {@link #plus(long,TemporalUnit)} and{@link #minus(long,TemporalUnit) minus} methods will throw an exception.<p> If the unit is a  {@link ChronoUnit} then the query is implemented here.The supported units are: <ul> <li> {@code DAYS}<li>  {@code WEEKS}<li>  {@code MONTHS}<li>  {@code YEARS}<li>  {@code DECADES}<li>  {@code CENTURIES}<li>  {@code MILLENNIA}<li>  {@code ERAS}</ul> All other   {@code ChronoUnit} instances will return false.<p> If the unit is not a  {@code ChronoUnit}, then the result of this method is obtained by invoking   {@code TemporalUnit.isSupportedBy(Temporal)}passing   {@code this} as the argument.Whether the unit is supported is determined by the unit.
 * @param unit  the unit to check, null returns false
 * @return true if the unit can be added/subtracted, false if not
 */
@Override public boolean isSupported(TemporalUnit unit){
  return ChronoLocalDate.super.isSupported(unit);
}
Program: 78748
Project: 78748
Buggy source:
/** 
 * Returns a copy of this date with the day-of-month altered. If the resulting date is invalid, an exception is thrown. <p> This instance is immutable and unaffected by this method call.
 * @param dayOfMonth  the day-of-month to set in the result, from 1 to 28-31
 * @return a {@code LocalDate} based on this date with the requested day, not null
 * @throws DateTimeException if the day-of-month value is invalid,or if the day-of-month is invalid for the month-year
 */
public LocalDate withDayOfMonth(int dayOfMonth){
  if (this.day == dayOfMonth) {
    return this;
  }
  return of(year,month,dayOfMonth);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the day-of-month altered.<p> If the resulting date is invalid, an exception is thrown. <p> This instance is immutable and unaffected by this method call.
 * @param dayOfMonth  the day-of-month to set in the result, from 1 to 28-31
 * @return a {@code LocalDate} based on this date with the requested day, not null
 * @throws DateTimeException if the day-of-month value is invalid,or if the day-of-month is invalid for the month-year
 */
public LocalDate withDayOfMonth(int dayOfMonth){
  if (this.day == dayOfMonth) {
    return this;
  }
  return of(year,month,dayOfMonth);
}
Program: 78749
Project: 78749
Buggy source:
/** 
 * Returns a copy of this date with the month-of-year altered. If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call.
 * @param month  the month-of-year to set in the result, from 1 (January) to 12 (December)
 * @return a {@code LocalDate} based on this date with the requested month, not null
 * @throws DateTimeException if the month-of-year value is invalid
 */
public LocalDate withMonth(int month){
  if (this.month == month) {
    return this;
  }
  MONTH_OF_YEAR.checkValidValue(month);
  return resolvePreviousValid(year,month,day);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the month-of-year altered.<p> If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call.
 * @param month  the month-of-year to set in the result, from 1 (January) to 12 (December)
 * @return a {@code LocalDate} based on this date with the requested month, not null
 * @throws DateTimeException if the month-of-year value is invalid
 */
public LocalDate withMonth(int month){
  if (this.month == month) {
    return this;
  }
  MONTH_OF_YEAR.checkValidValue(month);
  return resolvePreviousValid(year,month,day);
}
Program: 78750
Project: 78750
Buggy source:
/** 
 * Returns a copy of this date with the year altered. If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call.
 * @param year  the year to set in the result, from MIN_YEAR to MAX_YEAR
 * @return a {@code LocalDate} based on this date with the requested year, not null
 * @throws DateTimeException if the year value is invalid
 */
public LocalDate withYear(int year){
  if (this.year == year) {
    return this;
  }
  YEAR.checkValidValue(year);
  return resolvePreviousValid(year,month,day);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the year altered.<p> If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call.
 * @param year  the year to set in the result, from MIN_YEAR to MAX_YEAR
 * @return a {@code LocalDate} based on this date with the requested year, not null
 * @throws DateTimeException if the year value is invalid
 */
public LocalDate withYear(int year){
  if (this.year == year) {
    return this;
  }
  YEAR.checkValidValue(year);
  return resolvePreviousValid(year,month,day);
}
Program: 78752
Project: 78752
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in weeks added.<p> This method adds the specified amount in weeks to the days field incrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2008-12-31 plus one week would result in 2009-01-07. <p> This instance is immutable and unaffected by this method call.
 * @param weeksToAdd  the weeks to add, may be negative
 * @return a {@code LocalDate} based on this date with the weeks added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusWeeks(long weeksToAdd){
  return plusDays(Math.multiplyExact(weeksToAdd,7));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of weeks added.<p> This method adds the specified amount in weeks to the days field incrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2008-12-31 plus one week would result in 2009-01-07. <p> This instance is immutable and unaffected by this method call.
 * @param weeksToAdd  the weeks to add, may be negative
 * @return a {@code LocalDate} based on this date with the weeks added, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate plusWeeks(long weeksToAdd){
  return plusDays(Math.multiplyExact(weeksToAdd,7));
}
Program: 78753
Project: 78753
Buggy source:
/** 
 * Obtains an instance of   {@code LocalDate} from the epoch day count.<p> This returns a  {@code LocalDate} with the specified epoch-day.The  {@link ChronoField#EPOCH_DAY EPOCH_DAY} is a simple incrementing countof days where day 0 is 1970-01-01. Negative numbers represent earlier days.
 * @param epochDay  the Epoch Day to convert, based on the epoch 1970-01-01
 * @return the local date, not null
 * @throws DateTimeException if the epoch days exceeds the supported date range
 */
public static LocalDate ofEpochDay(long epochDay){
  long zeroDay=epochDay + DAYS_0000_TO_1970;
  zeroDay-=60;
  long adjust=0;
  if (zeroDay < 0) {
    long adjustCycles=(zeroDay + 1) / DAYS_PER_CYCLE - 1;
    adjust=adjustCycles * 400;
    zeroDay+=-adjustCycles * DAYS_PER_CYCLE;
  }
  long yearEst=(400 * zeroDay + 591) / DAYS_PER_CYCLE;
  long doyEst=zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
  if (doyEst < 0) {
    yearEst--;
    doyEst=zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
  }
  yearEst+=adjust;
  int marchDoy0=(int)doyEst;
  int marchMonth0=(marchDoy0 * 5 + 2) / 153;
  int month=(marchMonth0 + 2) % 12 + 1;
  int dom=marchDoy0 - (marchMonth0 * 306 + 5) / 10 + 1;
  yearEst+=marchMonth0 / 10;
  int year=YEAR.checkValidIntValue(yearEst);
  return new LocalDate(year,month,dom);
}

Fixed version (ground truth):
/** 
 * Obtains an instance of   {@code LocalDate} from the epoch day count.<p> This returns a  {@code LocalDate} with the specified epoch-day.The  {@link ChronoField#EPOCH_DAY EPOCH_DAY} is a simple incrementing countof days where day 0 is 1970-01-01. Negative numbers represent earlier days.
 * @param epochDay  the Epoch Day to convert, based on the epoch 1970-01-01
 * @return the local date, not null
 * @throws DateTimeException if the epoch day exceeds the supported date range
 */
public static LocalDate ofEpochDay(long epochDay){
  long zeroDay=epochDay + DAYS_0000_TO_1970;
  zeroDay-=60;
  long adjust=0;
  if (zeroDay < 0) {
    long adjustCycles=(zeroDay + 1) / DAYS_PER_CYCLE - 1;
    adjust=adjustCycles * 400;
    zeroDay+=-adjustCycles * DAYS_PER_CYCLE;
  }
  long yearEst=(400 * zeroDay + 591) / DAYS_PER_CYCLE;
  long doyEst=zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
  if (doyEst < 0) {
    yearEst--;
    doyEst=zeroDay - (365 * yearEst + yearEst / 4 - yearEst / 100 + yearEst / 400);
  }
  yearEst+=adjust;
  int marchDoy0=(int)doyEst;
  int marchMonth0=(marchDoy0 * 5 + 2) / 153;
  int month=(marchMonth0 + 2) % 12 + 1;
  int dom=marchDoy0 - (marchMonth0 * 306 + 5) / 10 + 1;
  yearEst+=marchMonth0 / 10;
  int year=YEAR.checkValidIntValue(yearEst);
  return new LocalDate(year,month,dom);
}
Program: 78754
Project: 78754
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in years subtracted.<p> This method subtracts the specified amount from the years field in three steps: <ol> <li>Subtract the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) minus one year would result in the invalid date 2007-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param yearsToSubtract  the years to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the years subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusYears(long yearsToSubtract){
  return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of years subtracted.<p> This method subtracts the specified amount from the years field in three steps: <ol> <li>Subtract the input years from the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) minus one year would result in the invalid date 2007-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param yearsToSubtract  the years to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the years subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusYears(long yearsToSubtract){
  return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
}
Program: 78755
Project: 78755
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in weeks subtracted.<p> This method subtracts the specified amount in weeks from the days field decrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2009-01-07 minus one week would result in 2008-12-31. <p> This instance is immutable and unaffected by this method call.
 * @param weeksToSubtract  the weeks to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the weeks subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusWeeks(long weeksToSubtract){
  return (weeksToSubtract == Long.MIN_VALUE ? plusWeeks(Long.MAX_VALUE).plusWeeks(1) : plusWeeks(-weeksToSubtract));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of weeks subtracted.<p> This method subtracts the specified amount in weeks from the days field decrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2009-01-07 minus one week would result in 2008-12-31. <p> This instance is immutable and unaffected by this method call.
 * @param weeksToSubtract  the weeks to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the weeks subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusWeeks(long weeksToSubtract){
  return (weeksToSubtract == Long.MIN_VALUE ? plusWeeks(Long.MAX_VALUE).plusWeeks(1) : plusWeeks(-weeksToSubtract));
}
Program: 78756
Project: 78756
Buggy source:
/** 
 * Returns a copy of this date with the day-of-year altered. If the resulting date is invalid, an exception is thrown. <p> This instance is immutable and unaffected by this method call.
 * @param dayOfYear  the day-of-year to set in the result, from 1 to 365-366
 * @return a {@code LocalDate} based on this date with the requested day, not null
 * @throws DateTimeException if the day-of-year value is invalid,or if the day-of-year is invalid for the year
 */
public LocalDate withDayOfYear(int dayOfYear){
  if (this.getDayOfYear() == dayOfYear) {
    return this;
  }
  return ofYearDay(year,dayOfYear);
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the day-of-year altered.<p> If the resulting date is invalid, an exception is thrown. <p> This instance is immutable and unaffected by this method call.
 * @param dayOfYear  the day-of-year to set in the result, from 1 to 365-366
 * @return a {@code LocalDate} based on this date with the requested day, not null
 * @throws DateTimeException if the day-of-year value is invalid,or if the day-of-year is invalid for the year
 */
public LocalDate withDayOfYear(int dayOfYear){
  if (this.getDayOfYear() == dayOfYear) {
    return this;
  }
  return ofYearDay(year,dayOfYear);
}
Program: 78757
Project: 78757
Buggy source:
/** 
 * Gets the value of the specified field from this date as a   {@code long}. <p> This queries this date for the value for the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
  if (field instanceof ChronoField) {
    if (field == EPOCH_DAY) {
      return toEpochDay();
    }
    if (field == PROLEPTIC_MONTH) {
      return getProlepticMonth();
    }
    return get0(field);
  }
  return field.getFrom(this);
}

Fixed version (ground truth):
/** 
 * Gets the value of the specified field from this date as a   {@code long}. <p> This queries this date for the value of the specified field. If it is not possible to return the value, because the field is not supported or for some other reason, an exception is thrown. <p> If the field is a   {@link ChronoField} then the query is implemented here.The  {@link #isSupported(TemporalField) supported fields} will return validvalues based on this date. All other  {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}. <p> If the field is not a   {@code ChronoField}, then the result of this method is obtained by invoking   {@code TemporalField.getFrom(TemporalAccessor)}passing   {@code this} as the argument. Whether the value can be obtained,and what the value represents, is determined by the field.
 * @param field  the field to get, not null
 * @return the value for the field
 * @throws DateTimeException if a value for the field cannot be obtained
 * @throws UnsupportedTemporalTypeException if the field is not supported
 * @throws ArithmeticException if numeric overflow occurs
 */
@Override public long getLong(TemporalField field){
  if (field instanceof ChronoField) {
    if (field == EPOCH_DAY) {
      return toEpochDay();
    }
    if (field == PROLEPTIC_MONTH) {
      return getProlepticMonth();
    }
    return get0(field);
  }
  return field.getFrom(this);
}
Program: 78758
Project: 78758
Buggy source:
/** 
 * Returns a copy of this   {@code LocalDate} with the specified period in months subtracted.<p> This method subtracts the specified amount from the months field in three steps: <ol> <li>Subtract the input months to the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2007-03-31 minus one month would result in the invalid date 2007-02-31. Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param monthsToSubtract  the months to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the months subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusMonths(long monthsToSubtract){
  return (monthsToSubtract == Long.MIN_VALUE ? plusMonths(Long.MAX_VALUE).plusMonths(1) : plusMonths(-monthsToSubtract));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this   {@code LocalDate} with the specified number of months subtracted.<p> This method subtracts the specified amount from the months field in three steps: <ol> <li>Subtract the input months from the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2007-03-31 minus one month would result in the invalid date 2007-02-31. Instead of returning an invalid result, the last valid day of the month, 2007-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call.
 * @param monthsToSubtract  the months to subtract, may be negative
 * @return a {@code LocalDate} based on this date with the months subtracted, not null
 * @throws DateTimeException if the result exceeds the supported date range
 */
public LocalDate minusMonths(long monthsToSubtract){
  return (monthsToSubtract == Long.MIN_VALUE ? plusMonths(Long.MAX_VALUE).plusMonths(1) : plusMonths(-monthsToSubtract));
}
Program: 78759
Project: 78759
Buggy source:
public static void main(String[] args) throws Exception {
  ProcessBuilder pb;
  OutputAnalyzer out;
  pb=ProcessTools.createJavaProcessBuilder("String_Node_Str","String_Node_Str","String_Node_Str");
  out=new OutputAnalyzer(pb.start());
  out.shouldHaveExitValue(0);
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  System.out.println("String_Node_Str");
}
Program: 78760
Project: 78760
Buggy source:
/** 
 * Returns a new InputContext instance.
 */
public static InputContext getInstance(){
  return new sun.awt.im.InputMethodContext();
}

Fixed version (ground truth):
/** 
 * Returns a new InputContext instance.
 * @return a new InputContext instance
 */
public static InputContext getInstance(){
  return new sun.awt.im.InputMethodContext();
}
Program: 78761
Project: 78761
Buggy source:
/** 
 * Returns the rendering style attributes for the text range, or null.
 * @since 1.3
 */
public Map<TextAttribute,?> getStyle(){
  return style;
}

Fixed version (ground truth):
/** 
 * Returns the rendering style attributes for the text range, or null.
 * @return the rendering style attributes for the text range, or null
 * @since 1.3
 */
public Map<TextAttribute,?> getStyle(){
  return style;
}
Program: 78762
Project: 78762
Buggy source:
/** 
 * Returns the variation of the text range.
 */
public int getVariation(){
  return variation;
}

Fixed version (ground truth):
/** 
 * Returns the variation of the text range.
 * @return the variation of the text range
 */
public int getVariation(){
  return variation;
}
Program: 78763
Project: 78763
Buggy source:
/** 
 * Returns whether the text range is selected.
 */
public boolean isSelected(){
  return selected;
}

Fixed version (ground truth):
/** 
 * Returns whether the text range is selected.
 * @return whether the text range is selected
 */
public boolean isSelected(){
  return selected;
}
Program: 78764
Project: 78764
Buggy source:
/** 
 * Creates an input method event from the arguments given and dispatches it to the client component. For arguments, see   {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
 */
public void dispatchInputMethodEvent(int id,AttributedCharacterIterator text,int committedCharacterCount,TextHitInfo caret,TextHitInfo visiblePosition);

Fixed version (ground truth):
/** 
 * Creates an input method event from the arguments given and dispatches it to the client component. For arguments, see   {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
 * @param id the event type
 * @param text the combined committed and composed text
 * @param committedCharacterCount the number of committed characters in the text
 * @param caret the caret (a.k.a. insertion point); null ifthere's no caret within current composed text
 * @param visiblePosition the position that's most important to bevisible; null if there's no recommendation for a visible position within current composed text
 */
public void dispatchInputMethodEvent(int id,AttributedCharacterIterator text,int committedCharacterCount,TextHitInfo caret,TextHitInfo visiblePosition);
Program: 78765
Project: 78765
Buggy source:
/** 
 * Returns whether the list of available locales can change at runtime. This may be the case, for example, for adapters that access real input methods over the network.
 */
boolean hasDynamicLocaleList();

Fixed version (ground truth):
/** 
 * Returns whether the list of available locales can change at runtime. This may be the case, for example, for adapters that access real input methods over the network.
 * @return whether the list of available locales can change atruntime
 */
boolean hasDynamicLocaleList();
Program: 78766
Project: 78766
Buggy source:
/** 
 * Returns the user-visible name of the corresponding input method for the given input locale in the language in which the name will be displayed. <p> The inputLocale parameter specifies the locale for which text is input. This parameter can only take values obtained from this descriptor's  {@link #getAvailableLocales} method or null. If it is null, aninput locale independent name for the input method should be returned. <p> If a name for the desired display language is not available, the method may fall back to some other language.
 * @param inputLocale the locale for which text input is supported, or null
 * @param displayLanguage the language in which the name will be displayed
 */
String getInputMethodDisplayName(Locale inputLocale,Locale displayLanguage);

Fixed version (ground truth):
/** 
 * Returns the user-visible name of the corresponding input method for the given input locale in the language in which the name will be displayed. <p> The inputLocale parameter specifies the locale for which text is input. This parameter can only take values obtained from this descriptor's  {@link #getAvailableLocales} method or null. If it is null, aninput locale independent name for the input method should be returned. <p> If a name for the desired display language is not available, the method may fall back to some other language.
 * @param inputLocale the locale for which text input is supported, or null
 * @param displayLanguage the language in which the name will be displayed
 * @return the user-visible name of the corresponding input methodfor the given input locale in the language in which the name will be displayed
 */
String getInputMethodDisplayName(Locale inputLocale,Locale displayLanguage);
Program: 78767
Project: 78767
Buggy source:
/** 
 * Requests a GC that best suits this Canvas. The returned GC may differ from the requested GC passed as the argument to this method. This method must return a non-null value (given the argument is non-null as well).
 * @since 1.7
 */
GraphicsConfiguration getAppropriateGraphicsConfiguration(GraphicsConfiguration gc);

Fixed version (ground truth):
/** 
 * Requests a GC that best suits this Canvas. The returned GC may differ from the requested GC passed as the argument to this method. This method must return a non-null value (given the argument is non-null as well).
 * @param gc the requested graphics configuration
 * @return a graphics configuration that best suits this Canvas
 * @since 1.7
 */
GraphicsConfiguration getAppropriateGraphicsConfiguration(GraphicsConfiguration gc);
Program: 78768
Project: 78768
Buggy source:
/** 
 * Updates internal data structures related to the component's GC.
 * @return if the peer needs to be recreated for the changes to take effect
 * @since 1.7
 */
boolean updateGraphicsData(GraphicsConfiguration gc);

Fixed version (ground truth):
/** 
 * Updates internal data structures related to the component's GC.
 * @param gc the reference graphics configuration
 * @return if the peer needs to be recreated for the changes to take effect
 * @since 1.7
 */
boolean updateGraphicsData(GraphicsConfiguration gc);
Program: 78769
Project: 78769
Buggy source:
/** 
 * Applies the shape to the native component window.
 * @since 1.7
 * @see Component#applyCompoundShape
 */
void applyShape(Region shape);

Fixed version (ground truth):
/** 
 * Applies the shape to the native component window.
 * @param shape the shape to apply
 * @since 1.7
 * @see Component#applyCompoundShape
 */
void applyShape(Region shape);
Program: 78770
Project: 78770
Buggy source:
/** 
 * Lowers this component at the bottom of the above HW peer. If the above parameter is null then the method places this component at the top of the Z-order.
 */
void setZOrder(ComponentPeer above);

Fixed version (ground truth):
/** 
 * Lowers this component at the bottom of the above HW peer. If the above parameter is null then the method places this component at the top of the Z-order.
 * @param above the peer to lower this component with respect to
 */
void setZOrder(ComponentPeer above);
Program: 78771
Project: 78771
Buggy source:
/** 
 * Returns whether or not the window is located under the mouse pointer. The window is considered to be under the mouse pointer if it is showing on the screen, and the mouse pointer is above the part of the window that is not obscured by any other windows.
 */
boolean isWindowUnderMouse(Window w);

Fixed version (ground truth):
/** 
 * Returns whether or not the window is located under the mouse pointer. The window is considered to be under the mouse pointer if it is showing on the screen, and the mouse pointer is above the part of the window that is not obscured by any other windows.
 * @param w the window to check
 * @return whether or not the window is located under the mousepointer
 */
boolean isWindowUnderMouse(Window w);
Program: 78772
Project: 78772
Buggy source:
/** 
 * This method does two things: it fills the point fields with the current coordinates of the mouse cursor and returns the number of the screen device where the pointer is located. The number of the screen device is only returned for independent devices (which are not parts of a virtual screen device). For virtual screen devices, 0 is returned. Mouse coordinates are also calculated depending on whether or not the screen device is virtual. For virtual screen devices, pointer coordinates are calculated in the virtual coordinate system. Otherwise, coordinates are calculated in the coordinate system of the screen device where the pointer is located. See java.awt.GraphicsConfiguration documentation for more details about virtual screen devices.
 */
int fillPointWithCoords(Point point);

Fixed version (ground truth):
/** 
 * This method does two things: it fills the point fields with the current coordinates of the mouse cursor and returns the number of the screen device where the pointer is located. The number of the screen device is only returned for independent devices (which are not parts of a virtual screen device). For virtual screen devices, 0 is returned. Mouse coordinates are also calculated depending on whether or not the screen device is virtual. For virtual screen devices, pointer coordinates are calculated in the virtual coordinate system. Otherwise, coordinates are calculated in the coordinate system of the screen device where the pointer is located. See java.awt.GraphicsConfiguration documentation for more details about virtual screen devices.
 * @param point holder for the current coordinates of the mousecursor
 * @return the number of the screen device where the pointer islocated
 */
int fillPointWithCoords(Point point);
Program: 78773
Project: 78773
Buggy source:
/** 
 * Enables the per-pixel alpha support for the window.
 * @see Window#setBackground(Color)
 */
void setOpaque(boolean isOpaque);

Fixed version (ground truth):
/** 
 * Enables the per-pixel alpha support for the window.
 * @param isOpaque whether or not per-pixel alpha support isenabled
 * @see Window#setBackground(Color)
 */
void setOpaque(boolean isOpaque);
Program: 78774
Project: 78774
Buggy source:
/** 
 * Sets the level of opacity for the window.
 * @see Window#setOpacity(float)
 */
void setOpacity(float opacity);

Fixed version (ground truth):
/** 
 * Sets the level of opacity for the window.
 * @param opacity the level of opacity
 * @see Window#setOpacity(float)
 */
void setOpacity(float opacity);
Program: 78775
Project: 78775
Buggy source:
public native void declareTypes(long[] formats,SunClipboard newOwner);

Fixed version (ground truth):
private native void declareTypes(long[] formats,SunClipboard newOwner);
Program: 78776
Project: 78776
Buggy source:
protected void unregisterClipboardViewerChecked(){
}

Fixed version (ground truth):
@Override protected void unregisterClipboardViewerChecked(){
}
Program: 78777
Project: 78777
Buggy source:
private void notifyLostOwnership(){
  lostOwnershipImpl();
}

Fixed version (ground truth):
/** 
 * Native Callbacks 
 */
private void notifyLostOwnership(){
  lostOwnershipImpl();
}
Program: 78778
Project: 78778
Buggy source:
protected void registerClipboardViewerChecked(){
}

Fixed version (ground truth):
@Override protected void registerClipboardViewerChecked(){
}
Program: 78779
Project: 78779
Buggy source:
protected void setContentsNative(Transferable contents){
  DataTransferer dataTransferer=DataTransferer.getInstance();
  long[] formatArray=dataTransferer.getFormatsForTransferableAsArray(contents,flavorMap);
  declareTypes(formatArray,this);
  Map<Long,DataFlavor> formatMap=dataTransferer.getFormatsForTransferable(contents,flavorMap);
  for (  Map.Entry<Long,DataFlavor> entry : formatMap.entrySet()) {
    long format=entry.getKey();
    DataFlavor flavor=entry.getValue();
    try {
      byte[] bytes=DataTransferer.getInstance().translateTransferable(contents,flavor,format);
      setData(bytes,format);
    }
 catch (    IOException e) {
      if (!(flavor.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType) && e instanceof NotSerializableException)) {
        e.printStackTrace();
      }
    }
  }
  notifyChanged();
}

Fixed version (ground truth):
@Override protected void setContentsNative(Transferable contents){
  DataTransferer dataTransferer=DataTransferer.getInstance();
  long[] formatArray=dataTransferer.getFormatsForTransferableAsArray(contents,flavorMap);
  declareTypes(formatArray,this);
  Map<Long,DataFlavor> formatMap=dataTransferer.getFormatsForTransferable(contents,flavorMap);
  for (  Map.Entry<Long,DataFlavor> entry : formatMap.entrySet()) {
    long format=entry.getKey();
    DataFlavor flavor=entry.getValue();
    try {
      byte[] bytes=DataTransferer.getInstance().translateTransferable(contents,flavor,format);
      setData(bytes,format);
    }
 catch (    IOException e) {
      if (!(flavor.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType) && e instanceof NotSerializableException)) {
        e.printStackTrace();
      }
    }
  }
  notifyChanged();
}
Program: 78780
Project: 78780
Buggy source:
public native void setData(byte[] data,long format);

Fixed version (ground truth):
private native void setData(byte[] data,long format);
Program: 78781
Project: 78781
Buggy source:
/** 
 * Invokes native check whether a change count on the general pasteboard is different than when we set it. The different count value means the current owner lost pasteboard ownership and someone else put data on the clipboard.
 * @since 1.7
 */
public native void checkPasteboard();

Fixed version (ground truth):
/** 
 * Invokes native check whether a change count on the general pasteboard is different than when we set it. The different count value means the current owner lost pasteboard ownership and someone else put data on the clipboard.
 * @since 1.7
 */
native void checkPasteboard();
Program: 78782
Project: 78782
Buggy source:
public long getID(){
  return 0;
}

Fixed version (ground truth):
@Override public long getID(){
  return 0;
}
Program: 78783
Project: 78783
Buggy source:
protected native byte[] getClipboardData(long format) throws IOException ;

Fixed version (ground truth):
@Override protected native byte[] getClipboardData(long format) throws IOException ;
Program: 78784
Project: 78784
Buggy source:
protected native long[] getClipboardFormats();

Fixed version (ground truth):
@Override protected native long[] getClipboardFormats();
Program: 78785
Project: 78785
Buggy source:
protected void clearNativeContext(){
}

Fixed version (ground truth):
@Override protected void clearNativeContext(){
}