nus-yam/ex-repair huggingface dataset:
Program: 15617
Project: 15617
Buggy source:
@Test public void testWithGMT2AndGMT2SQL() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT2 + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_DIFFERENT,cfg);
}

Fixed version (ground truth):
@Test public void testWithGMT2AndGMT2SQL() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  setConfiguration(cfg);
  assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT2 + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_DIFFERENT);
}
Program: 15618
Project: 15618
Buggy source:
@Test public void testWithGMT1AndGMT2SQL() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT1_SQL_DIFFERENT + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_DIFFERENT,cfg);
}

Fixed version (ground truth):
@Test public void testWithGMT1AndGMT2SQL() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  setConfiguration(cfg);
  assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT1_SQL_DIFFERENT + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_DIFFERENT);
}
Program: 15619
Project: 15619
Buggy source:
@Test public void testWithGMT2AndNullSQL() throws Exception {
  Configuration cfg=createConfiguration();
  assertNull(cfg.getSQLDateAndTimeTimeZone());
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT2 + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_SAME,cfg);
}

Fixed version (ground truth):
@Test public void testWithGMT2AndNullSQL() throws Exception {
  Configuration cfg=createConfiguration();
  assertNull(cfg.getSQLDateAndTimeTimeZone());
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  setConfiguration(cfg);
  assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT2 + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_SAME);
}
Program: 15620
Project: 15620
Buggy source:
@Test public void testFormatUTCFlagHasNoEffect() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",cfg);
}

Fixed version (ground truth):
@Test public void testFormatUTCFlagHasNoEffect() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  setConfiguration(cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 15621
Project: 15621
Buggy source:
@Test public void testWithDefaultTZAndGMT2SQL() throws Exception {
  TimeZone prevSysDefTz=TimeZone.getDefault();
  TimeZone.setDefault(GMT_P02);
  try {
    Configuration cfg=createConfiguration();
    cfg.setSQLDateAndTimeTimeZone(GMT_P02);
    assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT2 + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_DIFFERENT,cfg);
  }
  finally {
    TimeZone.setDefault(prevSysDefTz);
  }
}

Fixed version (ground truth):
@Test public void testWithDefaultTZAndGMT2SQL() throws Exception {
  TimeZone prevSysDefTz=TimeZone.getDefault();
  TimeZone.setDefault(GMT_P02);
  try {
    Configuration cfg=createConfiguration();
    cfg.setSQLDateAndTimeTimeZone(GMT_P02);
    setConfiguration(cfg);
    assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT2 + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_DIFFERENT);
  }
  finally {
    TimeZone.setDefault(prevSysDefTz);
  }
}
Program: 15622
Project: 15622
Buggy source:
@Test public void testCacheFlushings() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setTimeZone(DateUtil.UTC);
  cfg.setDateFormat("String_Node_Str");
  cfg.setTimeFormat("String_Node_Str");
  cfg.setDateTimeFormat("String_Node_Str");
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str",cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str",cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str",cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str",cfg);
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str",cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str",cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str",cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str",cfg);
}

Fixed version (ground truth):
@Test public void testCacheFlushings() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setTimeZone(DateUtil.UTC);
  cfg.setDateFormat("String_Node_Str");
  cfg.setTimeFormat("String_Node_Str");
  cfg.setDateTimeFormat("String_Node_Str");
  setConfiguration(cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str" + "String_Node_Str");
}
Program: 15623
Project: 15623
Buggy source:
@Test public void testWithGMT1AndNullSQL() throws Exception {
  Configuration cfg=createConfiguration();
  assertNull(cfg.getSQLDateAndTimeTimeZone());
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT1_SQL_SAME + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_SAME,cfg);
}

Fixed version (ground truth):
@Test public void testWithGMT1AndNullSQL() throws Exception {
  Configuration cfg=createConfiguration();
  assertNull(cfg.getSQLDateAndTimeTimeZone());
  cfg.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
  setConfiguration(cfg);
  assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT1_SQL_SAME + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_SAME);
}
Program: 15624
Project: 15624
Buggy source:
@Test public void testDateAndTimeBuiltInsHasNoEffect() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setTimeZone(DateUtil.UTC);
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str",cfg);
}

Fixed version (ground truth):
@Test public void testDateAndTimeBuiltInsHasNoEffect() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setTimeZone(DateUtil.UTC);
  cfg.setSQLDateAndTimeTimeZone(GMT_P02);
  setConfiguration(cfg);
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}
Program: 15625
Project: 15625
Buggy source:
@Test public void testChangeSettingInTemplate() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setTimeZone(DateUtil.UTC);
  assertNull(cfg.getSQLDateAndTimeTimeZone());
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",cfg);
}

