Program: 20599
Project: 20599
Buggy source:
/** 
 * @see IActionDelegate#run(IAction)
 */
public void run(IAction action){
  ResourceVisitor visitor=new ResourceVisitor();
  if (selectionObject instanceof IType) {
    IType t=(IType)selectionObject;
    visitor.visit(new JDTType(t));
    saveResult(visitor,t);
    return;
  }
  if (selectionObject instanceof ICompilationUnit) {
    ICompilationUnit unit=(ICompilationUnit)selectionObject;
    IType[] allTypes;
    try {
      allTypes=unit.getAllTypes();
      for (      IType t : allTypes) {
        visitor.visit(new JDTType(t));
      }
    }
 catch (    JavaModelException e) {
      MessageDialog.openError(shell,"String_Node_Str",e.getMessage());
    }
    saveResult(visitor,unit);
  }
  IResource q=(IResource)selectionObject;
  IProject project=q.getProject();
  IJavaProject create=JavaCore.create(project);
  if (create.exists()) {
    try {
      IPackageFragmentRoot[] packageFragmentRoots=create.getPackageFragmentRoots();
      for (      IPackageFragmentRoot qq : packageFragmentRoots) {
        if (qq.getKind() == IPackageFragmentRoot.K_SOURCE) {
          IJavaElement[] children=qq.getChildren();
          for (          IJavaElement z : children) {
            if (z instanceof IPackageFragment) {
              IPackageFragment pp=(IPackageFragment)z;
              ICompilationUnit[] compilationUnits=pp.getCompilationUnits();
              for (              ICompilationUnit unit : compilationUnits) {
                IType[] allTypes=unit.getAllTypes();
                for (                IType t : allTypes) {
                  visitor.visit(new JDTType(t));
                }
              }
            }
          }
        }
      }
      String raml=visitor.getRaml();
      String name="String_Node_Str";
      IFile file=project.getFile(name);
      save(raml,file);
    }
 catch (    Exception e) {
      MessageDialog.openError(shell,"String_Node_Str",e.getMessage());
    }
  }
}

Fixed version (ground truth):
/** 
 * @see IActionDelegate#run(IAction)
 */
public void run(IAction action){
  ResourceVisitor visitor=new RuntimeResourceVisitorFactory().createResourceVisitor();
  if (selectionObject instanceof IType) {
    IType t=(IType)selectionObject;
    visitor.visit(new JDTType(t));
    saveResult(visitor,t);
    return;
  }
  if (selectionObject instanceof ICompilationUnit) {
    ICompilationUnit unit=(ICompilationUnit)selectionObject;
    IType[] allTypes;
    try {
      allTypes=unit.getAllTypes();
      for (      IType t : allTypes) {
        visitor.visit(new JDTType(t));
      }
    }
 catch (    JavaModelException e) {
      MessageDialog.openError(shell,"String_Node_Str",e.getMessage());
    }
    saveResult(visitor,unit);
  }
  IResource q=(IResource)selectionObject;
  IProject project=q.getProject();
  IJavaProject create=JavaCore.create(project);
  if (create.exists()) {
    try {
      IPackageFragmentRoot[] packageFragmentRoots=create.getPackageFragmentRoots();
      for (      IPackageFragmentRoot qq : packageFragmentRoots) {
        if (qq.getKind() == IPackageFragmentRoot.K_SOURCE) {
          IJavaElement[] children=qq.getChildren();
          for (          IJavaElement z : children) {
            if (z instanceof IPackageFragment) {
              IPackageFragment pp=(IPackageFragment)z;
              ICompilationUnit[] compilationUnits=pp.getCompilationUnits();
              for (              ICompilationUnit unit : compilationUnits) {
                IType[] allTypes=unit.getAllTypes();
                for (                IType t : allTypes) {
                  visitor.visit(new JDTType(t));
                }
              }
            }
          }
        }
      }
      String raml=visitor.getRaml();
      String name="String_Node_Str";
      IFile file=project.getFile(name);
      save(raml,file);
    }
 catch (    Exception e) {
      MessageDialog.openError(shell,"String_Node_Str",e.getMessage());
    }
  }
}