nus-yam/ex-repair huggingface dataset:
Program: 15669
Project: 15669
Buggy source:
public TemplateDateFormat get(int dateType,String formatDescriptor) throws java.text.ParseException, UnknownDateTypeFormattingUnsupportedException {
  return new XSTemplateDateFormat(formatDescriptor,2,dateType,getTimeZone(),this);
}

Fixed version (ground truth):
public TemplateDateFormat get(int dateType,boolean zonelessInput,String formatDescriptor) throws java.text.ParseException, UnknownDateTypeFormattingUnsupportedException {
  return new XSTemplateDateFormat(formatDescriptor,2,dateType,zonelessInput,getTimeZone(),this);
}
Program: 15671
Project: 15671
Buggy source:
/** 
 * Same as   {@link #parseXSDateTime(String,TimeZone,CalendarFieldsToDateConverter)}, but the hint parameter is   {@code null}.
 */
public static Date parseXSDateTime(String dateTimeStr,TimeZone defaultTimeZone) throws DateParseException {
  return parseXSDateTime(dateTimeStr,defaultTimeZone,null);
}

Fixed version (ground truth):
/** 
 * Parses an W3C XML Schema date-time string (not date or time). Unlike in ISO 8601:2000 Second Edition, year -1 means B.C 1, and year 0 is invalid. 
 * @param dateTimeStr the string to parse. 
 * @param defaultTZ used if the dateTime doesn't specify thetime zone offset explicitly. Can't be  {@code null}. 
 * @throws DateParseException if the dateTime is malformed.
 */
public static Date parseXSDateTime(String dateTimeStr,TimeZone defaultTZ,CalendarFieldsToDateConverter calToDateConverter) throws DateParseException {
  Matcher m=PATTERN_XS_DATE_TIME.matcher(dateTimeStr);
  if (!m.matches()) {
    throw parseXSDateTime_newExc(dateTimeStr,null);
  }
  return parseXSDateTime_parseMatcher(dateTimeStr,m,defaultTZ,calToDateConverter);
}
Program: 15672
Project: 15672
Buggy source:
private static Date parseXSDate_parseMatcher(String dateStr,Matcher m,TimeZone defaultTimeZone,CalendarFieldsToDateConverter calToDateConverter) throws DateParseException {
  try {
    try {
      int year=parseXS_groupToInt(m.group(1),"String_Node_Str",Integer.MIN_VALUE,Integer.MAX_VALUE);
      int era;
      if (year <= 0) {
        era=GregorianCalendar.BC;
        year=-year;
      }
 else {
        era=GregorianCalendar.AD;
      }
      int month=parseXS_groupToInt(m.group(2),"String_Node_Str",1,12) - 1;
      int day=parseXS_groupToInt(m.group(3),"String_Node_Str",1,31);
      TimeZone tz=parseXS_parseTimeZone(m.group(4),defaultTimeZone);
      return calToDateConverter.calculate(era,year,month,day,0,0,0,0,tz);
    }
 catch (    IllegalArgumentException e) {
      throw new DatePartParseException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    }
  }
 catch (  DatePartParseException e) {
    throw parseXSDate_newExc(dateStr,e.getMessage());
  }
}

Fixed version (ground truth):
private static Date parseXSDate_parseMatcher(String dateStr,Matcher m,TimeZone defaultTZ,CalendarFieldsToDateConverter calToDateConverter) throws DateParseException {
  NullArgumentException.check("String_Node_Str",defaultTZ);
  try {
    try {
      int year=parseXS_groupToInt(m.group(1),"String_Node_Str",Integer.MIN_VALUE,Integer.MAX_VALUE);
      int era;
      if (year == 0) {
        throw new DateParseException(MSG_YEAR_0_NOT_ALLOWED);
      }
      if (year < 0) {
        era=GregorianCalendar.BC;
        year=-year;
      }
 else {
        era=GregorianCalendar.AD;
      }
      int month=parseXS_groupToInt(m.group(2),"String_Node_Str",1,12) - 1;
      int day=parseXS_groupToInt(m.group(3),"String_Node_Str",1,31);
      TimeZone tz=parseXS_parseTimeZone(m.group(4),defaultTZ);
      return calToDateConverter.calculate(era,year,month,day,0,0,0,0,tz);
    }
 catch (    IllegalArgumentException e) {
      throw new DatePartParseException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    }
  }
 catch (  DatePartParseException e) {
    throw parseXSDate_newExc(dateStr,e.getMessage());
  }
}
Program: 15674
Project: 15674
Buggy source:
private static Date parseXSTime_parseMatcher(String timeStr,Matcher m,TimeZone defaultTZ,CalendarFieldsToDateConverter calToDateConverter) throws DateParseException {
  try {
    try {
      int hours=parseXS_groupToInt(m.group(1),"String_Node_Str",0,24);
      boolean hourWas24;
      if (hours == 24) {
        hours=0;
        hourWas24=true;
      }
 else {
        hourWas24=false;
      }
      int minutes=parseXS_groupToInt(m.group(2),"String_Node_Str",0,59);
      int secs=parseXS_groupToInt(m.group(3),"String_Node_Str",0,60);
      int millisecs=parseXS_groupToMillisecond(m.group(4));
      TimeZone tz=parseXS_parseTimeZone(m.group(5),defaultTZ);
      int day;
      if (hourWas24) {
        if (minutes == 0 && secs == 0) {
          day=2;
        }
 else {
          throw new DatePartParseException("String_Node_Str" + "String_Node_Str");
        }
      }
 else {
        day=1;
      }
      return calToDateConverter.calculate(GregorianCalendar.AD,1970,0,day,hours,minutes,secs,millisecs,tz);
    }
 catch (    IllegalArgumentException e) {
      throw new DatePartParseException("String_Node_Str");
    }
  }
 catch (  DatePartParseException e) {
    throw parseXSTime_newExc(timeStr,e.getMessage());
  }
}

