Program: 15592
Project: 15592
Buggy source:
/** 
 * Retrieves the template with the given name (and according the specified further parameters) from the template cache, loading it into the cache first if it's missing/staled. <p>This method is thread-safe.  <p>See   {@link Configuration} for an example of basic usage.
 * @param name The name or path of the template, which is not a real path,but interpreted inside the current  {@link TemplateLoader}. Can't be   {@code null}. The exact syntax of the name is interpreted by the underlying   {@link TemplateLoader}, but the cache makes some assumptions. First, the name is expected to be a hierarchical path, with path components separated by a slash character (not with backslash!). The path (the name) given here must <em>not</em> begin with slash; it's always interpreted relative to the "template root directory". Then, the   {@code ..} and {@code .} path meta-elements will be resolved.For example, if the name is  {@code a/../b/./c.ftl}, then it will be simplified to   {@code b/c.ftl}. The rules regarding this are the same as with conventional UN*X paths. The path must not reach outside the template root directory, that is, it can't be something like   {@code "../templates/my.ftl"} (not even if this pathhappens to be equivalent with  {@code "/my.ftl"}). Further, the path is allowed to contain at most one path element whose name is   {@code *} (asterisk). This path meta-element triggers the<i>acquisition mechanism</i>. If the template is not found in the location described by the concatenation of the path left to the asterisk (called base path) and the part to the right of the asterisk (called resource path), the cache will attempt to remove the rightmost path component from the base path ("go up one directory") and concatenate that with the resource path. The process is repeated until either a template is found, or the base path is completely exhausted.
 * @param locale The requested locale of the template. Can't be {@code null}. Assuming you have specified   {@code en_US} as the locale and{@code myTemplate.ftl} as the name of the template, the cache willfirst try to retrieve  {@code myTemplate_en_US.html}, then  {@code myTemplate.en.ftl}, and finally   {@code myTemplate.ftl}.
 * @param encoding The charset used to interpret the template source code bytes. Can't be {@code null}.
 * @param parseAsFTL If {@code true}, the loaded template is parsed and interpreted normally, as a regular FreeMarker template. If   {@code false}, the loaded template is treated as a static text, so <code>${...}</code>,   {@code <#...>} etc. will not have special meaningin it.
 * @param ignoreMissing If {@code true}, the method won't throw   {@link FileNotFoundException} if the templatedoesn't exist, instead it returns  {@code null}. Other kind of exceptions won't be suppressed.
 * @return the requested template; maybe {@code null} when the {@code ignoreMissing} parameter is {@code true}.
 * @throws FileNotFoundException if the template could not be found.
 * @throws IOException if there was a problem loading the template.
 * @throws ParseException (extends <code>IOException</code>) if the template is syntactically bad.
 * @since 2.3.21
 */
public Template getTemplate(String name,Locale locale,String encoding,boolean parseAsFTL,boolean ignoreMissing) throws IOException {
  Template result=cache.getTemplate(name,locale,encoding,parseAsFTL);
  if (result == null) {
    if (ignoreMissing) {
      return null;
    }
    TemplateLoader tl=getTemplateLoader();
    String msg;
    if (tl == null) {
      msg="String_Node_Str" + StringUtil.jQuote(name) + "String_Node_Str";
    }
 else {
      msg="String_Node_Str" + StringUtil.jQuote(name) + "String_Node_Str"+ "String_Node_Str";
      String tlDesc;
      try {
        tlDesc=tl.toString();
      }
 catch (      Throwable e) {
        tlDesc=tl.getClass().getName() + "String_Node_Str";
      }
      msg+=tlDesc + "String_Node_Str";
      if (!templateLoaderWasSet) {
        msg+="String_Node_Str" + "String_Node_Str";
      }
    }
    throw new FileNotFoundException(msg);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Retrieves the template with the given name (and according the specified further parameters) from the template cache, loading it into the cache first if it's missing/staled. <p>This method is thread-safe.  <p>See   {@link Configuration} for an example of basic usage.
 * @param name The name or path of the template, which is not a real path,but interpreted inside the current  {@link TemplateLoader}. Can't be   {@code null}. The exact syntax of the name is interpreted by the underlying   {@link TemplateLoader}, but the cache makes some assumptions. First, the name is expected to be a hierarchical path, with path components separated by a slash character (not with backslash!). The path (the name) given here must <em>not</em> begin with slash; it's always interpreted relative to the "template root directory". Then, the   {@code ..} and {@code .} path meta-elements will be resolved.For example, if the name is  {@code a/../b/./c.ftl}, then it will be simplified to   {@code b/c.ftl}. The rules regarding this are the same as with conventional UN*X paths. The path must not reach outside the template root directory, that is, it can't be something like   {@code "../templates/my.ftl"} (not even if this pathhappens to be equivalent with  {@code "/my.ftl"}). Further, the path is allowed to contain at most one path element whose name is   {@code *} (asterisk). This path meta-element triggers the<i>acquisition mechanism</i>. If the template is not found in the location described by the concatenation of the path left to the asterisk (called base path) and the part to the right of the asterisk (called resource path), the cache will attempt to remove the rightmost path component from the base path ("go up one directory") and concatenate that with the resource path. The process is repeated until either a template is found, or the base path is completely exhausted.
 * @param locale The requested locale of the template. Can't be {@code null}. Assuming you have specified   {@code en_US} as the locale and{@code myTemplate.ftl} as the name of the template, the cache willfirst try to retrieve  {@code myTemplate_en_US.html}, then  {@code myTemplate.en.ftl}, and finally   {@code myTemplate.ftl}.
 * @param encoding The charset used to interpret the template source code bytes. Can't be {@code null}.
 * @param parseAsFTL If {@code true}, the loaded template is parsed and interpreted normally, as a regular FreeMarker template. If   {@code false}, the loaded template is treated as a static text, so <code>${...}</code>,   {@code <#...>} etc. will not have special meaningin it.
 * @param ignoreMissing If {@code true}, the method won't throw   {@link FileNotFoundException} if the templatedoesn't exist, instead it returns  {@code null}. Other kind of exceptions won't be suppressed.
 * @return the requested template; maybe {@code null} when the {@code ignoreMissing} parameter is {@code true}.
 * @throws FileNotFoundException if the template could not be found.
 * @throws IOException if there was a problem loading the template.
 * @throws ParseException (extends <code>IOException</code>) if the template is syntactically bad.
 * @since 2.3.21
 */
public Template getTemplate(String name,Locale locale,String encoding,boolean parseAsFTL,boolean ignoreMissing) throws IOException {
  Template result=cache.getTemplate(name,locale,encoding,parseAsFTL);
  if (result == null) {
    if (ignoreMissing) {
      return null;
    }
    TemplateLoader tl=getTemplateLoader();
    String msg;
    if (tl == null) {
      msg="String_Node_Str" + StringUtil.jQuote(name) + "String_Node_Str";
    }
 else {
      msg="String_Node_Str" + StringUtil.jQuote(name) + "String_Node_Str"+ "String_Node_Str";
      String tlDesc;
      try {
        tlDesc=tl.toString();
      }
 catch (      Throwable e) {
        tlDesc=tl.getClass().getName() + "String_Node_Str";
      }
      msg+=tlDesc + "String_Node_Str";
      if (!templateLoaderExplicitlySet) {
        msg+="String_Node_Str" + "String_Node_Str";
      }
    }
    throw new FileNotFoundException(msg);
  }
  return result;
}