Fixed version (ground truth):
@Test public void testChangeSettingInTemplate() throws Exception {
  Configuration cfg=createConfiguration();
  cfg.setTimeZone(DateUtil.UTC);
  setConfiguration(cfg);
  assertNull(cfg.getSQLDateAndTimeTimeZone());
  assertOutput("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 15626
Project: 15626
Buggy source:
@Test public void testWithDefaultTZAndNullSQL() throws Exception {
  TimeZone prevSysDefTz=TimeZone.getDefault();
  TimeZone.setDefault(GMT_P02);
  try {
    Configuration cfg=createConfiguration();
    assertNull(cfg.getSQLDateAndTimeTimeZone());
    assertEquals(TimeZone.getDefault(),cfg.getTimeZone());
    assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT2 + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_SAME,cfg);
  }
  finally {
    TimeZone.setDefault(prevSysDefTz);
  }
}

Fixed version (ground truth):
@Test public void testWithDefaultTZAndNullSQL() throws Exception {
  TimeZone prevSysDefTz=TimeZone.getDefault();
  TimeZone.setDefault(GMT_P02);
  try {
    Configuration cfg=createConfiguration();
    setConfiguration(cfg);
    assertNull(cfg.getSQLDateAndTimeTimeZone());
    assertEquals(TimeZone.getDefault(),cfg.getTimeZone());
    assertOutput(FTL,OUTPUT_BEFORE_SETTING_GMT_CFG_GMT2 + OUTPUT_AFTER_SETTING_GMT_CFG_SQL_SAME);
  }
  finally {
    TimeZone.setDefault(prevSysDefTz);
  }
}
Program: 15627
Project: 15627
Buggy source:
/** 
 * Processes a Template in the context of this <code>Environment</code>, including its output in the <code>Environment</code>'s Writer.
 * @param includedTemplate the template to process. Note that it does <em>not</em> needto be a template returned by {@link #getTemplateForInclusion(String name,String encoding,boolean parse)}.
 */
public void include(Template includedTemplate) throws TemplateException, IOException {
  Template prevTemplate=getTemplate();
  setParent(includedTemplate);
  importMacros(includedTemplate);
  try {
    visit(includedTemplate.getRootTreeNode());
  }
  finally {
    setParent(prevTemplate);
  }
}

Fixed version (ground truth):
/** 
 * Processes a Template in the context of this <code>Environment</code>, including its output in the <code>Environment</code>'s Writer.
 * @param includedTemplate the template to process. Note that it does <em>not</em> needto be a template returned by {@link #getTemplateForInclusion(String name,String encoding,boolean parse)}.
 */
public void include(Template includedTemplate) throws TemplateException, IOException {
  final Template prevTemplate;
  final boolean parentReplacementOn=getConfiguration().getIncompatibleImprovements().intValue() < _TemplateAPI.VERSION_INT_2_3_22;
  if (parentReplacementOn) {
    prevTemplate=getTemplate();
    setParent(includedTemplate);
  }
 else {
    prevTemplate=null;
  }
  importMacros(includedTemplate);
  try {
    visit(includedTemplate.getRootTreeNode());
  }
  finally {
    if (parentReplacementOn) {
      setParent(prevTemplate);
    }
  }
}
Program: 15630
Project: 15630
Buggy source:
public void testParseXSDateTimeFTLAndJavax() throws DateParseException {
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
}

Fixed version (ground truth):
public void testParseXSDateTimeFTLAndJavax() throws DateParseException {
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  if (isAtLeastJava6()) {
    assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
    assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  }
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
  assertJavaxAndFTLXSDateTimesSame("String_Node_Str");
}
Program: 15631
Project: 15631
Buggy source:
void accept(Environment env) throws TemplateException, IOException {
  String templateNameString=templateName.evalAndCoerceToString(env);
  Template importedTemplate;
  try {
    if (!env.isClassicCompatible()) {
      if (templateNameString.indexOf("String_Node_Str") > 0) {
        ;
      }
 else       if (templateNameString.length() > 0 && templateNameString.charAt(0) == '/') {
        int protIndex=templatePath.indexOf("String_Node_Str");
        if (protIndex > 0) {
          templateNameString=templatePath.substring(0,protIndex + 2) + templateNameString;
        }
 else {
          templateNameString=templateNameString.substring(1);
        }
      }
 else {
        templateNameString=templatePath + templateNameString;
      }
    }
    importedTemplate=env.getTemplateForImporting(templateNameString);
  }
 catch (  ParseException pe) {
    throw new _MiscTemplateException(pe,env,new Object[]{"String_Node_Str",templateNameString});
  }
catch (  IOException ioe) {
    throw new _MiscTemplateException(ioe,env,new Object[]{"String_Node_Str",templateNameString});
  }
  env.importLib(importedTemplate,namespace);
}

Fixed version (ground truth):
void accept(Environment env) throws TemplateException, IOException {
  String templateNameString=templateName.evalAndCoerceToString(env);
  Template importedTemplate;
  try {
    if (!env.isClassicCompatible()) {
      if (templateNameString.indexOf("String_Node_Str") > 0) {
        ;
      }
 else       if (templateNameString.length() > 0 && templateNameString.charAt(0) == '/') {
        int protIndex=templatePath.indexOf("String_Node_Str");
        if (protIndex > 0) {
          templateNameString=templatePath.substring(0,protIndex + 2) + templateNameString;
        }
 else {
          templateNameString=templateNameString.substring(1);
        }
      }
 else {
        templateNameString=templatePath + templateNameString;
      }
    }
    importedTemplate=env.getTemplateForImporting(templateNameString);
  }
 catch (  ParseException e) {
    throw new _MiscTemplateException(e,env,new Object[]{"String_Node_Str",new _DelayedJQuote(templateNameString),"String_Node_Str",new _DelayedGetMessage(e)});
  }
catch (  IOException ioe) {
    throw new _MiscTemplateException(ioe,env,new Object[]{"String_Node_Str",templateNameString});
  }
  env.importLib(importedTemplate,namespace);
}
Program: 15632
Project: 15632
Buggy source:
private TemplateModel dealWithNumericalKey(TemplateModel targetModel,int index,Environment env) throws TemplateException {
  if (targetModel instanceof TemplateSequenceModel) {
    TemplateSequenceModel tsm=(TemplateSequenceModel)targetModel;
    int size;
    try {
      size=tsm.size();
    }
 catch (    Exception e) {
      size=Integer.MAX_VALUE;
    }
    return index < size ? tsm.get(index) : null;
  }
  try {
    String s=target.evalAndCoerceToString(env);
    try {
      return new SimpleScalar(s.substring(index,index + 1));
    }
 catch (    RuntimeException re) {
      throw new _MiscTemplateException(re,env);
    }
  }
 catch (  NonStringException e) {
    throw new UnexpectedTypeException(target,targetModel,"String_Node_Str" + NonStringException.STRING_COERCABLE_TYPES_DESC,NUMERICAL_KEY_LHO_EXPECTED_TYPES,env);
  }
}

Fixed version (ground truth):
private TemplateModel dealWithNumericalKey(TemplateModel targetModel,int index,Environment env) throws TemplateException {
  if (targetModel instanceof TemplateSequenceModel) {
    TemplateSequenceModel tsm=(TemplateSequenceModel)targetModel;
    int size;
    try {
      size=tsm.size();
    }
 catch (    Exception e) {
      size=Integer.MAX_VALUE;
    }
    return index < size ? tsm.get(index) : null;
  }
  try {
    String s=target.evalAndCoerceToString(env);
    try {
      return new SimpleScalar(s.substring(index,index + 1));
    }
 catch (    IndexOutOfBoundsException e) {
      if (index < 0) {
        throw new _MiscTemplateException(new Object[]{"String_Node_Str",new Integer(index)});
      }
      if (index >= s.length()) {
        throw new _MiscTemplateException(new Object[]{"String_Node_Str",new Integer(index),"String_Node_Str",new Integer(s.length()),"String_Node_Str"});
      }
      throw new RuntimeException("String_Node_Str",e);
    }
  }
 catch (  NonStringException e) {
    throw new UnexpectedTypeException(target,targetModel,"String_Node_Str" + NonStringException.STRING_COERCABLE_TYPES_DESC,NUMERICAL_KEY_LHO_EXPECTED_TYPES,env);
  }
}
Program: 15633
Project: 15633
Buggy source:
public TemplateModel next() throws TemplateModelException {
  if (!hasNext())   throw new _TemplateModelException("String_Node_Str");
  Match result=new Match(input,matcher);
  hasFindInfo=matcher.find();
  return result;
}

Fixed version (ground truth):
public TemplateModel next() throws TemplateModelException {
  try {
    return (TemplateModel)matchingInputParts.get(nextIdx++);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new _TemplateModelException(e,"String_Node_Str");
  }
}
Program: 15634
Project: 15634
Buggy source:
public String getAsString(){
  return match;
}

Fixed version (ground truth):
public String getAsString(){
  return matchedInputPart;
}
Program: 15635
Project: 15635
Buggy source:
TemplateModel _eval(Environment env) throws TemplateException {
  TemplateModel targetModel=target.eval(env);
  assertNonNull(targetModel,env);
  if (targetModel instanceof RegexMatchModel) {
    return ((RegexMatchModel)targetModel).getGroups();
  }
 else   if (targetModel instanceof RegexMatchModel.Match) {
    return ((RegexMatchModel.Match)targetModel).groupsSeq;
  }
 else {
    throw new UnexpectedTypeException(target,targetModel,"String_Node_Str",new Class[]{RegexMatchModel.class,RegexMatchModel.Match.class},env);
  }
}

Fixed version (ground truth):
TemplateModel _eval(Environment env) throws TemplateException {
  TemplateModel targetModel=target.eval(env);
  assertNonNull(targetModel,env);
  if (targetModel instanceof RegexMatchModel) {
    return ((RegexMatchModel)targetModel).getGroups();
  }
 else   if (targetModel instanceof RegexMatchModel.MatchWithGroups) {
    return ((RegexMatchModel.MatchWithGroups)targetModel).groupsSeq;
  }
 else {
    throw new UnexpectedTypeException(target,targetModel,"String_Node_Str",new Class[]{RegexMatchModel.class,RegexMatchModel.MatchWithGroups.class},env);
  }
}
Program: 15636
Project: 15636
Buggy source:
public TemplateModelIterator iterator(){
  matcher.reset();
  return new TemplateModelIterator(){
    boolean hasFindInfo=matcher.find();
    public boolean hasNext(){
      return hasFindInfo;
    }
    public TemplateModel next() throws TemplateModelException {
      if (!hasNext())       throw new _TemplateModelException("String_Node_Str");
      Match result=new Match(input,matcher);
      hasFindInfo=matcher.find();
      return result;
    }
  }
;
}

Fixed version (ground truth):
public TemplateModelIterator iterator(){
  final ArrayList matchingInputParts=this.matchingInputParts;
  if (matchingInputParts == null) {
    final Matcher matcher=pattern.matcher(input);
    return new TemplateModelIterator(){
      private int nextIdx=0;
      boolean hasFindInfo=matcher.find();
      public boolean hasNext(){
        final ArrayList matchingInputParts=RegexMatchModel.this.matchingInputParts;
        if (matchingInputParts == null) {
          return hasFindInfo;
        }
 else {
          return nextIdx < matchingInputParts.size();
        }
      }
      public TemplateModel next() throws TemplateModelException {
        final ArrayList matchingInputParts=RegexMatchModel.this.matchingInputParts;
        if (matchingInputParts == null) {
          if (!hasFindInfo)           throw new _TemplateModelException("String_Node_Str");
          MatchWithGroups result=new MatchWithGroups(input,matcher);
          nextIdx++;
          hasFindInfo=matcher.find();
          return result;
        }
 else {
          try {
            return (TemplateModel)matchingInputParts.get(nextIdx++);
          }
 catch (          IndexOutOfBoundsException e) {
            throw new _TemplateModelException(e,"String_Node_Str");
          }
        }
      }
    }
;
  }
 else {
    return new TemplateModelIterator(){
      private int nextIdx=0;
      public boolean hasNext(){
        return nextIdx < matchingInputParts.size();
      }
      public TemplateModel next() throws TemplateModelException {
        try {
          return (TemplateModel)matchingInputParts.get(nextIdx++);
        }
 catch (        IndexOutOfBoundsException e) {
          throw new _TemplateModelException(e,"String_Node_Str");
        }
      }
    }
;
  }
}
Program: 15637
Project: 15637
Buggy source:
public TemplateModel get(int i) throws TemplateModelException {
  try {
    return new SimpleScalar(matcher.group(i));
  }
 catch (  Exception e) {
    throw new _TemplateModelException(e);
  }
}

Fixed version (ground truth):
public TemplateModel get(int i) throws TemplateModelException {
  try {
    return new SimpleScalar(firedEntireInputMatcher.group(i));
  }
 catch (  Exception e) {
    throw new _TemplateModelException(e,"String_Node_Str");
  }
}
Program: 15638
Project: 15638
Buggy source:
public TemplateModel getGroups(){
  if (groups == null) {
    groups=new TemplateSequenceModel(){
      public int size() throws TemplateModelException {
        try {
          return matcher.groupCount() + 1;
        }
 catch (        Exception e) {
          throw new _TemplateModelException(e);
        }
      }
      public TemplateModel get(      int i) throws TemplateModelException {
        try {
          return new SimpleScalar(matcher.group(i));
        }
 catch (        Exception e) {
          throw new _TemplateModelException(e);
        }
      }
    }
;
  }
  return groups;
}

Fixed version (ground truth):
public TemplateModel getGroups(){
  TemplateSequenceModel entireInputMatchGroups=this.entireInputMatchGroups;
  if (entireInputMatchGroups == null) {
    Matcher t=this.firedEntireInputMatcher;
    if (t == null) {
      isEntrieInputMatchesAndStoreResults();
      t=this.firedEntireInputMatcher;
    }
    final Matcher firedEntireInputMatcher=t;
    entireInputMatchGroups=new TemplateSequenceModel(){
      public int size() throws TemplateModelException {
        try {
          return firedEntireInputMatcher.groupCount() + 1;
        }
 catch (        Exception e) {
          throw new _TemplateModelException(e,"String_Node_Str");
        }
      }
      public TemplateModel get(      int i) throws TemplateModelException {
        try {
          return new SimpleScalar(firedEntireInputMatcher.group(i));
        }
 catch (        Exception e) {
          throw new _TemplateModelException(e,"String_Node_Str");
        }
      }
    }
;
    this.entireInputMatchGroups=entireInputMatchGroups;
  }
  return entireInputMatchGroups;
}
Program: 15639
Project: 15639
Buggy source:
RegexMatchModel(Pattern pattern,String input){
  this.matcher=pattern.matcher(input);
  this.input=input;
  this.matches=matcher.matches();
}

Fixed version (ground truth):
RegexMatchModel(Pattern pattern,String input){
  this.pattern=pattern;
  this.input=input;
}
Program: 15640
Project: 15640
Buggy source:
public boolean hasNext(){
  return hasFindInfo;
}

Fixed version (ground truth):
public boolean hasNext(){
  return nextIdx < matchingInputParts.size();
}
Program: 15641
Project: 15641
Buggy source:
public int size() throws TemplateModelException {
  try {
    return matcher.groupCount() + 1;
  }
 catch (  Exception e) {
    throw new _TemplateModelException(e);
  }
}

Fixed version (ground truth):
public int size() throws TemplateModelException {
  try {
    return firedEntireInputMatcher.groupCount() + 1;
  }
 catch (  Exception e) {
    throw new _TemplateModelException(e,"String_Node_Str");
  }
}
Program: 15642
Project: 15642
Buggy source:
public boolean getAsBoolean(){
  return matches;
}

Fixed version (ground truth):
public boolean getAsBoolean(){
  Boolean result=entireInputMatched;
  return result != null ? result.booleanValue() : isEntrieInputMatchesAndStoreResults();
}
Program: 15643
Project: 15643
Buggy source:
@Test public void testBug402(){
  assertErrorContains("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertErrorContains("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testBug402(){
  assertErrorContains("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertErrorContains("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertErrorContains("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertErrorContains("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 15644
Project: 15644
Buggy source:
public static int getTemplateLanguageVersionAsInt(TemplateObject to){
  return to.getTemplate().getTemplateLanguageVersion().intValue();
}

Fixed version (ground truth):
public static int getTemplateLanguageVersionAsInt(Template t){
  return t.getTemplateLanguageVersion().intValue();
}
Program: 15645
Project: 15645
Buggy source:
/** 
 * Creates a new template cache with a custom template loader that is used to load the templates.
 * @param templateLoader the template loader to use.
 */
public TemplateCache(TemplateLoader templateLoader,CacheStorage cacheStorage){
  this.templateLoader=templateLoader;
  this.storage=cacheStorage;
  if (cacheStorage == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  isStorageConcurrent=cacheStorage instanceof ConcurrentCacheStorage && ((ConcurrentCacheStorage)cacheStorage).isConcurrent();
}

Fixed version (ground truth):
/** 
 * @param templateLoader The {@link TemplateLoader} to use. Can't be {@code null}.
 * @param cacheStorage The {@link CacheStorage} to use. Can't be {@code null}.
 * @param config The {@link Configuration} this cache will be used for. Can be {@code null} for backwardcompatibility, as it can be set with  {@link #setConfiguration(Configuration)} later.
 * @since 2.3.21
 */
public TemplateCache(TemplateLoader templateLoader,CacheStorage cacheStorage,Configuration config){
  this.templateLoader=templateLoader;
  if (cacheStorage == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.storage=cacheStorage;
  isStorageConcurrent=cacheStorage instanceof ConcurrentCacheStorage && ((ConcurrentCacheStorage)cacheStorage).isConcurrent();
  this.config=config;
}
Program: 15646
Project: 15646
Buggy source:
/** 
 * Sets the configuration object to which this cache belongs. This method is called by the configuration itself to establish the relation, and should not be called by users.
 */
public void setConfiguration(Configuration config){
  this.config=config;
  clear();
}

Fixed version (ground truth):
/** 
 * Sets the configuration object to which this cache belongs. This method is called by the configuration itself to establish the relation, and should not be called by users.
 * @deprecated Use the {@link #TemplateCache(TemplateLoader,CacheStorage,Configuration)} constructor.
 */
public void setConfiguration(Configuration config){
  this.config=config;
  clear();
}
Program: 15647
Project: 15647
Buggy source:
private Object acquireTemplateSource(String path) throws IOException {
  int asterisk=path.indexOf(ASTERISK);
  if (asterisk == -1) {
    return templateLoader.findTemplateSource(path);
  }
  StringTokenizer tok=new StringTokenizer(path,"String_Node_Str");
  int lastAsterisk=-1;
  List tokpath=new ArrayList();
  while (tok.hasMoreTokens()) {
    String pathToken=tok.nextToken();
    if (pathToken.equals(ASTERISKSTR)) {
      if (lastAsterisk != -1) {
        tokpath.remove(lastAsterisk);
      }
      lastAsterisk=tokpath.size();
    }
    tokpath.add(pathToken);
  }
  if (lastAsterisk == -1) {
    return templateLoader.findTemplateSource(path);
  }
  String basePath=concatPath(tokpath,0,lastAsterisk);
  String resourcePath=concatPath(tokpath,lastAsterisk + 1,tokpath.size());
  if (resourcePath.endsWith("String_Node_Str")) {
    resourcePath=resourcePath.substring(0,resourcePath.length() - 1);
  }
  StringBuffer buf=new StringBuffer(path.length()).append(basePath);
  int l=basePath.length();
  boolean debug=logger.isDebugEnabled();
  for (; ; ) {
    String fullPath=buf.append(resourcePath).toString();
    if (debug) {
      logger.debug("String_Node_Str" + StringUtil.jQuoteNoXSS(fullPath));
    }
    Object templateSource=templateLoader.findTemplateSource(fullPath);
    if (templateSource != null) {
      return templateSource;
    }
    if (l == 0) {
      return null;
    }
    l=basePath.lastIndexOf(SLASH,l - 2) + 1;
    buf.setLength(l);
  }
}

Fixed version (ground truth):
private Object acquireTemplateSource(String path) throws IOException {
  int asterisk=path.indexOf(ASTERISK);
  if (asterisk == -1) {
    return modifyForConfIcI(templateLoader.findTemplateSource(path));
  }
  StringTokenizer tok=new StringTokenizer(path,"String_Node_Str");
  int lastAsterisk=-1;
  List tokpath=new ArrayList();
  while (tok.hasMoreTokens()) {
    String pathToken=tok.nextToken();
    if (pathToken.equals(ASTERISKSTR)) {
      if (lastAsterisk != -1) {
        tokpath.remove(lastAsterisk);
      }
      lastAsterisk=tokpath.size();
    }
    tokpath.add(pathToken);
  }
  if (lastAsterisk == -1) {
    return modifyForConfIcI(templateLoader.findTemplateSource(path));
  }
  String basePath=concatPath(tokpath,0,lastAsterisk);
  String resourcePath=concatPath(tokpath,lastAsterisk + 1,tokpath.size());
  if (resourcePath.endsWith("String_Node_Str")) {
    resourcePath=resourcePath.substring(0,resourcePath.length() - 1);
  }
  StringBuffer buf=new StringBuffer(path.length()).append(basePath);
  int l=basePath.length();
  boolean debug=logger.isDebugEnabled();
  for (; ; ) {
    String fullPath=buf.append(resourcePath).toString();
    if (debug) {
      logger.debug("String_Node_Str" + StringUtil.jQuoteNoXSS(fullPath));
    }
    Object templateSource=modifyForConfIcI(templateLoader.findTemplateSource(fullPath));
    if (templateSource != null) {
      return templateSource;
    }
    if (l == 0) {
      return null;
    }
    l=basePath.lastIndexOf(SLASH,l - 2) + 1;
    buf.setLength(l);
  }
}
Program: 15648
Project: 15648
Buggy source:
public Object findTemplateSource(String name) throws IOException {
  URL url=getURL(name);
  return url == null ? null : new URLTemplateSource(url);
}

Fixed version (ground truth):
public Object findTemplateSource(String name) throws IOException {
  URL url=getURL(name);
  return url == null ? null : new URLTemplateSource(url,getURLConnectionUsesCaches());
}
Program: 15649
Project: 15649
Buggy source:
URLTemplateSource(URL url) throws IOException {
  this.url=url;
  this.conn=url.openConnection();
}

Fixed version (ground truth):
/** 
 * @param useCaches {@code null} if this aspect wasn't set in the parent {@link TemplateLoader}.
 */
URLTemplateSource(URL url,Boolean useCaches) throws IOException {
  this.url=url;
  this.conn=url.openConnection();
  this.useCaches=useCaches;
  if (useCaches != null) {
    conn.setUseCaches(useCaches.booleanValue());
  }
}
Program: 15650
Project: 15650
Buggy source:
public Object findTemplateSource(String name) throws IOException {
  String fullPath=subdirPath + name;
  try {
    String realPath=servletContext.getRealPath(fullPath);
    if (realPath != null) {
      File file=new File(realPath);
      if (!file.isFile()) {
        return null;
      }
      if (file.canRead()) {
        return file;
      }
    }
  }
 catch (  SecurityException e) {
    ;
  }
  URL url=null;
  try {
    url=servletContext.getResource(fullPath);
  }
 catch (  MalformedURLException e) {
    logger.warn("String_Node_Str" + StringUtil.jQuoteNoXSS(fullPath),e);
    return null;
  }
  return url == null ? null : new URLTemplateSource(url);
}

Fixed version (ground truth):
public Object findTemplateSource(String name) throws IOException {
  String fullPath=subdirPath + name;
  try {
    String realPath=servletContext.getRealPath(fullPath);
    if (realPath != null) {
      File file=new File(realPath);
      if (!file.isFile()) {
        return null;
      }
      if (file.canRead()) {
        return file;
      }
    }
  }
 catch (  SecurityException e) {
    ;
  }
  URL url=null;
  try {
    url=servletContext.getResource(fullPath);
  }
 catch (  MalformedURLException e) {
    logger.warn("String_Node_Str" + StringUtil.jQuoteNoXSS(fullPath),e);
    return null;
  }
  return url == null ? null : new URLTemplateSource(url,getURLConnectionUsesCaches());
}
Program: 15652
Project: 15652
Buggy source:
String formatDate(TemplateDateModel tdm,String formatDescriptor,Expression tdmSourceExpr) throws TemplateModelException {
  Date date=EvalUtil.modelToDate(tdm,tdmSourceExpr);
  boolean sqlDateOrTime=isSQLDateOrTimeClass(date.getClass());
  try {
    return getTemplateDateFormat(tdm.getDateType(),shouldUseSysDefTZ(sqlDateOrTime),formatDescriptor,null).format(tdm,sqlDateOrTime);
  }
 catch (  UnknownDateTypeFormattingUnsupportedException e) {
    throw MessageUtil.newCantFormatUnknownTypeDateException(tdmSourceExpr,e);
  }
catch (  UnformattableDateException e) {
    throw MessageUtil.newCantFormatDateException(tdmSourceExpr,e);
  }
}

Fixed version (ground truth):
String formatDate(TemplateDateModel tdm,String formatDescriptor,Expression tdmSourceExpr) throws TemplateModelException {
  Date date=EvalUtil.modelToDate(tdm,tdmSourceExpr);
  boolean isSQLDateOrTime=isSQLDateOrTimeClass(date.getClass());
  try {
    return getTemplateDateFormat(tdm.getDateType(),isSQLDateOrTime,shouldUseSysDefTZ(isSQLDateOrTime),formatDescriptor,null).format(tdm);
  }
 catch (  UnknownDateTypeFormattingUnsupportedException e) {
    throw MessageUtil.newCantFormatUnknownTypeDateException(tdmSourceExpr,e);
  }
catch (  UnformattableDateException e) {
    throw MessageUtil.newCantFormatDateException(tdmSourceExpr,e);
  }
}
Program: 15653
Project: 15653
Buggy source:
public void setTimeFormat(String timeFormat){
  String prevTimeFormat=getTimeFormat();
  super.setTimeFormat(timeFormat);
  if (!timeFormat.equals(prevTimeFormat)) {
    cachedTimeFormat=cachedTimeFormatSysDefTZ=null;
  }
}

Fixed version (ground truth):
public void setTimeFormat(String timeFormat){
  String prevTimeFormat=getTimeFormat();
  super.setTimeFormat(timeFormat);
  if (!timeFormat.equals(prevTimeFormat)) {
    if (cachedTemplateDateFormats != null) {
      for (int i=0; i < CACHED_TDFS_LENGTH; i+=CACHED_TDFS_ZONELESS_INPUT_OFFS) {
        cachedTemplateDateFormats[i + TemplateDateModel.TIME]=null;
      }
    }
  }
}
Program: 15654
Project: 15654
Buggy source:
public void setDateTimeFormat(String dateTimeFormat){
  String prevDateTimeFormat=getDateTimeFormat();
  super.setDateTimeFormat(dateTimeFormat);
  if (!dateTimeFormat.equals(prevDateTimeFormat)) {
    cachedDateTimeFormat=cachedDateTimeFormatSysDefTZ=null;
  }
}

Fixed version (ground truth):
public void setDateTimeFormat(String dateTimeFormat){
  String prevDateTimeFormat=getDateTimeFormat();
  super.setDateTimeFormat(dateTimeFormat);
  if (!dateTimeFormat.equals(prevDateTimeFormat)) {
    if (cachedTemplateDateFormats != null) {
      for (int i=0; i < CACHED_TDFS_LENGTH; i+=CACHED_TDFS_ZONELESS_INPUT_OFFS) {
        cachedTemplateDateFormats[i + TemplateDateModel.DATETIME]=null;
      }
    }
  }
}
Program: 15655
Project: 15655
Buggy source:
/** 
 * Deletes cached values that meant to be valid only during a single template execution. 
 */
private void clearCachedValues(){
  cachedNumberFormats=null;
  cachedNumberFormat=null;
  cachedTimeFormat=cachedTimeFormatSysDefTZ=null;
  cachedDateFormat=cachedDateFormatSysDefTZ=null;
  cachedDateTimeFormat=cachedDateTimeFormatSysDefTZ=null;
  cachedXSTemplateDateFormatFactory=cachedXSTemplateDateFormatFactorySysDefTZ=null;
  cachedISOTemplateDateFormatFactory=cachedISOTemplateDateFormatFactorySysDefTZ=null;
  cachedJavaTemplateDateFormatFactory=cachedJavaTemplateDateFormatFactorySysDefTZ=null;
  cachedCollator=null;
  cachedURLEscapingCharset=null;
  cachedURLEscapingCharsetSet=false;
}

Fixed version (ground truth):
/** 
 * Deletes cached values that meant to be valid only during a single template execution. 
 */
private void clearCachedValues(){
  cachedNumberFormats=null;
  cachedNumberFormat=null;
  cachedTemplateDateFormats=null;
  cachedXSTemplateDateFormatFactory=cachedXSTemplateDateFormatFactorySysDefTZ=null;
  cachedISOTemplateDateFormatFactory=cachedISOTemplateDateFormatFactorySysDefTZ=null;
  cachedJavaTemplateDateFormatFactory=cachedJavaTemplateDateFormatFactorySysDefTZ=null;
  cachedCollator=null;
  cachedURLEscapingCharset=null;
  cachedURLEscapingCharsetSet=false;
}
Program: 15656
Project: 15656
Buggy source:
public void setTimeZone(TimeZone timeZone){
  TimeZone prevTimeZone=getTimeZone();
  super.setTimeZone(timeZone);
  if (!timeZone.equals(prevTimeZone)) {
    cachedXSTemplateDateFormatFactory=null;
    cachedISOTemplateDateFormatFactory=null;
    cachedJavaTemplateDateFormatFactory=null;
    cachedTimeFormat=null;
    cachedDateFormat=null;
    cachedDateTimeFormat=null;
    cachedSQLDateAndTimeTimeZoneSameAsNormal=null;
  }
}

Fixed version (ground truth):
public void setTimeZone(TimeZone timeZone){
  TimeZone prevTimeZone=getTimeZone();
  super.setTimeZone(timeZone);
  if (!timeZone.equals(prevTimeZone)) {
    if (cachedTemplateDateFormats != null) {
      for (int i=0; i < CACHED_TDFS_LOCAL_TZ_LENGTH; i++) {
        cachedTemplateDateFormats[i]=null;
      }
    }
    cachedXSTemplateDateFormatFactory=null;
    cachedISOTemplateDateFormatFactory=null;
    cachedJavaTemplateDateFormatFactory=null;
    cachedSQLDateAndTimeTimeZoneSameAsNormal=null;
  }
}
Program: 15659
Project: 15659
Buggy source:
public void setDateFormat(String dateFormat){
  String prevDateFormat=getDateFormat();
  super.setDateFormat(dateFormat);
  if (!dateFormat.equals(prevDateFormat)) {
    cachedDateFormat=cachedDateFormatSysDefTZ=null;
  }
}

Fixed version (ground truth):
public void setDateFormat(String dateFormat){
  String prevDateFormat=getDateFormat();
  super.setDateFormat(dateFormat);
  if (!dateFormat.equals(prevDateFormat)) {
    if (cachedTemplateDateFormats != null) {
      for (int i=0; i < CACHED_TDFS_LENGTH; i+=CACHED_TDFS_ZONELESS_INPUT_OFFS) {
        cachedTemplateDateFormats[i + TemplateDateModel.DATE]=null;
      }
    }
  }
}
Program: 15661
Project: 15661
Buggy source:
ISOTemplateDateFormat(String settingValue,int parsingStart,int dateType,TimeZone timeZone,ISOLikeTemplateDateFormatFactory factory) throws ParseException, UnknownDateTypeFormattingUnsupportedException {
  super(settingValue,parsingStart,dateType,timeZone,factory);
}

Fixed version (ground truth):
ISOTemplateDateFormat(String settingValue,int parsingStart,int dateType,boolean zonelessInput,TimeZone timeZone,ISOLikeTemplateDateFormatFactory factory) throws ParseException, UnknownDateTypeFormattingUnsupportedException {
  super(settingValue,parsingStart,dateType,zonelessInput,timeZone,factory);
}
Program: 15662
Project: 15662
Buggy source:
public TemplateDateFormat get(int dateType,String formatDescriptor) throws java.text.ParseException, UnknownDateTypeFormattingUnsupportedException {
  return new ISOTemplateDateFormat(formatDescriptor,3,dateType,getTimeZone(),this);
}

Fixed version (ground truth):
public TemplateDateFormat get(int dateType,boolean zonelessInput,String formatDescriptor) throws java.text.ParseException, UnknownDateTypeFormattingUnsupportedException {
  return new ISOTemplateDateFormat(formatDescriptor,3,dateType,zonelessInput,getTimeZone(),this);
}
Program: 15663
Project: 15663
Buggy source:
public String format(TemplateDateModel dateModel,boolean zonelessInput) throws TemplateModelException {
  return javaDateFormat.format(dateModel.getAsDate());
}

Fixed version (ground truth):
public String format(TemplateDateModel dateModel) throws TemplateModelException {
  return javaDateFormat.format(dateModel.getAsDate());
}
Program: 15664
Project: 15664
Buggy source:
public TemplateDateFormat get(int dateType,String formatDescriptor) throws ParseException, TemplateModelException, UnknownDateTypeFormattingUnsupportedException {
  Map[] formatCache=this.formatCache;
  if (formatCache == null) {
    formatCache=new Map[4];
    formatCache[TemplateDateModel.UNKNOWN]=new HashMap();
    formatCache[TemplateDateModel.TIME]=new HashMap();
    formatCache[TemplateDateModel.DATE]=new HashMap();
    formatCache[TemplateDateModel.DATETIME]=new HashMap();
    this.formatCache=formatCache;
  }
  Map jDateFormatsForDateType=formatCache[dateType];
  TemplateDateFormat jDateFormat=(TemplateDateFormat)jDateFormatsForDateType.get(formatDescriptor);
  if (jDateFormat != null) {
    return jDateFormat;
  }
  jDateFormat=new JavaTemplateDateFormat(getJavaDateFormat(dateType,formatDescriptor));
  jDateFormatsForDateType.put(formatDescriptor,jDateFormat);
  return jDateFormat;
}

Fixed version (ground truth):
/** 
 * @param zonelessInput Has no effect in this implementation.
 */
public TemplateDateFormat get(int dateType,boolean zonelessInput,String formatDescriptor) throws ParseException, TemplateModelException, UnknownDateTypeFormattingUnsupportedException {
  Map[] formatCache=this.formatCache;
  if (formatCache == null) {
    formatCache=new Map[4];
    this.formatCache=formatCache;
  }
  Map formatsForDateType=formatCache[dateType];
  if (formatsForDateType == null) {
    formatsForDateType=new HashMap();
    formatCache[dateType]=formatsForDateType;
  }
  TemplateDateFormat format=(TemplateDateFormat)formatsForDateType.get(formatDescriptor);
  if (format == null) {
    format=new JavaTemplateDateFormat(getJavaDateFormat(dateType,formatDescriptor));
    formatsForDateType.put(formatDescriptor,format);
  }
  return format;
}
Program: 15665
Project: 15665
Buggy source:
DateFormatter(TemplateDateModel dateModel,Environment env) throws TemplateModelException {
  this.dateModel=dateModel;
  this.env=env;
}

Fixed version (ground truth):
DateFormatter(TemplateDateModel dateModel,Environment env) throws TemplateModelException {
  this.dateModel=dateModel;
  this.env=env;
  final int dateType=dateModel.getDateType();
  this.defaultFormat=dateType == TemplateDateModel.UNKNOWN ? null : env.getTemplateDateFormat(dateType,EvalUtil.modelToDate(dateModel,target).getClass(),target);
}
Program: 15666
Project: 15666
Buggy source:
/** 
 * @param dateModel The date/time/dateTime to format. Most implementations will just work with the return value of{@link TemplateDateModel#getAsDate()}, but some may format differently depending on the properties of a custom   {@link TemplateDateModel} implementation.
 * @param zonelessInput Indicates that the input Java {@link Date} is not from a time zone aware source.When this is  {@code true}, the formatters shouldn't override the time zone provided to its constructor or factory method (most formatters don't do that anyway), and it shouldn't show the time zone, if it can hide it (like a   {@link SimpleDateFormat} pattern-based formatter may can't do that, asthe pattern prescribes what to show). <p>As of FreeMarker 2.3.21, this is  {@code true} exactly when the date is an SQL "datewithout time of the day" (i.e., a  {@link java.sql.Date java.sql.Date}) or an SQL "time of the day" value (i.e., a   {@link java.sql.Time java.sql.Time}, although this rule can change in future, depending on configuration settings and such, so you should rely on this rule, just accept what this parameter says.
 * @return The date/time/dateTime as text, with no escaping (like no HTML escaping). Can't be {@code null}.
 * @throws UnformattableDateException When a {@link TemplateDateModel} can't be formatted because of thevalue/properties of the  {@link TemplateDateModel}. The most often used subclass is  {@link UnknownDateTypeFormattingUnsupportedException}. 
 * @throws TemplateModelException Exception thrown by the {@code dateModel} object when calling its methods.  
 */
public abstract String format(TemplateDateModel dateModel,boolean zonelessInput) throws UnformattableDateException, TemplateModelException ;

Fixed version (ground truth):
/** 
 * @param dateModel The date/time/dateTime to format. Most implementations will just work with the return value of{@link TemplateDateModel#getAsDate()}, but some may format differently depending on the properties of a custom   {@link TemplateDateModel} implementation.
 * @return The date/time/dateTime as text, with no escaping (like no HTML escaping). Can't be {@code null}.
 * @throws UnformattableDateException When a {@link TemplateDateModel} can't be formatted because of thevalue/properties of the  {@link TemplateDateModel}. The most often used subclass is  {@link UnknownDateTypeFormattingUnsupportedException}. 
 * @throws TemplateModelException Exception thrown by the {@code dateModel} object when calling its methods.  
 */
public abstract String format(TemplateDateModel dateModel) throws UnformattableDateException, TemplateModelException ;
Program: 15668
Project: 15668
Buggy source:
XSTemplateDateFormat(String settingValue,int parsingStart,int dateType,TimeZone timeZone,ISOLikeTemplateDateFormatFactory factory) throws ParseException, UnknownDateTypeFormattingUnsupportedException {
  super(settingValue,parsingStart,dateType,timeZone,factory);
}

Fixed version (ground truth):
XSTemplateDateFormat(String settingValue,int parsingStart,int dateType,boolean zonelessInput,TimeZone timeZone,ISOLikeTemplateDateFormatFactory factory) throws ParseException, UnknownDateTypeFormattingUnsupportedException {
  super(settingValue,parsingStart,dateType,zonelessInput,timeZone,factory);
}