Program: 24795
Project: 24795
Buggy source:
/** 
 * Called when a lookup isn't (yet) in the cache. Passes the URL parameters to the docReqParser stylesheet, and gathers the result into a  {@link DocInfo} structure.
 * @param key           (LinkedList) URL parameters specifying the request
 * @return              (DocInfo) info about that document
 * @throws Exception    If anything goes wrong loading or runningthe docLookup stylesheet.
 */
protected Object generate(Object key) throws Exception {
  LinkedList params=(LinkedList)key;
  DocInfo info=new DocInfo();
  Templates pss=servlet.stylesheetCache.find(config.docLookupSheet);
  Iterator di=servlet.stylesheetCache.getDependencies(config.docLookupSheet);
  LinkedList oldStylesheetDeps=new LinkedList();
  while (di.hasNext())   oldStylesheetDeps.add(di.next());
  Transformer trans;
  if (prevStylesheet.get() == pss) {
    trans=(Transformer)prevTransformer.get();
    trans.clearParameters();
  }
 else {
    trans=pss.newTransformer();
  }
  AttribList attrList=new AttribList();
  for (Iterator iter=params.iterator(); iter.hasNext(); ) {
    String paramName=(String)iter.next();
    String paramVal=(String)iter.next();
    trans.setParameter(paramName,new StringValue(paramVal));
    attrList.put(paramName,paramVal);
  }
  if (!(trans.getErrorListener() instanceof XTFSaxonErrorListener))   trans.setErrorListener(new XTFSaxonErrorListener());
  XMLFormatter paramBlock=new XMLFormatter();
  servlet.buildParamBlock(attrList,paramBlock,null,null);
  NodeInfo paramDoc=paramBlock.toNode();
  if (Trace.getOutputLevel() >= Trace.debug) {
    Trace.debug("String_Node_Str");
    Trace.tab();
    Trace.debug(XMLWriter.toString(paramDoc));
    Trace.untab();
  }
  TreeBuilder result;
synchronized (servlet.stylesheetCache) {
    servlet.stylesheetCache.setDependencyReceiver(this);
    try {
      result=new TreeBuilder();
      trans.transform(paramDoc,result);
    }
  finally {
      servlet.stylesheetCache.setDependencyReceiver(null);
    }
  }
  if (Trace.getOutputLevel() >= Trace.debug) {
    Trace.debug("String_Node_Str");
    Trace.tab();
    Trace.debug(XMLWriter.toString(result.getCurrentRoot()));
    Trace.untab();
  }
  addDependency(new CacheDependency(servlet.stylesheetCache,config.docLookupSheet));
  EasyNode root=new EasyNode(result.getCurrentRoot());
  for (int i=0; i < root.nChildren(); i++) {
    EasyNode el=root.child(i);
    String tagName=el.name();
    if (tagName.equals("String_Node_Str"))     info.style=servlet.getRealPath(el.attrValue("String_Node_Str"));
 else     if (tagName.equals("String_Node_Str"))     info.source=servlet.getRealPath(el.attrValue("String_Node_Str"));
 else     if (tagName.equals("String_Node_Str")) {
      info.indexConfig=servlet.getRealPath(el.attrValue("String_Node_Str"));
      info.indexName=el.attrValue("String_Node_Str");
    }
 else     if (tagName.equals("String_Node_Str"))     info.brand=servlet.getRealPath(el.attrValue("String_Node_Str"));
 else     if (tagName.equals("String_Node_Str"))     info.authSpecs.add(servlet.authenticator.processAuthTag(el));
 else     if (tagName.equals("String_Node_Str")) {
      info.query=new QueryRequestParser().parseRequest(el.getWrappedNode(),new File(servlet.getRealPath("String_Node_Str")));
    }
 else     if (tagName.equalsIgnoreCase("String_Node_Str"))     info.preFilter=servlet.getRealPath(el.attrValue("String_Node_Str"));
 else     if (tagName.equalsIgnoreCase("String_Node_Str")) {
      String val=el.attrValue("String_Node_Str");
      if (val.matches("String_Node_Str"))       info.removeDoctypeDecl=true;
 else       if (val.matches("String_Node_Str"))       info.removeDoctypeDecl=false;
 else       throw new DynaXMLException("String_Node_Str" + "String_Node_Str" + tagName + "String_Node_Str"+ val+ "String_Node_Str");
    }
 else     throw new DynaXMLException("String_Node_Str" + tagName + "String_Node_Str");
  }
  if (TextServlet.isEmpty(info.source))   throw new InvalidDocumentException();
  TextServlet.requireOrElse(info.style,"String_Node_Str");
  if (TextServlet.isEmpty(info.indexConfig) && !TextServlet.isEmpty(info.indexName))   throw new GeneralException("String_Node_Str");
  if (!TextServlet.isEmpty(info.indexConfig) && TextServlet.isEmpty(info.indexName))   throw new GeneralException("String_Node_Str");
  return info;
}

