Program: 58229
Project: 58229
Buggy source:
/** 
 * Imports a tree with the aid of   {@link JAXBContext}.
 * @param fileName Full file name of the serialized tree
 * @return the imported tree
 * @throws JAXBException in case of a XML-serialization error
 */
public Tree<ClusterNode> importTree(String fileName) throws JAXBException, FileNotFoundException {
  Tree<ClusterNode> tree=new Tree<ClusterNode>();
  tree.setLeaveIDType(IDType.getIDType(leaveIDTypeString));
  ClusterNode rootNode=null;
  DirectedGraph<ClusterNode,DefaultEdge> graph=new DefaultDirectedGraph<ClusterNode,DefaultEdge>(DefaultEdge.class);
  JAXBContext jaxbContext=null;
  TreePorter treePorter=null;
  Unmarshaller unmarshaller;
  jaxbContext=JAXBContext.newInstance(TreePorter.class);
  unmarshaller=jaxbContext.createUnmarshaller();
  treePorter=(TreePorter)unmarshaller.unmarshal(GeneralManager.get().getResourceLoader().getResource(fileName));
  int size=(int)(treePorter.nodeSet.size() * 1.5);
  HashMap<Integer,ClusterNode> hashClusterNr=new HashMap<Integer,ClusterNode>(size);
  HashMap<String,ClusterNode> hashClusterNodes=new HashMap<String,ClusterNode>(size);
  HashMap<Integer,ArrayList<Integer>> hashLeafIDToNodeIDs=new HashMap<Integer,ArrayList<Integer>>(size);
  for (  ClusterNode node : treePorter.nodeSet) {
    graph.addVertex(node);
    hashClusterNodes.put(node.toString(),node);
    hashClusterNr.put(node.getID(),node);
    if (node.isRootNode())     rootNode=node;
    node.setTree(tree);
    node.setNode(node);
    if (node.getLeafID() >= 0) {
      if (hashLeafIDToNodeIDs.containsKey(node.getLeafID())) {
        ArrayList<Integer> alNodeIDs=hashLeafIDToNodeIDs.get(node.getLeafID());
        alNodeIDs.add(node.getID());
      }
 else {
        ArrayList<Integer> alNodeIDs=new ArrayList<Integer>();
        alNodeIDs.add(node.getID());
        hashLeafIDToNodeIDs.put(node.getLeafID(),alNodeIDs);
      }
    }
  }
  for (  String[] edge : treePorter.edges) {
    graph.addEdge(hashClusterNodes.get(edge[0]),hashClusterNodes.get(edge[1]));
  }
  tree.setHashMap(hashClusterNr);
  tree.setRootNode(rootNode);
  tree.setGraph(graph);
  tree.hashLeafIDToNodeIDs=hashLeafIDToNodeIDs;
  return tree;
}

Fixed version (ground truth):
/** 
 * Imports a tree with the aid of   {@link JAXBContext}.
 * @param fileName Full file name of the serialized tree
 * @return the imported tree
 * @throws JAXBException in case of a XML-serialization error
 */
public Tree<ClusterNode> importTree(String fileName) throws JAXBException, FileNotFoundException {
  Tree<ClusterNode> tree=new Tree<ClusterNode>();
  tree.initializeIDTypes(IDType.getIDType(leaveIDTypeString));
  ClusterNode rootNode=null;
  DirectedGraph<ClusterNode,DefaultEdge> graph=new DefaultDirectedGraph<ClusterNode,DefaultEdge>(DefaultEdge.class);
  JAXBContext jaxbContext=null;
  TreePorter treePorter=null;
  Unmarshaller unmarshaller;
  jaxbContext=JAXBContext.newInstance(TreePorter.class);
  unmarshaller=jaxbContext.createUnmarshaller();
  treePorter=(TreePorter)unmarshaller.unmarshal(GeneralManager.get().getResourceLoader().getResource(fileName));
  int size=(int)(treePorter.nodeSet.size() * 1.5);
  HashMap<Integer,ClusterNode> hashClusterNr=new HashMap<Integer,ClusterNode>(size);
  HashMap<String,ClusterNode> hashClusterNodes=new HashMap<String,ClusterNode>(size);
  HashMap<Integer,ArrayList<Integer>> hashLeafIDToNodeIDs=new HashMap<Integer,ArrayList<Integer>>(size);
  for (  ClusterNode node : treePorter.nodeSet) {
    graph.addVertex(node);
    hashClusterNodes.put(node.toString(),node);
    hashClusterNr.put(node.getID(),node);
    if (node.isRootNode())     rootNode=node;
    node.setTree(tree);
    node.setNode(node);
    if (node.getLeafID() >= 0) {
      if (hashLeafIDToNodeIDs.containsKey(node.getLeafID())) {
        ArrayList<Integer> alNodeIDs=hashLeafIDToNodeIDs.get(node.getLeafID());
        alNodeIDs.add(node.getID());
      }
 else {
        ArrayList<Integer> alNodeIDs=new ArrayList<Integer>();
        alNodeIDs.add(node.getID());
        hashLeafIDToNodeIDs.put(node.getLeafID(),alNodeIDs);
      }
    }
  }
  for (  String[] edge : treePorter.edges) {
    graph.addEdge(hashClusterNodes.get(edge[0]),hashClusterNodes.get(edge[1]));
  }
  tree.setHashMap(hashClusterNr);
  tree.setRootNode(rootNode);
  tree.setGraph(graph);
  tree.hashLeafIDToNodeIDs=hashLeafIDToNodeIDs;
  return tree;
}