Program: 35831
Project: 35831
Buggy source:
/** 
 * Retrieves a template from the provider application and renders it to the writer replacing the parameters with the given map. If "name" param is null, the whole page will be used as the template.<br /> eg: The template "mytemplate" can be delimited in the provider page by comments "&lt;!--$begintemplate$mytemplate$--&gt;" and "&lt;!--$endtemplate$mytemplate$--&gt;".<br /> Inside the template, the parameters can be defined by comments.<br /> eg: parameter named "myparam" should be delimited by comments "&lt;!--$beginparam$myparam$--&gt;" and "&lt;!--$endparam$myparam$--&gt;"
 * @param page Address of the page containing the template
 * @param name Template name
 * @param writer Writer where to write the result
 * @param originalRequest originating request object
 * @param params Blocks to replace inside the template
 * @param replaceRules The replace rules to be applied on the block
 * @param parameters Parameters to be added to the request (TODO: unused???)
 * @param propagateJsessionId indicates whether <code>jsessionid</code>should be propagated or just removed from generated output
 * @throws IOException If an IOException occurs while writing to the writer
 * @throws RenderingException If an Exception occurs while retrieving thetemplate
 */
public void renderTemplate(String page,String name,Writer writer,HttpServletRequest originalRequest,Map<String,String> params,Map<String,String> replaceRules,Map<String,String> parameters,boolean propagateJsessionId) throws IOException, RenderingException {
  RequestContext target=new RequestContext(this,page,params,originalRequest,propagateJsessionId);
  StringOutput stringOutput=getResourceAsString(target);
  Renderer renderer=new TemplateRenderer(name,params,page);
  renderer.render(stringOutput,writer,replaceRules);
}

Fixed version (ground truth):
/** 
 * Retrieves a template from the provider application and renders it to the writer replacing the parameters with the given map. If "name" param is null, the whole page will be used as the template.<br /> eg: The template "mytemplate" can be delimited in the provider page by comments "&lt;!--$begintemplate$mytemplate$--&gt;" and "&lt;!--$endtemplate$mytemplate$--&gt;".<br /> Inside the template, the parameters can be defined by comments.<br /> eg: parameter named "myparam" should be delimited by comments "&lt;!--$beginparam$myparam$--&gt;" and "&lt;!--$endparam$myparam$--&gt;"
 * @param page Address of the page containing the template
 * @param name Template name
 * @param writer Writer where to write the result
 * @param originalRequest originating request object
 * @param params Blocks to replace inside the template
 * @param replaceRules The replace rules to be applied on the block
 * @param parameters Parameters to be added to the request (TODO: unused???)
 * @param propagateJsessionId indicates whether <code>jsessionid</code>should be propagated or just removed from generated output
 * @throws IOException If an IOException occurs while writing to the writer
 * @throws RenderingException If an Exception occurs while retrieving thetemplate
 */
public void renderTemplate(String page,String name,Writer writer,HttpServletRequest originalRequest,Map<String,String> params,Map<String,String> replaceRules,Map<String,String> parameters,boolean propagateJsessionId) throws IOException, RenderingException {
  RequestContext target=new RequestContext(this,page,parameters,originalRequest,propagateJsessionId);
  StringOutput stringOutput=getResourceAsString(target);
  Renderer renderer=new TemplateRenderer(name,params,page);
  renderer.render(stringOutput,writer,replaceRules);
}