Program: 139410
Project: 139410
Buggy source:
/** 
 * DOC mzhao Comment method "recursiveExpandTree".
 * @param commonViewer
 * @param provider
 * @param item
 */
private void recursiveExpandTree(Object item){
  if (provider == null) {
    provider=(ITreeContentProvider)getCommonViewer().getContentProvider();
  }
  if (item instanceof EObject) {
    Object parent=provider.getParent(item);
    Object[] tbFolderNodes=provider.getChildren(parent);
    boolean isFind=false;
    IFolderNode fn=null;
    for (    Object folderNode : tbFolderNodes) {
      fn=(IFolderNode)folderNode;
      Object[] folderChilds=provider.getChildren(fn);
      for (      Object child : folderChilds) {
        if (child == item) {
          isFind=true;
          break;
        }
      }
      if (isFind) {
        break;
      }
    }
    if (fn != null) {
      recursiveExpandTree(fn);
      getCommonViewer().expandToLevel(fn,1);
    }
 else {
      Object emfParent=provider.getParent(item);
      if (emfParent instanceof Resource) {
        Resource cwmResource=(Resource)emfParent;
        IFile resourceFile=null;
        URI uri=cwmResource.getURI();
        uri=cwmResource.getResourceSet().getURIConverter().normalize(uri);
        String scheme=uri.scheme();
        if ("String_Node_Str".equals(scheme) && uri.segmentCount() > 1 && "String_Node_Str".equals(uri.segment(0))) {
          StringBuffer platformResourcePath=new StringBuffer();
          for (int j=1, size=uri.segmentCount(); j < size; ++j) {
            platformResourcePath.append('/');
            platformResourcePath.append(uri.segment(j));
          }
          resourceFile=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformResourcePath.toString()));
        }
        emfParent=resourceFile;
      }
      recursiveExpandTree(emfParent);
      getCommonViewer().expandToLevel(emfParent,1);
    }
  }
 else   if (item instanceof IFolderNode) {
    IFolderNode folderNode=(IFolderNode)item;
    Object eo=folderNode.getParent();
    recursiveExpandTree(eo);
    getCommonViewer().expandToLevel(eo,1);
  }
 else {
    Object workspaceParent=provider.getParent(item);
    if (workspaceParent == null) {
      return;
    }
    getCommonViewer().expandToLevel(workspaceParent,1);
    recursiveExpandTree(workspaceParent);
  }
}

Fixed version (ground truth):
/** 
 * DOC mzhao Comment method "recursiveExpandTree".
 * @param commonViewer
 * @param provider
 * @param item
 */
private void recursiveExpandTree(Object item){
  if (contentProvider == null) {
    contentProvider=(ITreeContentProvider)getCommonViewer().getContentProvider();
  }
  if (item instanceof EObject) {
    Object parent=contentProvider.getParent(item);
    Object[] tbFolderNodes=contentProvider.getChildren(parent);
    boolean isFind=false;
    IFolderNode fn=null;
    for (    Object folderNode : tbFolderNodes) {
      fn=(IFolderNode)folderNode;
      Object[] folderChilds=contentProvider.getChildren(fn);
      for (      Object child : folderChilds) {
        if (child == item) {
          isFind=true;
          break;
        }
      }
      if (isFind) {
        break;
      }
    }
    if (fn != null) {
      recursiveExpandTree(fn);
      getCommonViewer().expandToLevel(fn,1);
    }
 else {
      Object emfParent=contentProvider.getParent(item);
      if (emfParent instanceof Resource) {
        Resource cwmResource=(Resource)emfParent;
        IFile resourceFile=null;
        URI uri=cwmResource.getURI();
        uri=cwmResource.getResourceSet().getURIConverter().normalize(uri);
        String scheme=uri.scheme();
        if ("String_Node_Str".equals(scheme) && uri.segmentCount() > 1 && "String_Node_Str".equals(uri.segment(0))) {
          StringBuffer platformResourcePath=new StringBuffer();
          for (int j=1, size=uri.segmentCount(); j < size; ++j) {
            platformResourcePath.append('/');
            platformResourcePath.append(uri.segment(j));
          }
          resourceFile=ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformResourcePath.toString()));
        }
        emfParent=resourceFile;
      }
      recursiveExpandTree(emfParent);
      getCommonViewer().expandToLevel(emfParent,1);
    }
  }
 else   if (item instanceof IFolderNode) {
    IFolderNode folderNode=(IFolderNode)item;
    Object eo=folderNode.getParent();
    recursiveExpandTree(eo);
    getCommonViewer().expandToLevel(eo,1);
  }
 else {
    Object workspaceParent=contentProvider.getParent(item);
    if (workspaceParent == null) {
      return;
    }
    getCommonViewer().expandToLevel(workspaceParent,1);
    recursiveExpandTree(workspaceParent);
  }
}