Program: 145779
Project: 145779
Buggy source:
public void doFilter(ServletRequest req,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  HttpServletRequest request=(HttpServletRequest)req;
  HttpSession session=request.getSession(true);
  Application app=Application.getInstance(session);
  Configuration config=app.getConfiguration();
  session.setAttribute("String_Node_Str",app);
  if ("String_Node_Str".equals(config.getRealAutodetect())) {
    String xForwardedHost=request.getHeader("String_Node_Str");
    if (xForwardedHost != null) {
      int colonIndex=xForwardedHost.indexOf(':');
      String host=xForwardedHost;
      String port=null;
      if (colonIndex != -1) {
        host=host.substring(0,colonIndex);
        port=xForwardedHost.substring(colonIndex + 1);
      }
      config.set(Configuration.APP_REAL_HOST,host);
      config.set(Configuration.APP_REAL_PORT,port == null ? "String_Node_Str" : port);
    }
 else {
      String host=request.getServerName();
      String port="String_Node_Str" + request.getServerPort();
      config.set(Configuration.APP_REAL_HOST,host);
      config.set(Configuration.APP_REAL_PORT,port);
      config.set(Configuration.APP_REAL_PATH,request.getContextPath());
    }
  }
  try {
    request.setCharacterEncoding(config.getEncoding());
    request=new EncRequestWrapper(request,request.getCharacterEncoding());
  }
 catch (  UnsupportedEncodingException e) {
    Logger.log(Logger.FATAL,"String_Node_Str" + config.getEncoding() + "String_Node_Str",e);
  }
  UserManager um=UserManager.getInstance();
  User user=app.getUser();
  if (user == null) {
    user=um.getUser(request,(HttpServletResponse)response);
  }
  app.setUser(user,session);
  String path=request.getServletPath();
  if (!config.isInstalled()) {
    if (path == null || !path.startsWith("String_Node_Str")) {
      String name=config.getName();
      System.out.println((name == null ? "String_Node_Str" : name) + "String_Node_Str");
      ((HttpServletResponse)response).sendRedirect(request.getContextPath() + "String_Node_Str");
      return;
    }
  }
  if (config.isInstalled()) {
    session.setAttribute("String_Node_Str",SnipSpaceFactory.getInstance());
  }
  Map params=request.getParameterMap();
  Iterator iterator=params.keySet().iterator();
  Map paramMap=new HashMap();
  while (iterator.hasNext()) {
    String key=(String)iterator.next();
    String[] values=(String[])params.get(key);
    paramMap.put(key,values[0]);
  }
  String uri=(String)request.getAttribute("String_Node_Str");
  if (uri != null) {
    paramMap.put("String_Node_Str",config.getUrl(uri));
  }
 else {
    String base=config.getPath() + (path != null ? path : "String_Node_Str");
    String pathInfo=request.getPathInfo();
    paramMap.put("String_Node_Str",config.getUrl(base + (pathInfo != null ? pathInfo : "String_Node_Str")));
  }
  paramMap.put("String_Node_Str",config.getUrl("String_Node_Str"));
  app.setParameters(paramMap);
  chain.doFilter(request,response);
}

Fixed version (ground truth):
public void doFilter(ServletRequest req,ServletResponse response,FilterChain chain) throws IOException, ServletException {
  HttpServletRequest request=(HttpServletRequest)req;
  HttpSession session=request.getSession(true);
  Application app=Application.getInstance(session);
  Configuration config=app.getConfiguration();
  session.setAttribute("String_Node_Str",app);
  if ("String_Node_Str".equals(config.getRealAutodetect())) {
    String xForwardedHost=request.getHeader("String_Node_Str");
    if (xForwardedHost != null) {
      int colonIndex=xForwardedHost.indexOf(':');
      String host=xForwardedHost;
      String port=null;
      if (colonIndex != -1) {
        host=host.substring(0,colonIndex);
        port=xForwardedHost.substring(colonIndex + 1);
      }
      config.set(Configuration.APP_REAL_HOST,host);
      config.set(Configuration.APP_REAL_PORT,port == null ? "String_Node_Str" : port);
    }
 else {
      String host=request.getServerName();
      String port="String_Node_Str" + request.getServerPort();
      config.set(Configuration.APP_REAL_HOST,host);
      config.set(Configuration.APP_REAL_PORT,port);
      config.set(Configuration.APP_REAL_PATH,request.getContextPath());
    }
  }
  try {
    request.setCharacterEncoding(config.getEncoding());
    request=new EncRequestWrapper(request,request.getCharacterEncoding());
  }
 catch (  UnsupportedEncodingException e) {
    Logger.log(Logger.FATAL,"String_Node_Str" + config.getEncoding() + "String_Node_Str",e);
  }
  UserManager um=UserManager.getInstance();
  User user=app.getUser();
  if (user == null) {
    user=um.getUser(request,(HttpServletResponse)response);
  }
  app.setUser(user,session);
  String path=request.getServletPath();
  if (!config.isInstalled()) {
    if (path == null || !path.startsWith("String_Node_Str")) {
      String name=config.getName();
      System.out.println((name == null ? "String_Node_Str" : name) + "String_Node_Str");
      ((HttpServletResponse)response).sendRedirect(request.getContextPath() + "String_Node_Str");
      return;
    }
  }
  if (config.isInstalled()) {
    session.setAttribute("String_Node_Str",SnipSpaceFactory.getInstance());
  }
  Map params=request.getParameterMap();
  Iterator iterator=params.keySet().iterator();
  Map paramMap=new HashMap();
  while (iterator.hasNext()) {
    String key=(String)iterator.next();
    String[] values=(String[])params.get(key);
    paramMap.put(key,values[0]);
  }
  String uri=(String)request.getAttribute("String_Node_Str");
  if (uri != null) {
    paramMap.put("String_Node_Str",config.getUrl(uri));
  }
 else {
    String pathInfo=request.getPathInfo();
    paramMap.put("String_Node_Str",config.getUrl((path != null ? path : "String_Node_Str") + (pathInfo != null ? pathInfo : "String_Node_Str")));
  }
  paramMap.put("String_Node_Str",config.getUrl("String_Node_Str"));
  app.setParameters(paramMap);
  chain.doFilter(request,response);
}