Program: 15573
Project: 15573
Buggy source:
private Template loadTemplate(final TemplateLoader templateLoader,final Object source,final String name,final String sourceName,final Locale locale,final Object customLookupCondition,final String initialEncoding,final boolean parseAsFTL) throws IOException {
  Template template;
  String actualEncoding;
{
    if (parseAsFTL) {
      try {
        final Reader reader=templateLoader.getReader(source,initialEncoding);
        try {
          template=new Template(name,sourceName,reader,config,initialEncoding);
        }
  finally {
          reader.close();
        }
        actualEncoding=initialEncoding;
      }
 catch (      Template.WrongEncodingException wee) {
        actualEncoding=wee.getTemplateSpecifiedEncoding();
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str" + initialEncoding + "String_Node_Str"+ actualEncoding+ "String_Node_Str"+ sourceName);
        }
        final Reader reader=templateLoader.getReader(source,actualEncoding);
        try {
          template=new Template(name,sourceName,reader,config,actualEncoding);
        }
  finally {
          reader.close();
        }
      }
    }
 else {
      final StringWriter sw=new StringWriter();
      final char[] buf=new char[4096];
      final Reader reader=templateLoader.getReader(source,initialEncoding);
      try {
        fetchChars:         while (true) {
          int charsRead=reader.read(buf);
          if (charsRead > 0) {
            sw.write(buf,0,charsRead);
          }
 else           if (charsRead < 0) {
            break fetchChars;
          }
        }
      }
  finally {
        reader.close();
      }
      template=Template.getPlainTextTemplate(name,sw.toString(),config);
      actualEncoding=initialEncoding;
    }
  }
  template.setLocale(locale);
  template.setCustomLookupCondition(customLookupCondition);
  template.setEncoding(actualEncoding);
  return template;
}

Fixed version (ground truth):
private Template loadTemplate(final TemplateLoader templateLoader,final Object source,final String name,final String sourceName,final Locale locale,final Object customLookupCondition,final String initialEncoding,final boolean parseAsFTL) throws IOException {
  Template template;
  String actualEncoding;
{
    if (parseAsFTL) {
      try {
        final Reader reader=templateLoader.getReader(source,initialEncoding);
        try {
          template=new Template(name,sourceName,reader,config,initialEncoding);
        }
  finally {
          reader.close();
        }
        actualEncoding=initialEncoding;
      }
 catch (      Template.WrongEncodingException wee) {
        actualEncoding=wee.getTemplateSpecifiedEncoding();
        if (LOG.isDebugEnabled()) {
          LOG.debug("String_Node_Str" + initialEncoding + "String_Node_Str"+ actualEncoding+ "String_Node_Str"+ sourceName);
        }
        final Reader reader=templateLoader.getReader(source,actualEncoding);
        try {
          template=new Template(name,sourceName,reader,config,actualEncoding);
        }
  finally {
          reader.close();
        }
      }
    }
 else {
      final StringWriter sw=new StringWriter();
      final char[] buf=new char[4096];
      final Reader reader=templateLoader.getReader(source,initialEncoding);
      try {
        fetchChars:         while (true) {
          int charsRead=reader.read(buf);
          if (charsRead > 0) {
            sw.write(buf,0,charsRead);
          }
 else           if (charsRead < 0) {
            break fetchChars;
          }
        }
      }
  finally {
        reader.close();
      }
      template=Template.getPlainTextTemplate(name,sourceName,sw.toString(),config);
      actualEncoding=initialEncoding;
    }
  }
  template.setLocale(locale);
  template.setCustomLookupCondition(customLookupCondition);
  template.setEncoding(actualEncoding);
  return template;
}