Program: 28630
Project: 28630
Buggy source:
/** 
 * Prints out important Servlet API and container information <p> Copied from SnoopAllServlet by Craig R. McClanahan </p>
 * @param out    ServletOutputStream as target of the information
 * @param req    HttpServletRequest object used as source of information
 * @param res    HttpServletResponse object currently not used but couldprovide future information
 * @param htmlEntityEncoder
 * @exception IOException  if a write operation exception occurs
 */
protected void printServletEnvironment(ServletOutputStream out,HttpServletRequest req,HttpServletResponse res,HtmlEntityEncoder htmlEntityEncoder) throws IOException {
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  Enumeration<String> attrs=req.getAttributeNames();
  while (attrs.hasMoreElements()) {
    String attr=attrs.nextElement();
    out.println("String_Node_Str" + htmlEntityEncoder.encode(attr) + "String_Node_Str"+ htmlEntityEncoder.encode(req.getAttribute(attr)));
  }
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getCharacterEncoding()));
  out.println("String_Node_Str" + req.getContentLength());
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getContentType()));
  Enumeration<Locale> locales=req.getLocales();
  while (locales.hasMoreElements()) {
    Locale locale=locales.nextElement();
    out.println("String_Node_Str" + htmlEntityEncoder.encode(locale));
  }
  Enumeration<String> params=req.getParameterNames();
  while (params.hasMoreElements()) {
    String param=params.nextElement();
    String values[]=req.getParameterValues(param);
    for (int i=0; i < values.length; i++)     out.println("String_Node_Str" + htmlEntityEncoder.encode(param) + "String_Node_Str"+ htmlEntityEncoder.encode(values[i]));
  }
  out.println("String_Node_Str" + req.getProtocol());
  out.println("String_Node_Str" + req.getRemoteAddr());
  out.println("String_Node_Str" + req.getRemoteHost());
  out.println("String_Node_Str" + req.getScheme());
  out.println("String_Node_Str" + req.isSecure());
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getServerName()));
  out.println("String_Node_Str" + req.getServerPort());
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str" + req.getAuthType());
  out.println("String_Node_Str" + req.getContextPath());
  Cookie cookies[]=req.getCookies();
  if (cookies != null) {
    for (int i=0; i < cookies.length; i++)     out.println("String_Node_Str" + htmlEntityEncoder.encode(cookies[i].getName()) + "String_Node_Str"+ htmlEntityEncoder.encode(cookies[i].getValue()));
  }
  Enumeration<String> headers=req.getHeaderNames();
  while (headers.hasMoreElements()) {
    String header=headers.nextElement();
    out.println("String_Node_Str" + htmlEntityEncoder.encode(header) + "String_Node_Str"+ htmlEntityEncoder.encode(req.getHeader(header)));
  }
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getMethod()));
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getPathInfo()));
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getPathTranslated()));
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getQueryString()));
  out.println("String_Node_Str" + req.getRemoteUser());
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getRequestedSessionId()));
  out.println("String_Node_Str" + req.isRequestedSessionIdFromCookie());
  out.println("String_Node_Str" + req.isRequestedSessionIdFromURL());
  out.println("String_Node_Str" + req.isRequestedSessionIdValid());
  out.println("String_Node_Str" + req.getRequestURI());
  out.println("String_Node_Str" + req.getServletPath());
  out.println("String_Node_Str" + req.getUserPrincipal());
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  attrs=req.getAttributeNames();
  while (attrs.hasMoreElements()) {
    String attr=attrs.nextElement();
    out.println("String_Node_Str" + htmlEntityEncoder.encode(attr) + "String_Node_Str"+ htmlEntityEncoder.encode(req.getAttribute(attr)));
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  HttpSession session=req.getSession(false);
  if (session != null) {
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str" + session.getId());
    out.println("String_Node_Str" + new Date(session.getCreationTime()));
    out.println("String_Node_Str" + new Date(session.getLastAccessedTime()));
    out.println("String_Node_Str" + session.getMaxInactiveInterval());
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    attrs=session.getAttributeNames();
    while (attrs.hasMoreElements()) {
      String attr=attrs.nextElement();
      out.println("String_Node_Str" + htmlEntityEncoder.encode(attr) + "String_Node_Str"+ htmlEntityEncoder.encode(session.getAttribute(attr)));
    }
    out.println("String_Node_Str");
    out.println("String_Node_Str");
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str" + getServletConfig().getServletName());
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  params=getServletConfig().getInitParameterNames();
  while (params.hasMoreElements()) {
    String param=params.nextElement();
    String value=getServletConfig().getInitParameter(param);
    out.println("String_Node_Str" + param + "String_Node_Str"+ value);
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str" + getServletContext().getMajorVersion());
  out.println("String_Node_Str" + getServletContext().getMinorVersion());
  out.println("String_Node_Str" + getServletContext().getRealPath("String_Node_Str"));
  out.println("String_Node_Str" + getServletContext().getServerInfo());
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  params=getServletContext().getInitParameterNames();
  while (params.hasMoreElements()) {
    String param=params.nextElement();
    String value=getServletContext().getInitParameter(param);
    out.println("String_Node_Str" + param + "String_Node_Str"+ value);
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  attrs=getServletContext().getAttributeNames();
  while (attrs.hasMoreElements()) {
    String attr=attrs.nextElement();
    out.println("String_Node_Str" + attr + "String_Node_Str"+ getServletContext().getAttribute(attr));
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Prints out important Servlet API and container information <p> Copied from SnoopAllServlet by Craig R. McClanahan </p>
 * @param out    ServletOutputStream as target of the information
 * @param req    HttpServletRequest object used as source of information
 * @param res    HttpServletResponse object currently not used but couldprovide future information
 * @param htmlEntityEncoder
 * @exception IOException  if a write operation exception occurs
 */
protected void printServletEnvironment(ServletOutputStream out,HttpServletRequest req,HttpServletResponse res,HtmlEntityEncoder htmlEntityEncoder) throws IOException {
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  Enumeration<String> attrs=req.getAttributeNames();
  while (attrs.hasMoreElements()) {
    String attr=attrs.nextElement();
    out.println("String_Node_Str" + htmlEntityEncoder.encode(attr) + "String_Node_Str"+ htmlEntityEncoder.encode(req.getAttribute(attr)));
  }
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getCharacterEncoding()));
  out.println("String_Node_Str" + req.getContentLength());
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getContentType()));
  Enumeration<Locale> locales=req.getLocales();
  while (locales.hasMoreElements()) {
    Locale locale=locales.nextElement();
    out.println("String_Node_Str" + htmlEntityEncoder.encode(locale));
  }
  Enumeration<String> params=req.getParameterNames();
  while (params.hasMoreElements()) {
    String param=params.nextElement();
    String values[]=req.getParameterValues(param);
    for (int i=0; i < values.length; i++)     out.println("String_Node_Str" + htmlEntityEncoder.encode(param) + "String_Node_Str"+ htmlEntityEncoder.encode(values[i]));
  }
  out.println("String_Node_Str" + req.getProtocol());
  out.println("String_Node_Str" + req.getRemoteAddr());
  out.println("String_Node_Str" + req.getRemoteHost());
  out.println("String_Node_Str" + req.getScheme());
  out.println("String_Node_Str" + req.isSecure());
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getServerName()));
  out.println("String_Node_Str" + req.getServerPort());
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str" + req.getAuthType());
  out.println("String_Node_Str" + req.getContextPath());
  Cookie cookies[]=req.getCookies();
  if (cookies != null) {
    for (int i=0; i < cookies.length; i++)     out.println("String_Node_Str" + htmlEntityEncoder.encode(cookies[i].getName()) + "String_Node_Str"+ htmlEntityEncoder.encode(cookies[i].getValue()));
  }
  Enumeration<String> headers=req.getHeaderNames();
  while (headers.hasMoreElements()) {
    String header=headers.nextElement();
    out.println("String_Node_Str" + htmlEntityEncoder.encode(header) + "String_Node_Str"+ htmlEntityEncoder.encode(req.getHeader(header)));
  }
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getMethod()));
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getPathInfo()));
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getPathTranslated()));
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getQueryString()));
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getRemoteUser()));
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getRequestedSessionId()));
  out.println("String_Node_Str" + req.isRequestedSessionIdFromCookie());
  out.println("String_Node_Str" + req.isRequestedSessionIdFromURL());
  out.println("String_Node_Str" + req.isRequestedSessionIdValid());
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getRequestURI()));
  out.println("String_Node_Str" + req.getServletPath());
  out.println("String_Node_Str" + htmlEntityEncoder.encode(req.getUserPrincipal()));
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  attrs=req.getAttributeNames();
  while (attrs.hasMoreElements()) {
    String attr=attrs.nextElement();
    out.println("String_Node_Str" + htmlEntityEncoder.encode(attr) + "String_Node_Str"+ htmlEntityEncoder.encode(req.getAttribute(attr)));
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  HttpSession session=req.getSession(false);
  if (session != null) {
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str" + htmlEntityEncoder.encode(session.getId()));
    out.println("String_Node_Str" + new Date(session.getCreationTime()));
    out.println("String_Node_Str" + new Date(session.getLastAccessedTime()));
    out.println("String_Node_Str" + session.getMaxInactiveInterval());
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    out.println("String_Node_Str");
    attrs=session.getAttributeNames();
    while (attrs.hasMoreElements()) {
      String attr=attrs.nextElement();
      out.println("String_Node_Str" + htmlEntityEncoder.encode(attr) + "String_Node_Str"+ htmlEntityEncoder.encode(session.getAttribute(attr)));
    }
    out.println("String_Node_Str");
    out.println("String_Node_Str");
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str" + getServletConfig().getServletName());
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  params=getServletConfig().getInitParameterNames();
  while (params.hasMoreElements()) {
    String param=params.nextElement();
    String value=getServletConfig().getInitParameter(param);
    out.println("String_Node_Str" + param + "String_Node_Str"+ value);
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str" + getServletContext().getMajorVersion());
  out.println("String_Node_Str" + getServletContext().getMinorVersion());
  out.println("String_Node_Str" + getServletContext().getRealPath("String_Node_Str"));
  out.println("String_Node_Str" + getServletContext().getServerInfo());
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  params=getServletContext().getInitParameterNames();
  while (params.hasMoreElements()) {
    String param=params.nextElement();
    String value=getServletContext().getInitParameter(param);
    out.println("String_Node_Str" + param + "String_Node_Str"+ value);
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  out.println("String_Node_Str");
  attrs=getServletContext().getAttributeNames();
  while (attrs.hasMoreElements()) {
    String attr=attrs.nextElement();
    out.println("String_Node_Str" + attr + "String_Node_Str"+ getServletContext().getAttribute(attr));
  }
  out.println("String_Node_Str");
  out.println("String_Node_Str");
}