Program: 168523
Project: 168523
Buggy source:
/** 
 * Calculates the combined sizes of the forks of types <code>forkTypes</code> for the selection, including all files in subdirectories. If <code>forkTypes</code> is empty, all forks are included in the calculation.
 * @param selection
 * @param forkTypes
 * @return the total combined size of the data in the tree for the specified fork types.
 */
private long calculateForkSizeRecursive(FSEntry[] selection,LinkedList<String> pathStack,ProgressMonitor pm,FSForkType... forkTypes){
  long res=0;
  for (  FSEntry curEntry : selection) {
    if (pm.cancelSignaled()) {
      break;
    }
    if (curEntry instanceof FSLink) {
      FSLink curLink=(FSLink)curEntry;
      FSEntry linkTarget=curLink.getLinkTarget(pathStack.toArray(new String[pathStack.size()]));
      if (linkTarget != null) {
        System.err.println("String_Node_Str" + curLink.getLinkTargetString() + "String_Node_Str"+ linkTarget.getName()+ "String_Node_Str");
        curEntry=linkTarget;
      }
 else       System.err.println("String_Node_Str" + curLink.getLinkTargetString() + "String_Node_Str");
    }
    if (curEntry instanceof FSFile) {
      FSFile curFile=(FSFile)curEntry;
      if (forkTypes.length > 0) {
        for (        FSForkType t : forkTypes) {
          FSFork curFork=curFile.getForkByType(t);
          if (curFork != null) {
            res+=curFork.getLength();
          }
        }
      }
 else {
        res+=curFile.getCombinedLength();
      }
    }
 else     if (curEntry instanceof FSFolder) {
      FSFolder curFolder=(FSFolder)curEntry;
      pathStack.addLast(curFolder.getName());
      try {
        res+=calculateForkSizeRecursive(curFolder.list(),pathStack,pm,forkTypes);
      }
  finally {
        pathStack.removeLast();
      }
    }
 else {
      System.err.println("String_Node_Str" + curEntry.getClass());
    }
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Calculates the combined sizes of the forks of types <code>forkTypes</code> for the selection, including all files in subdirectories. If <code>forkTypes</code> is empty, all forks are included in the calculation.
 * @param selection
 * @param forkTypes
 * @return the total combined size of the data in the tree for the specified fork types.
 */
private long calculateForkSizeRecursive(FSEntry[] selection,LinkedList<String> pathStack,LinkedList<String[]> absPathsStack,ProgressMonitor pm,FSForkType... forkTypes){
  String[] pathStackArray=pathStack.toArray(new String[pathStack.size()]);
  String pathStackString=Util.concatenateStrings(pathStack,"String_Node_Str");
  long res=0;
  for (  FSEntry curEntry : selection) {
    if (pm.cancelSignaled()) {
      break;
    }
    System.err.print("String_Node_Str");
    System.err.print(pathStackString);
    System.err.print("String_Node_Str");
    System.err.print(curEntry.getName());
    System.err.println("String_Node_Str");
    String[] absolutePath=null;
    if (curEntry instanceof FSLink) {
      FSLink curLink=(FSLink)curEntry;
      System.err.print("String_Node_Str" + curLink.getName() + "String_Node_Str");
      String[] targetPath=fsHandler.getTargetPath(curLink,pathStackArray);
      if (targetPath != null) {
        if (Util.contains(absPathsStack,targetPath)) {
          System.err.println();
          System.err.println("String_Node_Str");
          System.err.println();
          continue;
        }
        FSEntry linkTarget=fsHandler.getEntry(targetPath);
        if (linkTarget != null) {
          System.err.println("String_Node_Str" + curLink.getLinkTargetString() + "String_Node_Str"+ linkTarget.getName()+ "String_Node_Str");
          curEntry=linkTarget;
          absolutePath=targetPath;
        }
 else         System.err.println("String_Node_Str" + curLink.getLinkTargetString() + "String_Node_Str");
      }
 else       System.err.println("String_Node_Str" + curLink.getLinkTargetString() + "String_Node_Str");
    }
    if (curEntry instanceof FSFile) {
      FSFile curFile=(FSFile)curEntry;
      if (forkTypes.length > 0) {
        for (        FSForkType t : forkTypes) {
          FSFork curFork=curFile.getForkByType(t);
          if (curFork != null) {
            res+=curFork.getLength();
          }
        }
      }
 else {
        res+=curFile.getCombinedLength();
      }
    }
 else     if (curEntry instanceof FSFolder) {
      FSFolder curFolder=(FSFolder)curEntry;
      pathStack.addLast(curFolder.getName());
      if (absolutePath != null)       absPathsStack.addLast(absolutePath);
      try {
        res+=calculateForkSizeRecursive(curFolder.listEntries(),pathStack,absPathsStack,pm,forkTypes);
      }
  finally {
        pathStack.removeLast();
        if (absolutePath != null)         absPathsStack.removeLast();
      }
    }
 else {
      System.err.println("String_Node_Str" + curEntry.getClass());
    }
  }
  return res;
}