Program: 24682
Project: 24682
Buggy source:
/** 
 * Calculates and adds the "servlet.path" and "root.path" attributes to the given transformer. Also adds "xtf.home" based on the servlet root directory.
 */
public void stuffSpecialAttribs(HttpServletRequest req,Transformer trans){
  String uri=req.getRequestURL().toString();
  if (!uri.startsWith("String_Node_Str"))   uri=req.getRequestURI();
  if (uri.indexOf('?') >= 0)   uri=uri.substring(0,uri.indexOf('?'));
  uri=decodeURL(uri);
  uri=convertUTF8inURL(uri);
  trans.setParameter("String_Node_Str",new StringValue(uri));
  trans.setParameter("String_Node_Str",new StringValue(uri));
  String rootPath=uri;
  if (rootPath.endsWith("String_Node_Str"))   rootPath=rootPath.substring(0,rootPath.length() - 1);
  int slashPos=rootPath.lastIndexOf('/');
  if (slashPos >= 1)   rootPath=rootPath.substring(0,slashPos);
  String lookFor="String_Node_Str";
  if (rootPath.endsWith(lookFor))   rootPath=rootPath.substring(0,rootPath.length() - lookFor.length());
  rootPath=rootPath + "String_Node_Str";
  trans.setParameter("String_Node_Str",new StringValue(rootPath));
  trans.setParameter("String_Node_Str",new StringValue(rootPath));
  String xtfHome=Path.normalizePath(getRealPath("String_Node_Str"));
  trans.setParameter("String_Node_Str",xtfHome);
  Enumeration i=req.getHeaderNames();
  trans.setParameter("String_Node_Str",getRequestURL(req));
  while (i.hasMoreElements()) {
    String name=(String)i.nextElement();
    String value=req.getHeader(name);
    trans.setParameter("String_Node_Str" + name,new StringValue(value));
    if (!(name.equals(name.toLowerCase())))     trans.setParameter("String_Node_Str" + (name.toLowerCase()),new StringValue(value));
  }
}

Fixed version (ground truth):
/** 
 * Calculates and adds the "servlet.path" and "root.path" attributes to the given transformer. Also adds "xtf.home" based on the servlet root directory.
 */
public void stuffSpecialAttribs(HttpServletRequest req,Transformer trans){
  String uri=req.getRequestURL().toString();
  if (!uri.startsWith("String_Node_Str"))   uri=req.getRequestURI();
  if (uri.indexOf('?') >= 0)   uri=uri.substring(0,uri.indexOf('?'));
  uri=decodeURL(uri);
  uri=convertUTF8inURL(uri);
  trans.setParameter("String_Node_Str",new StringValue(uri));
  trans.setParameter("String_Node_Str",new StringValue(uri));
  String rootPath=uri;
  if (rootPath.endsWith("String_Node_Str"))   rootPath=rootPath.substring(0,rootPath.length() - 1);
  int slashPos=rootPath.lastIndexOf('/');
  if (slashPos >= 1)   rootPath=rootPath.substring(0,slashPos);
  String lookFor="String_Node_Str";
  if (rootPath.endsWith(lookFor))   rootPath=rootPath.substring(0,rootPath.length() - lookFor.length());
  rootPath=rootPath + "String_Node_Str";
  trans.setParameter("String_Node_Str",new StringValue(rootPath));
  trans.setParameter("String_Node_Str",new StringValue(rootPath));
  String xtfHome=Path.normalizePath(getRealPath("String_Node_Str"));
  trans.setParameter("String_Node_Str",xtfHome);
  Enumeration i=req.getHeaderNames();
  trans.setParameter("String_Node_Str",getRequestURL(req));
  trans.setParameter("String_Node_Str",getRequestURL(req,true));
  while (i.hasMoreElements()) {
    String name=(String)i.nextElement();
    String value=req.getHeader(name);
    trans.setParameter("String_Node_Str" + name,new StringValue(value));
    if (!(name.equals(name.toLowerCase())))     trans.setParameter("String_Node_Str" + (name.toLowerCase()),new StringValue(value));
  }
}