Program: 168508
Project: 168508
Buggy source:
/** 
 * Returns the requested node in the catalog file. If the requested node is not a header, index or leaf node, <code>null</code> is returned because they are the only ones that are implemented at the moment. Otherwise the returned BTNode object will be of subtype HFSPlusCatalogIndexNode or HFSPlusCatalogLeafNode.<br> Calling this method with a negative <code>nodeNumber</code> argument returns the root node.
 * @param nodeNumber the node number inside the catalog file, or a negative value if we want the root
 * @return the requested node if it exists and has type index node or leaf node, null otherwise
 */
public CommonBTNode getCatalogNode(long nodeNumber){
  CatalogInitProcedure init=new CatalogInitProcedure();
  long currentNodeNumber;
  if (nodeNumber < 0)   currentNodeNumber=init.bthr.getRootNodeNumber();
 else   currentNodeNumber=nodeNumber;
  final int nodeSize=init.bthr.getNodeSize();
  byte[] currentNodeData=new byte[nodeSize];
  try {
    init.catalogFile.seek(currentNodeNumber * nodeSize);
    init.catalogFile.readFully(currentNodeData);
  }
 catch (  RuntimeException e) {
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str" + nodeNumber);
    System.err.println("String_Node_Str" + currentNodeNumber);
    System.err.println("String_Node_Str" + nodeSize);
    System.err.println("String_Node_Str" + init.catalogFile.length());
    System.err.println("String_Node_Str" + (currentNodeNumber * nodeSize));
    throw e;
  }
  CommonBTNodeDescriptor nodeDescriptor=createCommonBTNodeDescriptor(currentNodeData,0);
  if (nodeDescriptor.getNodeType() == NodeType.HEADER)   return createCommonBTHeaderNode(currentNodeData,0,init.bthr.getNodeSize());
  if (nodeDescriptor.getNodeType() == NodeType.INDEX)   return catOps.newCatalogIndexNode(currentNodeData,0,init.bthr.getNodeSize(),init.bthr);
 else   if (nodeDescriptor.getNodeType() == NodeType.LEAF)   return catOps.newCatalogLeafNode(currentNodeData,0,init.bthr.getNodeSize(),init.bthr);
 else   return null;
}

Fixed version (ground truth):
/** 
 * Returns the requested node in the catalog file. If the requested node is not a header, index or leaf node, <code>null</code> is returned because they are the only ones that are implemented at the moment. Otherwise the returned BTNode object will be of subtype HFSPlusCatalogIndexNode or HFSPlusCatalogLeafNode.<br> Calling this method with a negative <code>nodeNumber</code> argument returns the root node.
 * @param nodeNumber the node number inside the catalog file, or a negative value if we want the root
 * @return the requested node if it exists and has type index node or leaf node, null otherwise
 */
public CommonBTNode getCatalogNode(long nodeNumber){
  CatalogInitProcedure init=new CatalogInitProcedure();
  long currentNodeNumber;
  if (nodeNumber < 0) {
    currentNodeNumber=init.bthr.getRootNodeNumber();
    if (currentNodeNumber == 0)     return null;
  }
 else   currentNodeNumber=nodeNumber;
  final int nodeSize=init.bthr.getNodeSize();
  byte[] currentNodeData=new byte[nodeSize];
  try {
    init.catalogFile.seek(currentNodeNumber * nodeSize);
    init.catalogFile.readFully(currentNodeData);
  }
 catch (  RuntimeException e) {
    System.err.println("String_Node_Str");
    System.err.println("String_Node_Str" + nodeNumber);
    System.err.println("String_Node_Str" + currentNodeNumber);
    System.err.println("String_Node_Str" + nodeSize);
    System.err.println("String_Node_Str" + init.catalogFile.length());
    System.err.println("String_Node_Str" + (currentNodeNumber * nodeSize));
    throw e;
  }
  CommonBTNodeDescriptor nodeDescriptor=createCommonBTNodeDescriptor(currentNodeData,0);
  if (nodeDescriptor.getNodeType() == NodeType.HEADER)   return createCommonBTHeaderNode(currentNodeData,0,init.bthr.getNodeSize());
  if (nodeDescriptor.getNodeType() == NodeType.INDEX)   return catOps.newCatalogIndexNode(currentNodeData,0,init.bthr.getNodeSize(),init.bthr);
 else   if (nodeDescriptor.getNodeType() == NodeType.LEAF)   return catOps.newCatalogLeafNode(currentNodeData,0,init.bthr.getNodeSize(),init.bthr);
 else   return null;
}