Fixed version (ground truth):
private static Date parseXSTime_parseMatcher(String timeStr,Matcher m,TimeZone defaultTZ,CalendarFieldsToDateConverter calToDateConverter) throws DateParseException {
  NullArgumentException.check("String_Node_Str",defaultTZ);
  try {
    try {
      int hours=parseXS_groupToInt(m.group(1),"String_Node_Str",0,24);
      boolean hourWas24;
      if (hours == 24) {
        hours=0;
        hourWas24=true;
      }
 else {
        hourWas24=false;
      }
      int minutes=parseXS_groupToInt(m.group(2),"String_Node_Str",0,59);
      int secs=parseXS_groupToInt(m.group(3),"String_Node_Str",0,60);
      int millisecs=parseXS_groupToMillisecond(m.group(4));
      TimeZone tz=parseXS_parseTimeZone(m.group(5),defaultTZ);
      int day;
      if (hourWas24) {
        if (minutes == 0 && secs == 0) {
          day=2;
        }
 else {
          throw new DatePartParseException("String_Node_Str" + "String_Node_Str");
        }
      }
 else {
        day=1;
      }
      return calToDateConverter.calculate(GregorianCalendar.AD,1970,0,day,hours,minutes,secs,millisecs,tz);
    }
 catch (    IllegalArgumentException e) {
      throw new DatePartParseException("String_Node_Str");
    }
  }
 catch (  DatePartParseException e) {
    throw parseXSTime_newExc(timeStr,e.getMessage());
  }
}
Program: 15675
Project: 15675
Buggy source:
public GregorianCalendar get(TimeZone tz,Date date){
  if (calendar == null) {
    calendar=new GregorianCalendar(tz,Locale.US);
  }
 else {
    calendar.setTimeZone(tz);
  }
  calendar.setTime(date);
  return calendar;
}

Fixed version (ground truth):
public GregorianCalendar get(TimeZone tz,Date date){
  if (calendar == null) {
    calendar=new GregorianCalendar(tz,Locale.US);
    calendar.setGregorianChange(new Date(Long.MIN_VALUE));
  }
 else {
    calendar.setTimeZone(tz);
  }
  calendar.setTime(date);
  return calendar;
}
Program: 15676
Project: 15676
Buggy source:
public Date calculate(int era,int year,int month,int day,int hours,int minutes,int secs,int millisecs,TimeZone tz){
  if (calendar == null) {
    calendar=new GregorianCalendar(tz,Locale.US);
  }
 else {
    calendar.setTimeZone(tz);
  }
  calendar.set(Calendar.ERA,era);
  calendar.set(Calendar.YEAR,year);
  calendar.set(Calendar.MONTH,month);
  calendar.set(Calendar.DAY_OF_MONTH,day);
  calendar.set(Calendar.HOUR_OF_DAY,hours);
  calendar.set(Calendar.MINUTE,minutes);
  calendar.set(Calendar.SECOND,secs);
  calendar.set(Calendar.MILLISECOND,millisecs);
  return calendar.getTime();
}

Fixed version (ground truth):
public Date calculate(int era,int year,int month,int day,int hours,int minutes,int secs,int millisecs,TimeZone tz){
  if (calendar == null) {
    calendar=new GregorianCalendar(tz,Locale.US);
    calendar.setLenient(false);
    calendar.setGregorianChange(new Date(Long.MIN_VALUE));
  }
 else {
    calendar.setTimeZone(tz);
  }
  calendar.set(Calendar.ERA,era);
  calendar.set(Calendar.YEAR,year);
  calendar.set(Calendar.MONTH,month);
  calendar.set(Calendar.DAY_OF_MONTH,day);
  calendar.set(Calendar.HOUR_OF_DAY,hours);
  calendar.set(Calendar.MINUTE,minutes);
  calendar.set(Calendar.SECOND,secs);
  calendar.set(Calendar.MILLISECOND,millisecs);
  return calendar.getTime();
}
Program: 15677
Project: 15677
Buggy source:
public Date getAsDate() throws TemplateModelException {
  if (cachedValue == null) {
    cachedValue=parse(env.getTemplateDateFormat(dateType,Date.class,target));
  }
  return cachedValue;
}

Fixed version (ground truth):
public Date getAsDate() throws TemplateModelException {
  if (cachedValue == null) {
    cachedValue=parse(defaultFormat);
  }
  return cachedValue;
}
Program: 15678
Project: 15678
Buggy source:
DateParser(String text,Environment env) throws TemplateModelException {
  this.text=text;
  this.env=env;
}

Fixed version (ground truth):
DateParser(String text,Environment env) throws TemplateModelException {
  this.text=text;
  this.env=env;
  this.defaultFormat=env.getTemplateDateFormat(dateType,Date.class,target);
}
Program: 15679
Project: 15679
Buggy source:
private static LoggerFactory createFactory(int library) throws ClassNotFoundException {
  String loggerClassName=LIBINIT[library * 2];
  String factoryType=LIBINIT[library * 2 + 1];
  try {
    ClassUtil.forName(loggerClassName);
    return (LoggerFactory)Class.forName("String_Node_Str" + factoryType + "String_Node_Str").newInstance();
  }
 catch (  IllegalAccessException e) {
    throw new IllegalAccessError(e.getMessage());
  }
catch (  InstantiationException e) {
    throw new InstantiationError(e.getMessage());
  }
}

Fixed version (ground truth):
private static LoggerFactory createFactory(int library) throws ClassNotFoundException {
  String loggerClassName=LIBINIT[library * 2];
  String factoryType=LIBINIT[library * 2 + 1];
  try {
    Class.forName(loggerClassName);
    return (LoggerFactory)Class.forName("String_Node_Str" + factoryType + "String_Node_Str").newInstance();
  }
 catch (  IllegalAccessException e) {
    throw new IllegalAccessError(e.getMessage());
  }
catch (  InstantiationException e) {
    throw new InstantiationError(e.getMessage());
  }
}
Program: 15680
Project: 15680
Buggy source:
private Template loadTemplate(TemplateLoader loader,String name,Locale locale,String encoding,boolean parse,Object source) throws IOException {
  Template template;
  Reader reader=loader.getReader(source,encoding);
  try {
    if (parse) {
      try {
        template=new Template(name,reader,config,encoding);
      }
 catch (      Template.WrongEncodingException wee) {
        encoding=wee.specifiedEncoding;
        reader=loader.getReader(source,encoding);
        template=new Template(name,reader,config,encoding);
      }
      template.setLocale(locale);
    }
 else {
      StringWriter sw=new StringWriter();
      char[] buf=new char[4096];
      for (; ; ) {
        int charsRead=reader.read(buf);
        if (charsRead > 0) {
          sw.write(buf,0,charsRead);
        }
 else         if (charsRead == -1) {
          break;
        }
      }
      template=Template.getPlainTextTemplate(name,sw.toString(),config);
      template.setLocale(locale);
    }
    template.setEncoding(encoding);
  }
  finally {
    reader.close();
  }
  return template;
}