Fixed version (ground truth):
/** 
 * Called when a lookup isn't (yet) in the cache. Passes the URL parameters to the docReqParser stylesheet, and gathers the result into a  {@link DocInfo} structure.
 * @param key           (LinkedList) URL parameters specifying the request
 * @return              (DocInfo) info about that document
 * @throws Exception    If anything goes wrong loading or runningthe docLookup stylesheet.
 */
protected Object generate(Object key) throws Exception {
  LinkedList params=(LinkedList)key;
  DocInfo info=new DocInfo();
  Templates pss=servlet.stylesheetCache.find(config.docLookupSheet);
  Iterator di=servlet.stylesheetCache.getDependencies(config.docLookupSheet);
  LinkedList oldStylesheetDeps=new LinkedList();
  while (di.hasNext())   oldStylesheetDeps.add(di.next());
  Transformer trans;
  if (prevStylesheet.get() == pss) {
    trans=(Transformer)prevTransformer.get();
    trans.clearParameters();
  }
 else {
    trans=pss.newTransformer();
  }
  AttribList attrList=new AttribList();
  for (Iterator iter=params.iterator(); iter.hasNext(); ) {
    String paramName=(String)iter.next();
    String paramVal=(String)iter.next();
    trans.setParameter(paramName,new StringValue(paramVal));
    attrList.put(paramName,paramVal);
  }
  if (!(trans.getErrorListener() instanceof XTFSaxonErrorListener))   trans.setErrorListener(new XTFSaxonErrorListener());
  XMLFormatter paramBlock=new XMLFormatter();
  servlet.buildParamBlock(attrList,paramBlock,new HashMap(),null);
  NodeInfo paramDoc=paramBlock.toNode();
  if (Trace.getOutputLevel() >= Trace.debug) {
    Trace.debug("String_Node_Str");
    Trace.tab();
    Trace.debug(XMLWriter.toString(paramDoc));
    Trace.untab();
  }
  TreeBuilder result;
synchronized (servlet.stylesheetCache) {
    servlet.stylesheetCache.setDependencyReceiver(this);
    try {
      result=new TreeBuilder();
      trans.transform(paramDoc,result);
    }
  finally {
      servlet.stylesheetCache.setDependencyReceiver(null);
    }
  }
  if (Trace.getOutputLevel() >= Trace.debug) {
    Trace.debug("String_Node_Str");
    Trace.tab();
    Trace.debug(XMLWriter.toString(result.getCurrentRoot()));
    Trace.untab();
  }
  addDependency(new CacheDependency(servlet.stylesheetCache,config.docLookupSheet));
  EasyNode root=new EasyNode(result.getCurrentRoot());
  for (int i=0; i < root.nChildren(); i++) {
    EasyNode el=root.child(i);
    String tagName=el.name();
    if (tagName.equals("String_Node_Str"))     info.style=servlet.getRealPath(el.attrValue("String_Node_Str"));
 else     if (tagName.equals("String_Node_Str"))     info.source=servlet.getRealPath(el.attrValue("String_Node_Str"));
 else     if (tagName.equals("String_Node_Str")) {
      info.indexConfig=servlet.getRealPath(el.attrValue("String_Node_Str"));
      info.indexName=el.attrValue("String_Node_Str");
    }
 else     if (tagName.equals("String_Node_Str"))     info.brand=servlet.getRealPath(el.attrValue("String_Node_Str"));
 else     if (tagName.equals("String_Node_Str"))     info.authSpecs.add(servlet.authenticator.processAuthTag(el));
 else     if (tagName.equals("String_Node_Str")) {
      info.query=new QueryRequestParser().parseRequest(el.getWrappedNode(),new File(servlet.getRealPath("String_Node_Str")));
    }
 else     if (tagName.equalsIgnoreCase("String_Node_Str"))     info.preFilter=servlet.getRealPath(el.attrValue("String_Node_Str"));
 else     if (tagName.equalsIgnoreCase("String_Node_Str")) {
      String val=el.attrValue("String_Node_Str");
      if (val.matches("String_Node_Str"))       info.removeDoctypeDecl=true;
 else       if (val.matches("String_Node_Str"))       info.removeDoctypeDecl=false;
 else       throw new DynaXMLException("String_Node_Str" + "String_Node_Str" + tagName + "String_Node_Str"+ val+ "String_Node_Str");
    }
 else     throw new DynaXMLException("String_Node_Str" + tagName + "String_Node_Str");
  }
  if (TextServlet.isEmpty(info.source))   throw new InvalidDocumentException();
  TextServlet.requireOrElse(info.style,"String_Node_Str");
  if (TextServlet.isEmpty(info.indexConfig) && !TextServlet.isEmpty(info.indexName))   throw new GeneralException("String_Node_Str");
  if (!TextServlet.isEmpty(info.indexConfig) && TextServlet.isEmpty(info.indexName))   throw new GeneralException("String_Node_Str");
  return info;
}