nus-yam/ex-repair huggingface dataset:
Program: 77021
Project: 77021
Buggy source:
/** 
 * Returns number of elements, starting at the deepest leaf, needed to get to an element representing <code>tag</code>. This will return -1 if no elements is found representing <code>tag</code>, or 0 if the parent of the leaf at <code>offset</code> represents <code>tag</code>.
 */
protected int elementCountToTag(HTMLDocument doc,int offset,HTML.Tag tag){
  int depth=-1;
  Element e=doc.getCharacterElement(offset);
  while (e != null && e.getAttributes().getAttribute(StyleConstants.NameAttribute) != tag) {
    e=e.getParentElement();
    depth++;
  }
  if (e == null) {
    return -1;
  }
  return depth;
}

Fixed version (ground truth):
/** 
 * Returns number of elements, starting at the deepest leaf, needed to get to an element representing <code>tag</code>. This will return -1 if no elements is found representing <code>tag</code>, or 0 if the parent of the leaf at <code>offset</code> represents <code>tag</code>.
 * @param doc an instance of HTMLDocument
 * @param offset an offset to start from
 * @param tag tag to represent
 * @return number of elements
 */
protected int elementCountToTag(HTMLDocument doc,int offset,HTML.Tag tag){
  int depth=-1;
  Element e=doc.getCharacterElement(offset);
  while (e != null && e.getAttributes().getAttribute(StyleConstants.NameAttribute) != tag) {
    e=e.getParentElement();
    depth++;
  }
  if (e == null) {
    return -1;
  }
  return depth;
}
Program: 77022
Project: 77022
Buggy source:
/** 
 * Parse the given stream and drive the given callback with the results of the parse.  This method should be implemented to be thread-safe.
 */
public abstract void parse(Reader r,ParserCallback cb,boolean ignoreCharSet) throws IOException ;

Fixed version (ground truth):
/** 
 * Parse the given stream and drive the given callback with the results of the parse.  This method should be implemented to be thread-safe.
 * @throws IOException if an I/O exception occurs
 */
public abstract void parse(Reader r,ParserCallback cb,boolean ignoreCharSet) throws IOException ;
Program: 77023
Project: 77023
Buggy source:
/** 
 * @return HTMLDocument of <code>e</code>.
 */