Fixed version (ground truth):
private Template loadTemplate(TemplateLoader loader,String name,Locale locale,String encoding,boolean parse,Object source) throws IOException {
  Template template;
  Reader reader=loader.getReader(source,encoding);
  try {
    if (parse) {
      try {
        template=new Template(name,reader,config,encoding);
      }
 catch (      Template.WrongEncodingException wee) {
        encoding=wee.specifiedEncoding;
        reader.close();
        reader=loader.getReader(source,encoding);
        template=new Template(name,reader,config,encoding);
      }
      template.setLocale(locale);
    }
 else {
      StringWriter sw=new StringWriter();
      char[] buf=new char[4096];
      for (; ; ) {
        int charsRead=reader.read(buf);
        if (charsRead > 0) {
          sw.write(buf,0,charsRead);
        }
 else         if (charsRead == -1) {
          break;
        }
      }
      template=Template.getPlainTextTemplate(name,sw.toString(),config);
      template.setLocale(locale);
    }
    template.setEncoding(encoding);
  }
  finally {
    reader.close();
  }
  return template;
}
Program: 15681
Project: 15681
Buggy source:
/** 
 * Returns the character stream of a template represented by the specified template source. This method is called after <code>getLastModified()</code> if it's determined that a cached copy of the template is unavailable or stale.
 * @param templateSource an object representing a template source, obtainedthrough a prior call to  {@link #findTemplateSource(String)}.
 * @param encoding the character encoding used to translate source bytesto characters. Some loaders may not have access to the byte representation of the template stream, and instead directly obtain a  character stream. These loaders will should ignore the encoding parameter.
 * @return a reader representing the template character stream. Theframework will call <code>close()</code>.
 * @throws IOException if an I/O error occurs while accessing the stream.
 */
public Reader getReader(Object templateSource,String encoding) throws IOException ;

Fixed version (ground truth):
/** 
 * Returns the character stream of a template represented by the specified template source. This method is possibly called for multiple times for the same template source object, and it must always return a   {@link Reader} thatreads the template from its beginning. Before this method is called for the second time (or later), its caller must close the previously returned {@link Reader}, and it must not use it anymore. That is, this method is not required to support multiple concurrent readers for the same source  {@code templateSource} object.<p>Typically, this method is called if the template is missing from the cache, or if after calling  {@link #findTemplateSource(String)} and {@link #getLastModified(Object)}it was determined that the cached copy of the template is stale. Then, if it turns out that the  {@code encoding} parameter passed doesn't match the actual template content, this method will be called for asecond time with the correct  {@code encoding} parameter value.
 * @param templateSource an object representing a template source, obtainedthrough a prior call to  {@link #findTemplateSource(String)}.
 * @param encoding the character encoding used to translate source bytesto characters. Some loaders may not have access to the byte representation of the template stream, and instead directly obtain a  character stream. These loaders should ignore the encoding parameter.
 * @return a reader representing the template character stream. It'sthe responsibility of the caller ( {@link TemplateCache} usually) to{@code close()} it.
 * @throws IOException if an I/O error occurs while accessing the stream.
 */
public Reader getReader(Object templateSource,String encoding) throws IOException ;
Program: 15682
Project: 15682
Buggy source:
/** 
 * Closes the template source. This is the last method that is called by the   {@link TemplateCache} for a template source. The framework guarantees thatthis method will be called on every object that is returned from {@link #findTemplateSource(String)}.
 * @param templateSource the template source that should be closed.
 */
public void closeTemplateSource(Object templateSource) throws IOException ;

Fixed version (ground truth):
/** 
 * Closes the template source. This is the last method that is called by the   {@link TemplateCache} for a template source. {@link TemplateCache} ensures thatthis method will be called on every object that is returned from {@link #findTemplateSource(String)}.
 * @param templateSource the template source that should be closed.
 */
public void closeTemplateSource(Object templateSource) throws IOException ;
Program: 15683
Project: 15683
Buggy source:
InputStream getInputStream() throws IOException {
  inputStream=conn.getInputStream();
  return inputStream;
}

Fixed version (ground truth):
InputStream getInputStream() throws IOException {
  if (inputStream != null) {
    try {
      inputStream.close();
    }
 catch (    IOException e) {
    }
    this.conn=url.openConnection();
  }
  inputStream=conn.getInputStream();
  return inputStream;
}
Program: 15685
Project: 15685
Buggy source:
/** 
 * Returns the names of the supported "built-ins". These are the (  {@code expr?builtin_name}-like things). As of this writing, this information doesn't depend on the configuration options, so it could be a static method, but to be future-proof, it's an instance method. 
 * @return {@link Set} of {@link String}-s. 
 */
public Set getSupportedBuiltInNames(){
  return _CoreAPI.getSupportedBuiltInNames();
}

Fixed version (ground truth):
/** 
 * Returns the names of the supported "built-ins". These are the (  {@code expr?builtin_name}-like things). As of this writing, this information doesn't depend on the configuration options, so it could be a static method, but to be future-proof, it's an instance method. 
 * @return {@link Set} of {@link String}-s.
 * @since 2.3.20
 */
public Set getSupportedBuiltInNames(){
  return _CoreAPI.getSupportedBuiltInNames();
}
Program: 15686
Project: 15686
Buggy source:
/** 
 * Trivial comparison of type specificities; unaware of numerical conversions. 
 * @return Less-than-0, 0, or more-than-0 depending on which side is more specific. The absolute value is 1 ifthe difference is only in primitive VS non-primitive, more otherwise.
 */
