Program: 15597
Project: 15597
Buggy source:
protected FreeMarkerPageContext() throws TemplateModelException {
  environment=Environment.getCurrentEnvironment();
  TemplateModel appModel=environment.getGlobalVariable(FreemarkerServlet.KEY_APPLICATION_PRIVATE);
  if (!(appModel instanceof ServletContextHashModel)) {
    appModel=environment.getGlobalVariable(FreemarkerServlet.KEY_APPLICATION);
  }
  if (appModel instanceof ServletContextHashModel) {
    this.servlet=((ServletContextHashModel)appModel).getServlet();
  }
 else {
    throw new TemplateModelException("String_Node_Str" + ServletContextHashModel.class.getName() + "String_Node_Str"+ FreemarkerServlet.KEY_APPLICATION_PRIVATE+ "String_Node_Str"+ FreemarkerServlet.KEY_APPLICATION);
  }
  TemplateModel requestModel=environment.getGlobalVariable(FreemarkerServlet.KEY_REQUEST_PRIVATE);
  if (!(requestModel instanceof HttpRequestHashModel)) {
    requestModel=environment.getGlobalVariable(FreemarkerServlet.KEY_REQUEST);
  }
  if (requestModel instanceof HttpRequestHashModel) {
    HttpRequestHashModel reqHash=(HttpRequestHashModel)requestModel;
    this.request=reqHash.getRequest();
    this.session=request.getSession(false);
    this.response=reqHash.getResponse();
    this.wrapper=reqHash.getObjectWrapper();
  }
 else {
    throw new TemplateModelException("String_Node_Str" + HttpRequestHashModel.class.getName() + "String_Node_Str"+ FreemarkerServlet.KEY_REQUEST_PRIVATE+ "String_Node_Str"+ FreemarkerServlet.KEY_REQUEST);
  }
  setAttribute(REQUEST,request);
  setAttribute(RESPONSE,response);
  if (session != null)   setAttribute(SESSION,session);
  setAttribute(PAGE,servlet);
  setAttribute(CONFIG,servlet.getServletConfig());
  setAttribute(PAGECONTEXT,this);
  setAttribute(APPLICATION,servlet.getServletContext());
}

Fixed version (ground truth):
protected FreeMarkerPageContext() throws TemplateModelException {
  environment=Environment.getCurrentEnvironment();
  incompatibleImprovements=environment.getConfiguration().getIncompatibleImprovements().intValue();
  TemplateModel appModel=environment.getGlobalVariable(FreemarkerServlet.KEY_APPLICATION_PRIVATE);
  if (!(appModel instanceof ServletContextHashModel)) {
    appModel=environment.getGlobalVariable(FreemarkerServlet.KEY_APPLICATION);
  }
  if (appModel instanceof ServletContextHashModel) {
    this.servlet=((ServletContextHashModel)appModel).getServlet();
  }
 else {
    throw new TemplateModelException("String_Node_Str" + ServletContextHashModel.class.getName() + "String_Node_Str"+ FreemarkerServlet.KEY_APPLICATION_PRIVATE+ "String_Node_Str"+ FreemarkerServlet.KEY_APPLICATION);
  }
  TemplateModel requestModel=environment.getGlobalVariable(FreemarkerServlet.KEY_REQUEST_PRIVATE);
  if (!(requestModel instanceof HttpRequestHashModel)) {
    requestModel=environment.getGlobalVariable(FreemarkerServlet.KEY_REQUEST);
  }
  if (requestModel instanceof HttpRequestHashModel) {
    HttpRequestHashModel reqHash=(HttpRequestHashModel)requestModel;
    this.request=reqHash.getRequest();
    this.session=request.getSession(false);
    this.response=reqHash.getResponse();
    this.wrapper=reqHash.getObjectWrapper();
  }
 else {
    throw new TemplateModelException("String_Node_Str" + HttpRequestHashModel.class.getName() + "String_Node_Str"+ FreemarkerServlet.KEY_REQUEST_PRIVATE+ "String_Node_Str"+ FreemarkerServlet.KEY_REQUEST);
  }
  setAttribute(REQUEST,request);
  setAttribute(RESPONSE,response);
  if (session != null)   setAttribute(SESSION,session);
  setAttribute(PAGE,servlet);
  setAttribute(CONFIG,servlet.getServletConfig());
  setAttribute(PAGECONTEXT,this);
  setAttribute(APPLICATION,servlet.getServletContext());
}