Program: 148673
Project: 148673
Buggy source:
private void parseFunxml() throws Exception {
  DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
  DocumentBuilder builder=factory.newDocumentBuilder();
  org.w3c.dom.Document document;
  InputStream in=SchematronExpressBuilder.class.getResourceAsStream("String_Node_Str");
  document=builder.parse(in);
  NodeList list=document.getElementsByTagName("String_Node_Str");
  categories=new ArrayList<XPathFunc>();
  for (int i=0; i < list.getLength(); i++) {
    XPathFunc xpathFunc=new XPathFunc();
    Node node=list.item(i);
    NamedNodeMap map=node.getAttributes();
    Node nameNode=map.getNamedItem("String_Node_Str");
    xpathFunc.setCategory(nameNode.getTextContent());
    java.util.List<KeyValue> keylist=new ArrayList<KeyValue>();
    for (int j=0; j < node.getChildNodes().getLength(); j++) {
      Node n=node.getChildNodes().item(j);
      NamedNodeMap fmap=n.getAttributes();
      if (fmap != null && fmap.getLength() > 0) {
        Node n1=fmap.getNamedItem("String_Node_Str");
        Node n2=fmap.getNamedItem("String_Node_Str");
        String help=n2.getTextContent();
        help=help.replaceAll("String_Node_Str","String_Node_Str");
        KeyValue kv=new KeyValue(n1.getTextContent(),help);
        keylist.add(kv);
      }
    }
    Collections.sort(keylist,new Comparator<KeyValue>(){
      public int compare(      KeyValue o1,      KeyValue o2){
        if (o1 != null && o2 != null) {
          return o1.key.compareTo(o2.key);
        }
        return 0;
      }
    }
);
    xpathFunc.setFuncs(keylist);
    categories.add(xpathFunc);
  }
}

Fixed version (ground truth):
private void parseFunxml() throws Exception {
  InputStream in=null;
  try {
    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
    DocumentBuilder builder=factory.newDocumentBuilder();
    org.w3c.dom.Document document;
    in=SchematronExpressBuilder.class.getResourceAsStream("String_Node_Str");
    document=builder.parse(in);
    NodeList list=document.getElementsByTagName("String_Node_Str");
    categories=new ArrayList<XPathFunc>();
    for (int i=0; i < list.getLength(); i++) {
      XPathFunc xpathFunc=new XPathFunc();
      Node node=list.item(i);
      NamedNodeMap map=node.getAttributes();
      Node nameNode=map.getNamedItem("String_Node_Str");
      xpathFunc.setCategory(nameNode.getTextContent());
      java.util.List<KeyValue> keylist=new ArrayList<KeyValue>();
      for (int j=0; j < node.getChildNodes().getLength(); j++) {
        Node n=node.getChildNodes().item(j);
        NamedNodeMap fmap=n.getAttributes();
        if (fmap != null && fmap.getLength() > 0) {
          Node n1=fmap.getNamedItem("String_Node_Str");
          Node n2=fmap.getNamedItem("String_Node_Str");
          String help=n2.getTextContent();
          help=help.replaceAll("String_Node_Str","String_Node_Str");
          KeyValue kv=new KeyValue(n1.getTextContent(),help);
          keylist.add(kv);
        }
      }
      Collections.sort(keylist,new Comparator<KeyValue>(){
        public int compare(        KeyValue o1,        KeyValue o2){
          if (o1 != null && o2 != null) {
            return o1.key.compareTo(o2.key);
          }
          return 0;
        }
      }
);
      xpathFunc.setFuncs(keylist);
      categories.add(xpathFunc);
    }
  }
  finally {
    if (in != null)     in.close();
  }
}