private int compareParameterListPreferability_cmpTypeSpecificty(final Class paramType1,final Class paramType2){
  final Class nonPrimParamType1=paramType1.isPrimitive() ? ClassUtil.primitiveClassToBoxingClass(paramType1) : paramType1;
  final Class nonPrimParamType2=paramType2.isPrimitive() ? ClassUtil.primitiveClassToBoxingClass(paramType2) : paramType2;
  if (nonPrimParamType1 == nonPrimParamType2) {
    if (nonPrimParamType1 != paramType1) {
      if (nonPrimParamType2 != paramType2) {
        return 0;
      }
 else {
        return 1;
      }
    }
 else     if (nonPrimParamType2 != paramType2) {
      return -1;
    }
 else {
      return 0;
    }
  }
 else   if (nonPrimParamType2.isAssignableFrom(nonPrimParamType1)) {
    return 2;
  }
 else   if (nonPrimParamType1.isAssignableFrom(nonPrimParamType2)) {
    return -2;
  }
  if (nonPrimParamType1 == Character.class && nonPrimParamType2 == String.class) {
    return 2;
  }
  if (nonPrimParamType1 == String.class && nonPrimParamType2 == Character.class) {
    return -2;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
/** 
 * Trivial comparison of type specificities; unaware of numerical conversions. 
 * @return Less-than-0, 0, or more-than-0 depending on which side is more specific. The absolute value is 1 ifthe difference is only in primitive VS non-primitive, more otherwise.
 */
private int compareParameterListPreferability_cmpTypeSpecificty(final Class paramType1,final Class paramType2){
  final Class nonPrimParamType1=paramType1.isPrimitive() ? ClassUtil.primitiveClassToBoxingClass(paramType1) : paramType1;
  final Class nonPrimParamType2=paramType2.isPrimitive() ? ClassUtil.primitiveClassToBoxingClass(paramType2) : paramType2;
  if (nonPrimParamType1 == nonPrimParamType2) {
    if (nonPrimParamType1 != paramType1) {
      if (nonPrimParamType2 != paramType2) {
        return 0;
      }
 else {
        return 1;
      }
    }
 else     if (nonPrimParamType2 != paramType2) {
      return -1;
    }
 else {
      return 0;
    }
  }
 else   if (nonPrimParamType2.isAssignableFrom(nonPrimParamType1)) {
    return 2;
  }
 else   if (nonPrimParamType1.isAssignableFrom(nonPrimParamType2)) {
    return -2;
  }
  if (nonPrimParamType1 == Character.class && nonPrimParamType2.isAssignableFrom(String.class)) {
    return 2;
  }
  if (nonPrimParamType2 == Character.class && nonPrimParamType1.isAssignableFrom(String.class)) {
    return -2;
  }
 else {
    return 0;
  }
}
Program: 15687
Project: 15687
Buggy source:
public void testCharIsMoreSpecificThanString(){
  testAllCmpPermutationsInc(new Class[][]{new Class[]{char.class},new Class[]{Character.class},new Class[]{String.class}},new Object[]{"String_Node_Str"});
  testAllCmpPermutationsInc(new Class[][]{new Class[]{char.class},new Class[]{Character.class},new Class[]{String.class}},new Object[]{'c'});
}

Fixed version (ground truth):
public void testCharIsMoreSpecificThanString(){
  testAllCmpPermutationsInc(new Class[][]{new Class[]{char.class},new Class[]{Character.class},new Class[]{String.class},new Class[]{CharSequence.class}},new Object[]{"String_Node_Str"});
  testAllCmpPermutationsInc(new Class[][]{new Class[]{char.class},new Class[]{Character.class},new Class[]{String.class}},new Object[]{'c'});
}
Program: 15688
Project: 15688
Buggy source:
public int hashCode(){
  int r=hashCode;
  if (r != 0)   return r;
synchronized (this) {
    if (hashCode == 0) {
      final int prime=31;
      int result=1;
      result=prime * result + (buildDate == null ? 0 : buildDate.hashCode());
      result=prime * result + (extraInfo == null ? 0 : extraInfo.hashCode());
      result=prime * result + (gaeCompliant == null ? 0 : gaeCompliant.hashCode());
      result=prime * result + intValue;
      String stringValue=getStringValue();
      result=prime * result + (stringValue == null ? 0 : stringValue.hashCode());
      if (result == 0)       result=-1;
      hashCode=result;
    }
    return hashCode;
  }
}

Fixed version (ground truth):
public int hashCode(){
  int r=hashCode;
  if (r != 0)   return r;
synchronized (this) {
    if (hashCode == 0) {
      final int prime=31;
      int result=1;
      result=prime * result + (buildDate == null ? 0 : buildDate.hashCode());
      result=prime * result + (extraInfo == null ? 0 : extraInfo.hashCode());
      result=prime * result + (gaeCompliant == null ? 0 : gaeCompliant.hashCode());
      result=prime * result + intValue;
      if (result == 0)       result=-1;
      hashCode=result;
    }
    return hashCode;
  }
}
Program: 15689
Project: 15689
Buggy source:
public Object newInstance(Class clazz,List arguments) throws TemplateModelException {
  try {
    Object ctors=classIntrospector.get(clazz).get(ClassIntrospector.CONSTRUCTORS_KEY);
    if (ctors == null) {
      throw new TemplateModelException("String_Node_Str" + clazz.getName() + "String_Node_Str");
    }
    Constructor ctor=null;
    Object[] objargs;
    if (ctors instanceof SimpleMethod) {
      SimpleMethod sm=(SimpleMethod)ctors;
      ctor=(Constructor)sm.getMember();
      objargs=sm.unwrapArguments(arguments,this);
      try {
        return ctor.newInstance(objargs);
      }
 catch (      Exception e) {
        throw _MethodUtil.newInvocationTemplateModelException(null,ctor,e);
      }
    }
 else     if (ctors instanceof OverloadedMethods) {
      final MemberAndArguments mma=((OverloadedMethods)ctors).getMemberAndArguments(arguments,this);
      try {
        return mma.invokeConstructor(this);
      }
 catch (      Exception e) {
        throw _MethodUtil.newInvocationTemplateModelException(null,mma.getCallableMemberDescriptor(),e);
      }
    }
 else {
      throw new BugException();
    }
  }
 catch (  TemplateModelException e) {
    throw e;
  }
catch (  Exception e) {
    throw new TemplateModelException("String_Node_Str" + clazz.getName() + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
public Object newInstance(Class clazz,List arguments) throws TemplateModelException {
  try {
    Object ctors=classIntrospector.get(clazz).get(ClassIntrospector.CONSTRUCTORS_KEY);
    if (ctors == null) {
      throw new TemplateModelException("String_Node_Str" + clazz.getName() + "String_Node_Str");
    }
    Constructor ctor=null;
    Object[] objargs;
    if (ctors instanceof SimpleMethod) {
      SimpleMethod sm=(SimpleMethod)ctors;
      ctor=(Constructor)sm.getMember();
      objargs=sm.unwrapArguments(arguments,this);
      try {
        return ctor.newInstance(objargs);
      }
 catch (      Exception e) {
        if (e instanceof TemplateModelException)         throw (TemplateModelException)e;
        throw _MethodUtil.newInvocationTemplateModelException(null,ctor,e);
      }
    }
 else     if (ctors instanceof OverloadedMethods) {
      final MemberAndArguments mma=((OverloadedMethods)ctors).getMemberAndArguments(arguments,this);
      try {
        return mma.invokeConstructor(this);
      }
 catch (      Exception e) {
        if (e instanceof TemplateModelException)         throw (TemplateModelException)e;
        throw _MethodUtil.newInvocationTemplateModelException(null,mma.getCallableMemberDescriptor(),e);
      }
    }
 else {
      throw new BugException();
    }
  }
 catch (  TemplateModelException e) {
    throw e;
  }
catch (  Exception e) {
    throw new TemplateModelException("String_Node_Str" + clazz.getName() + "String_Node_Str",e);
  }
}
Program: 15691
Project: 15691
Buggy source:
protected String doConversion(Object obj){
  final CallableMemberDescriptor firstMemberDesc;
  Iterator fixArgMethodsIter=fixArgMethods.getMemberDescriptors();
  if (fixArgMethodsIter.hasNext()) {
    firstMemberDesc=(CallableMemberDescriptor)fixArgMethodsIter.next();
  }
 else {
    Iterator varArgMethods=varargMethods != null ? varargMethods.getMemberDescriptors() : null;
    if (varArgMethods != null && varArgMethods.hasNext()) {
      firstMemberDesc=(CallableMemberDescriptor)varArgMethods.next();
    }
 else {
      firstMemberDesc=null;
    }
  }
  StringBuffer sb=new StringBuffer();
  if (firstMemberDesc != null) {
    if (firstMemberDesc.isConstructor()) {
      sb.append("String_Node_Str");
    }
 else {
      sb.append("String_Node_Str");
    }
    sb.append(firstMemberDesc.getName());
  }
 else {
    sb.append("String_Node_Str");
  }
  sb.append('(');
  for (int i=0; i < argumentTypeDescs.length; i++) {
    if (i != 0)     sb.append("String_Node_Str");
    sb.append(argumentTypeDescs[i]);
  }
  sb.append(')');
  return sb.toString();
}

Fixed version (ground truth):
protected String doConversion(Object obj){
  final CallableMemberDescriptor firstMemberDesc;
  Iterator fixArgMethodsIter=fixArgMethods.getMemberDescriptors();
  if (fixArgMethodsIter.hasNext()) {
    firstMemberDesc=(CallableMemberDescriptor)fixArgMethodsIter.next();
  }
 else {
    Iterator varArgMethods=varargMethods != null ? varargMethods.getMemberDescriptors() : null;
    if (varArgMethods != null && varArgMethods.hasNext()) {
      firstMemberDesc=(CallableMemberDescriptor)varArgMethods.next();
    }
 else {
      firstMemberDesc=null;
    }
  }
  StringBuffer sb=new StringBuffer();
  if (firstMemberDesc != null) {
    sb.append(firstMemberDesc.getName());
  }
 else {
    sb.append("String_Node_Str");
  }
  sb.append('(');
  for (int i=0; i < argumentTypeDescs.length; i++) {
    if (i != 0)     sb.append("String_Node_Str");
    sb.append(argumentTypeDescs[i]);
  }
  sb.append(')');
  return sb.toString();
}
Program: 15692
Project: 15692
Buggy source:
MemberAndArguments getMemberAndArguments(List tmArgs,BeansWrapper unwrapper) throws TemplateModelException {
  MaybeEmptyMemberAndArguments fixArgsRes=null;
  MaybeEmptyMemberAndArguments varargsRes=null;
  if ((fixArgsRes=fixArgMethods.getMemberAndArguments(tmArgs,unwrapper)) instanceof MemberAndArguments) {
    return (MemberAndArguments)fixArgsRes;
  }
 else   if (varargMethods != null && (varargsRes=varargMethods.getMemberAndArguments(tmArgs,unwrapper)) instanceof MemberAndArguments) {
    return (MemberAndArguments)varargsRes;
  }
 else {
    MaybeEmptyMemberAndArguments res=getClosestToSuccess(fixArgsRes,varargsRes);
    if (res == EmptyMemberAndArguments.NO_SUCH_METHOD) {
      throw new _TemplateModelException(new Object[]{"String_Node_Str" + "String_Node_Str",getDeducedCallSignature(tmArgs),"String_Node_Str",memberListToString()});
    }
 else     if (res == EmptyMemberAndArguments.AMBIGUOUS_METHOD) {
      throw new _TemplateModelException(new Object[]{"String_Node_Str" + "String_Node_Str",getDeducedCallSignature(tmArgs),"String_Node_Str",memberListToString()});
    }
 else {
      throw new BugException("String_Node_Str" + res);
    }
  }
}

Fixed version (ground truth):
MemberAndArguments getMemberAndArguments(List tmArgs,BeansWrapper unwrapper) throws TemplateModelException {
  MaybeEmptyMemberAndArguments fixArgsRes=null;
  MaybeEmptyMemberAndArguments varargsRes=null;
  if ((fixArgsRes=fixArgMethods.getMemberAndArguments(tmArgs,unwrapper)) instanceof MemberAndArguments) {
    return (MemberAndArguments)fixArgsRes;
  }
 else   if (varargMethods != null && (varargsRes=varargMethods.getMemberAndArguments(tmArgs,unwrapper)) instanceof MemberAndArguments) {
    return (MemberAndArguments)varargsRes;
  }
 else {
    MaybeEmptyMemberAndArguments res=getClosestToSuccess(fixArgsRes,varargsRes);
    if (res == EmptyMemberAndArguments.NO_SUCH_METHOD) {
      throw new _TemplateModelException(new Object[]{"String_Node_Str",MSG_PART_OVEARLOAD_WAS_FOUND_FOR_ACTUAL_PARAMETER_TYPES,getActualParameterTypes(tmArgs),MSG_PART_THE_MATCHING_OVERLOAD_WAS_SEARCHED_AMONG,memberListToString()});
    }
 else     if (res == EmptyMemberAndArguments.AMBIGUOUS_METHOD) {
      throw new _TemplateModelException(new Object[]{"String_Node_Str",MSG_PART_OVEARLOAD_WAS_FOUND_FOR_ACTUAL_PARAMETER_TYPES,getActualParameterTypes(tmArgs),MSG_PART_THE_MATCHING_OVERLOAD_WAS_SEARCHED_AMONG,memberListToString()});
    }
 else {
      throw new BugException("String_Node_Str" + res);
    }
  }
}
Program: 15693
Project: 15693
Buggy source:
/** 
 * Invokes the method, passing it the arguments from the list. The actual method to call from several overloaded methods will be chosen based on the classes of the arguments.
 * @throws TemplateModelException if the method cannot be chosenunambiguously.
 */
public Object exec(List arguments) throws TemplateModelException {
  MemberAndArguments maa=overloadedMethods.getMemberAndArguments(arguments,wrapper);
  try {
    return maa.invokeMethod(wrapper,object);
  }
 catch (  Exception e) {
    throw _MethodUtil.newInvocationTemplateModelException(object,maa.getCallableMemberDescriptor(),e);
  }
}

Fixed version (ground truth):
/** 
 * Invokes the method, passing it the arguments from the list. The actual method to call from several overloaded methods will be chosen based on the classes of the arguments.
 * @throws TemplateModelException if the method cannot be chosenunambiguously.
 */
public Object exec(List arguments) throws TemplateModelException {
  MemberAndArguments maa=overloadedMethods.getMemberAndArguments(arguments,wrapper);
  try {
    return maa.invokeMethod(wrapper,object);
  }
 catch (  Exception e) {
    if (e instanceof TemplateModelException)     throw (TemplateModelException)e;
    throw _MethodUtil.newInvocationTemplateModelException(object,maa.getCallableMemberDescriptor(),e);
  }
}
Program: 15694
Project: 15694
Buggy source:
private static TemplateModelException createNullToPrimitiveArgumentException(int argIdx,Class targetType){
  return new _TemplateModelException(new Object[]{"String_Node_Str",new Integer(argIdx + 1),"String_Node_Str",targetType.getName(),"String_Node_Str"});
}

Fixed version (ground truth):
private TemplateModelException createNullToPrimitiveArgumentException(int argIdx,Class targetType){
  return new _TemplateModelException(new Object[]{_MethodUtil.invocationErrorMessageStart(member),"String_Node_Str",new _DelayedOrdinal(new Integer(argIdx + 1)),"String_Node_Str",ClassUtil.getShortClassName(targetType),"String_Node_Str"});
}
Program: 15695
Project: 15695
Buggy source:
private static TemplateModelException createArgumentTypeMismarchException(int argIdx,TemplateModel argVal,Class targetType){
  return new _TemplateModelException(new Object[]{"String_Node_Str",new Integer(argIdx + 1),"String_Node_Str" + "String_Node_Str",new _DelayedFTLTypeDescription(argVal),"String_Node_Str",ClassUtil.getShortClassName(targetType),"String_Node_Str"});
}

Fixed version (ground truth):
private TemplateModelException createArgumentTypeMismarchException(int argIdx,TemplateModel argVal,Class targetType){
  return new _TemplateModelException(new Object[]{_MethodUtil.invocationErrorMessageStart(member),"String_Node_Str",new _DelayedOrdinal(new Integer(argIdx + 1)),"String_Node_Str",ClassUtil.getShortClassName(targetType),"String_Node_Str",new _DelayedFTLTypeDescription(argVal)});
}
Program: 15697
Project: 15697
Buggy source:
/** 
 * Invokes the method, passing it the arguments from the list.
 */
public Object exec(List arguments) throws TemplateModelException {
  try {
    return wrapper.invokeMethod(object,(Method)getMember(),unwrapArguments(arguments,wrapper));
  }
 catch (  TemplateModelException e) {
    throw e;
  }
catch (  Exception e) {
    throw _MethodUtil.newInvocationTemplateModelException(object,getMember(),e);
  }
}

Fixed version (ground truth):
/** 
 * Invokes the method, passing it the arguments from the list.
 */
public Object exec(List arguments) throws TemplateModelException {
  try {
    return wrapper.invokeMethod(object,(Method)getMember(),unwrapArguments(arguments,wrapper));
  }
 catch (  TemplateModelException e) {
    throw e;
  }
catch (  Exception e) {
    if (e instanceof TemplateModelException)     throw (TemplateModelException)e;
    throw _MethodUtil.newInvocationTemplateModelException(object,getMember(),e);
  }
}
Program: 15698
Project: 15698
Buggy source:
private static TemplateModelException newInvocationTemplateModelException(Object parentObject,Object member,boolean isStatic,boolean isConstructor,Throwable e){
  while (e instanceof InvocationTargetException) {
    Throwable cause=((InvocationTargetException)e).getTargetException();
    if (cause != null) {
      e=cause;
    }
 else {
      break;
    }
  }
  return new _TemplateModelException(e,new Object[]{invocationErrorMessageStart(member,isConstructor),"String_Node_Str",isStatic || isConstructor ? "String_Node_Str" : new Object[]{"String_Node_Str",parentObject.getClass(),"String_Node_Str",new _DelayedJQuote(parentObject)},"String_Node_Str"});
}

Fixed version (ground truth):
private static TemplateModelException newInvocationTemplateModelException(Object parentObject,Object member,boolean isStatic,boolean isConstructor,Throwable e){
  while (e instanceof InvocationTargetException) {
    Throwable cause=((InvocationTargetException)e).getTargetException();
    if (cause != null) {
      e=cause;
    }
 else {
      break;
    }
  }
  return new _TemplateModelException(e,new Object[]{invocationErrorMessageStart(member,isConstructor),"String_Node_Str",isStatic || isConstructor ? (Object)"String_Node_Str" : new Object[]{"String_Node_Str",parentObject.getClass(),"String_Node_Str",new _DelayedJQuote(parentObject)},"String_Node_Str"});
}
Program: 15700
Project: 15700
Buggy source:
private void convertArgsToReflectionCompatible(BeansWrapper bw,Object[] args) throws TemplateModelException {
  Class[] paramTypes=callableMemberDesc.getParamTypes();
  int ln=paramTypes.length;
  for (int i=0; i < ln; i++) {
    Class paramType=paramTypes[i];
    final Object arg=args[i];
    if (arg == null)     continue;
    if (paramType.isArray() && arg instanceof List) {
      args[i]=bw.listToArray((List)arg,paramType,null);
    }
    if (arg.getClass().isArray() && List.class.isAssignableFrom(paramType)) {
      args[i]=bw.arrayToList((Object[])arg);
    }
    if (arg instanceof CharacterOrString) {
      if (paramType == Character.class || paramType == char.class || (!paramType.isAssignableFrom(String.class) && paramType.isAssignableFrom(Character.class))) {
        args[i]=new Character(((CharacterOrString)arg).getAsChar());
      }
 else {
        args[i]=((CharacterOrString)arg).getAsString();
      }
    }
  }
}

Fixed version (ground truth):
private void convertArgsToReflectionCompatible(BeansWrapper bw,Object[] args) throws TemplateModelException {
  Class[] paramTypes=callableMemberDesc.getParamTypes();
  int ln=paramTypes.length;
  for (int i=0; i < ln; i++) {
    Class paramType=paramTypes[i];
    final Object arg=args[i];
    if (arg == null)     continue;
    if (paramType.isArray() && arg instanceof List) {
      args[i]=bw.listToArray((List)arg,paramType,null);
    }
    if (arg.getClass().isArray() && paramType.isAssignableFrom(List.class)) {
      args[i]=bw.arrayToList((Object[])arg);
    }
    if (arg instanceof CharacterOrString) {
      if (paramType == Character.class || paramType == char.class || (!paramType.isAssignableFrom(String.class) && paramType.isAssignableFrom(Character.class))) {
        args[i]=new Character(((CharacterOrString)arg).getAsChar());
      }
 else {
        args[i]=((CharacterOrString)arg).getAsString();
      }
    }
  }
}
Program: 15702
Project: 15702
Buggy source:
private String memberListToString(){
  Iterator fixArgMethodsIter=fixArgMethods.getMemberDescriptors();
  Iterator varargMethodsIter=varargMethods != null ? varargMethods.getMemberDescriptors() : null;
  boolean hasMethods=fixArgMethodsIter.hasNext() || (varargMethodsIter != null && varargMethodsIter.hasNext());
  if (hasMethods) {
    StringBuffer sb=new StringBuffer();
    while (fixArgMethodsIter.hasNext()) {
      if (sb.length() != 0)       sb.append("String_Node_Str");
      sb.append("String_Node_Str");
      sb.append(((CallableMemberDescriptor)fixArgMethodsIter.next()).getDeclaration());
    }
    if (varargMethodsIter != null) {
      while (varargMethodsIter.hasNext()) {
        if (sb.length() != 0)         sb.append("String_Node_Str");
        sb.append(((CallableMemberDescriptor)varargMethodsIter.next()).getDeclaration());
      }
    }
    return sb.toString();
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
private String memberListToString(){
  Iterator fixArgMethodsIter=fixArgMethods.getMemberDescriptors();
  Iterator varargMethodsIter=varargMethods != null ? varargMethods.getMemberDescriptors() : null;
  boolean hasMethods=fixArgMethodsIter.hasNext() || (varargMethodsIter != null && varargMethodsIter.hasNext());
  if (hasMethods) {
    StringBuffer sb=new StringBuffer();
    HashSet fixArgMethods=new HashSet();
    if (fixArgMethodsIter != null) {
      while (fixArgMethodsIter.hasNext()) {
        if (sb.length() != 0)         sb.append("String_Node_Str");
        sb.append("String_Node_Str");
        CallableMemberDescriptor callableMemberDesc=(CallableMemberDescriptor)fixArgMethodsIter.next();
        fixArgMethods.add(callableMemberDesc);
        sb.append(callableMemberDesc.getDeclaration());
      }
    }
    if (varargMethodsIter != null) {
      while (varargMethodsIter.hasNext()) {
        CallableMemberDescriptor callableMemberDesc=(CallableMemberDescriptor)varargMethodsIter.next();
        if (!fixArgMethods.contains(callableMemberDesc)) {
          if (sb.length() != 0)           sb.append("String_Node_Str");
          sb.append("String_Node_Str");
          sb.append(callableMemberDesc.getDeclaration());
        }
      }
    }
    return sb.toString();
  }
 else {
    return "String_Node_Str";
  }
}
Program: 15703
Project: 15703
Buggy source:
MemberAndArguments getMemberAndArguments(List tmArgs,BeansWrapper unwrapper) throws TemplateModelException {
  MaybeEmptyMemberAndArguments res;
  if ((res=fixArgMethods.getMemberAndArguments(tmArgs,unwrapper)) instanceof MemberAndArguments) {
    return (MemberAndArguments)res;
  }
 else   if (varargMethods != null && (res=varargMethods.getMemberAndArguments(tmArgs,unwrapper)) instanceof MemberAndArguments) {
    return (MemberAndArguments)res;
  }
 else {
    if (res == EmptyMemberAndArguments.NO_SUCH_METHOD) {
      throw new TemplateModelException("String_Node_Str" + "String_Node_Str" + getDeducedCallSignature(tmArgs) + "String_Node_Str"+ memberListToString());
    }
 else     if (res == EmptyMemberAndArguments.AMBIGUOUS_METHOD) {
      throw new TemplateModelException("String_Node_Str" + "String_Node_Str" + getDeducedCallSignature(tmArgs) + "String_Node_Str"+ memberListToString());
    }
 else {
      throw new BugException("String_Node_Str" + res);
    }
  }
}

Fixed version (ground truth):
MemberAndArguments getMemberAndArguments(List tmArgs,BeansWrapper unwrapper) throws TemplateModelException {
  MaybeEmptyMemberAndArguments fixArgsRes=null;
  MaybeEmptyMemberAndArguments varargsRes=null;
  if ((fixArgsRes=fixArgMethods.getMemberAndArguments(tmArgs,unwrapper)) instanceof MemberAndArguments) {
    return (MemberAndArguments)fixArgsRes;
  }
 else   if (varargMethods != null && (varargsRes=varargMethods.getMemberAndArguments(tmArgs,unwrapper)) instanceof MemberAndArguments) {
    return (MemberAndArguments)varargsRes;
  }
 else {
    MaybeEmptyMemberAndArguments res=getClosestToSuccess(fixArgsRes,varargsRes);
    if (res == EmptyMemberAndArguments.NO_SUCH_METHOD) {
      throw new TemplateModelException("String_Node_Str" + "String_Node_Str" + getDeducedCallSignature(tmArgs) + "String_Node_Str"+ memberListToString());
    }
 else     if (res == EmptyMemberAndArguments.AMBIGUOUS_METHOD) {
      throw new TemplateModelException("String_Node_Str" + "String_Node_Str" + getDeducedCallSignature(tmArgs) + "String_Node_Str"+ memberListToString());
    }
 else {
      throw new BugException("String_Node_Str" + res);
    }
  }
}
Program: 15704
Project: 15704
Buggy source:
String getDeclaration(){
  StringBuffer sb=new StringBuffer();
  String className=ClassUtil.getShortClassName(member.getDeclaringClass());
  if (className != null) {
    sb.append(className);
    sb.append('.');
  }
  sb.append(member.getName());
  sb.append('(');
  Class[] paramTypes=_MethodUtil.getParameterTypes(member);
  for (int i=0; i < paramTypes.length; i++) {
    if (i != 0)     sb.append("String_Node_Str");
    sb.append(ClassUtil.getShortClassName(paramTypes[i]));
  }
  sb.append(')');
  return sb.toString();
}

Fixed version (ground truth):
String getDeclaration(){
  StringBuffer sb=new StringBuffer();
  String className=ClassUtil.getShortClassName(member.getDeclaringClass());
  if (className != null) {
    sb.append(className);
    sb.append('.');
  }
  sb.append(member.getName());
  sb.append('(');
  Class[] paramTypes=_MethodUtil.getParameterTypes(member);
  for (int i=0; i < paramTypes.length; i++) {
    if (i != 0)     sb.append("String_Node_Str");
    String paramTypeDecl=ClassUtil.getShortClassName(paramTypes[i]);
    if (i == paramTypes.length - 1 && paramTypeDecl.endsWith("String_Node_Str") && isVarargs()) {
      sb.append(paramTypeDecl.substring(0,paramTypeDecl.length() - 2));
      sb.append("String_Node_Str");
    }
 else {
      sb.append(paramTypeDecl);
    }
  }
  sb.append(')');
  return sb.toString();
}
Program: 15705
Project: 15705
Buggy source:
/** 
 * @param args The actual arguments. A varargs argument should be present exploded, no as an array.
 * @param bugfixed Introduced in 2.3.21, sets this object to a mode that works well with {@link BeansWrapper}-s created with   {@link Version} 2.3.21 or higher.
 */
ArgumentTypes(Object[] args,boolean bugfixed){
  int l=args.length;
  types=new Class[l];
  for (int i=0; i < l; ++i) {
    Object obj=args[i];
    types[i]=obj == null ? (bugfixed ? Null.class : Object.class) : obj.getClass();
  }
  this.bugfixed=bugfixed;
}

Fixed version (ground truth):
/** 
 * @param args The actual arguments. A varargs argument should be present exploded, no as an array.
 * @param bugfixed Introduced in 2.3.21, sets this object to a mode that works well with {@link BeansWrapper}-s created with   {@link Version} 2.3.21 or higher.
 */
ArgumentTypes(Object[] args,boolean bugfixed){
  int ln=args.length;
  Class[] typesTmp=new Class[ln];
  for (int i=0; i < ln; ++i) {
    Object arg=args[i];
    typesTmp[i]=arg == null ? (bugfixed ? Null.class : Object.class) : arg.getClass();
  }
  types=typesTmp;
  this.bugfixed=bugfixed;
}
Program: 15706
Project: 15706
Buggy source:
/** 
 * Populates a map with property and method descriptors for a specified class. If any property or method descriptors specifies a read method that is not accessible, replaces it with appropriate accessible method from a superclass or interface.
 */
private Map createClassIntrospectionData(Class clazz){
  final Map introspData=new HashMap();
  if (exposeFields) {
    addFieldsToClassIntrospectionData(introspData,clazz);
  }
  final Map accessibleMethods=discoverAccessibleMethods(clazz);
  addGenericGetToClassIntrospectionData(introspData,accessibleMethods);
  if (exposureLevel != EXPOSE_NOTHING) {
    try {
      addBeanInfoToClassInrospectionData(introspData,clazz,accessibleMethods);
    }
 catch (    IntrospectionException e) {
      logger.warn("String_Node_Str" + clazz,e);
      introspData.clear();
    }
  }
  addConstructorsToClassIntrospectionData(introspData,clazz);
  if (introspData.size() > 1) {
    return introspData;
  }
 else   if (introspData.size() == 0) {
    return Collections12.EMPTY_MAP;
  }
 else {
    Map.Entry e=(Map.Entry)introspData.entrySet().iterator().next();
    return Collections12.singletonMap(e.getKey(),e.getValue());
  }
}

Fixed version (ground truth):
/** 
 * Populates a map with property and method descriptors for a specified class. If any property or method descriptors specifies a read method that is not accessible, replaces it with appropriate accessible method from a superclass or interface. <p>WARNING! This must be called after (or inside) synchronized(sharedClassIntrospectionCacheLock), or else there's a risk that we do the introspection with stale settings, which can pollute the introspection cache with wrong data.
 */
private Map createClassIntrospectionData(Class clazz){
  final Map introspData=new HashMap();
  if (exposeFields) {
    addFieldsToClassIntrospectionData(introspData,clazz);
  }
  final Map accessibleMethods=discoverAccessibleMethods(clazz);
  addGenericGetToClassIntrospectionData(introspData,accessibleMethods);
  if (exposureLevel != EXPOSE_NOTHING) {
    try {
      addBeanInfoToClassInrospectionData(introspData,clazz,accessibleMethods);
    }
 catch (    IntrospectionException e) {
      logger.warn("String_Node_Str" + clazz,e);
      introspData.clear();
    }
  }
  addConstructorsToClassIntrospectionData(introspData,clazz);
  if (introspData.size() > 1) {
    return introspData;
  }
 else   if (introspData.size() == 0) {
    return Collections12.EMPTY_MAP;
  }
 else {
    Map.Entry e=(Map.Entry)introspData.entrySet().iterator().next();
    return Collections12.singletonMap(e.getKey(),e.getValue());
  }
}