protected HTMLDocument getHTMLDocument(JEditorPane e){
  Document d=e.getDocument();
  if (d instanceof HTMLDocument) {
    return (HTMLDocument)d;
  }
  throw new IllegalArgumentException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param e the JEditorPane
 * @return HTMLDocument of <code>e</code>.
 */
protected HTMLDocument getHTMLDocument(JEditorPane e){
  Document d=e.getDocument();
  if (d instanceof HTMLDocument) {
    return (HTMLDocument)d;
  }
  throw new IllegalArgumentException("String_Node_Str");
}
Program: 77024
Project: 77024
Buggy source:
/** 
 * returns the target for the link.
 */
public String getTarget(){
  return targetFrame;
}

Fixed version (ground truth):
/** 
 * returns the target for the link.
 * @return the target for the link
 */
public String getTarget(){
  return targetFrame;
}
Program: 77026
Project: 77026
Buggy source:
@Override public Node leaveIdentNode(final IdentNode identNode){
  if (ARGUMENTS.equals(identNode.getName()) && !isCurrentArg(identNode)) {
    throw new UnsupportedOperationException();
  }
  return identNode;
}

Fixed version (ground truth):
@Override public Node leaveIdentNode(final IdentNode identNode){
  if (isParam(identNode.getName()) || ARGUMENTS.equals(identNode.getName()) && !isCurrentArg(identNode)) {
    throw new UnsupportedOperationException();
  }
  return identNode;
}
Program: 77027
Project: 77027
Buggy source:
@Override public FunctionNode apply(final FunctionNode functionNode){
  this.initialFunctionNode=functionNode;
  if (data.isVariableArity()) {
    final ApplySpecialization spec=new ApplySpecialization(data.context,data,functionNode,actualCallSiteType);
    if (spec.transform()) {
      setTransformedFunctionNode(spec.getFunctionNode());
      return transformedFunctionNode;
    }
  }
  return functionNode;
}

Fixed version (ground truth):
@Override public FunctionNode apply(final FunctionNode functionNode){
  this.initialFunctionNode=functionNode;
  if (data.isVariableArity() && !CompiledFunction.isVarArgsType(actualCallSiteType)) {
    final ApplySpecialization spec=new ApplySpecialization(data.context,data,functionNode,actualCallSiteType);
    if (spec.transform()) {
      setTransformedFunctionNode(spec.getFunctionNode());
      return transformedFunctionNode;
    }
  }
  return functionNode;
}
Program: 77028
Project: 77028
Buggy source:
/** 
 * Returns a copy of this duration with the specified duration subtracted. <p> The duration amount is measured in terms of the specified unit. Only a subset of units are accepted by this method. The unit must either have an   {@linkplain TemporalUnit#isDurationEstimated() exact duration} orbe  {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception.<p> This instance is immutable and unaffected by this method call.
 * @param amountToSubtract  the amount of the period, measured in terms of the unit, positive or negative
 * @param unit  the unit that the period is measured in, must have an exact duration, not null
 * @return a {@code Duration} based on this duration with the specified duration subtracted, not null
 * @throws ArithmeticException if numeric overflow occurs
 */
public Duration minus(long amountToSubtract,TemporalUnit unit){
  return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE,unit).plus(1,unit) : plus(-amountToSubtract,unit));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this duration with the specified duration subtracted. <p> The duration amount is measured in terms of the specified unit. Only a subset of units are accepted by this method. The unit must either have an   {@linkplain TemporalUnit#isDurationEstimated() exact duration} orbe  {@link ChronoUnit#DAYS} which is treated as 24 hours. Other units throw an exception.<p> This instance is immutable and unaffected by this method call.
 * @param amountToSubtract  the amount to subtract, measured in terms of the unit, positive or negative
 * @param unit  the unit that the amount is measured in, must have an exact duration, not null
 * @return a {@code Duration} based on this duration with the specified duration subtracted, not null
 * @throws ArithmeticException if numeric overflow occurs
 */
public Duration minus(long amountToSubtract,TemporalUnit unit){
  return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE,unit).plus(1,unit) : plus(-amountToSubtract,unit));
}
Program: 77029
Project: 77029
Buggy source:
/** 
 * Gets the set of units supported by this duration. <p> The supported units are   {@link ChronoUnit#SECONDS SECONDS}, and   {@link ChronoUnit#NANOS NANOS}. They are returned in the order seconds, nanos. <p> This set can be used in conjunction with   {@link #get(TemporalUnit)}to access the entire state of the period.
 * @return a list containing the seconds and nanos units, not null
 */
@Override public List<TemporalUnit> getUnits(){
  return DurationUnits.UNITS;
}

Fixed version (ground truth):
/** 
 * Gets the set of units supported by this duration. <p> The supported units are   {@link ChronoUnit#SECONDS SECONDS}, and   {@link ChronoUnit#NANOS NANOS}. They are returned in the order seconds, nanos. <p> This set can be used in conjunction with   {@link #get(TemporalUnit)}to access the entire state of the duration.
 * @return a list containing the seconds and nanos units, not null
 */
@Override public List<TemporalUnit> getUnits(){
  return DurationUnits.UNITS;
}
Program: 77030
Project: 77030
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: 77031
Project: 77031
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: 77032
Project: 77032
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: 77033
Project: 77033
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: 77034
Project: 77034
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: 77035
Project: 77035
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: 77036
Project: 77036
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: 77037
Project: 77037
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: 77038
Project: 77038
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: 77040
Project: 77040
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: 77041
Project: 77041
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: 77042
Project: 77042
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: 77043
Project: 77043
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: 77044
Project: 77044
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: 77045
Project: 77045
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: 77046
Project: 77046
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: 77047
Project: 77047
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: 77048
Project: 77048
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: 77049
Project: 77049
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: 77050
Project: 77050
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: 77051
Project: 77051
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: 77052
Project: 77052
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: 77053
Project: 77053
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: 77054
Project: 77054
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: 77055
Project: 77055
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: 77056
Project: 77056
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: 77057
Project: 77057
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: 77058
Project: 77058
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);