Program: 133521
Project: 133521
Buggy source:
/** 
 * This listens for selection change events in the fileTreeViewer and updates   {@link #deleteFileAction} depending on whether or not a file isselected. Also, this method shows an appropriate plot viewer based on the file type of the selection.
 * @param event The SelectionChangedEvent that fired this method.
 */
@Override public void selectionChanged(SelectionChangedEvent event){
  ISelection selection=event.getSelection();
  if (selection instanceof IStructuredSelection) {
    deleteFileAction.setEnabled(!selection.isEmpty());
    IStructuredSelection structuredSelection=(IStructuredSelection)selection;
    if (!structuredSelection.isEmpty()) {
      Object object=structuredSelection.getFirstElement();
      if (object instanceof VizResource) {
        VizResource vizResource=(VizResource)object;
        String fileName="String_Node_Str";
        if (vizResource.getFileSet() != null && vizResource.getFileSetTitle() != null) {
          fileName=vizResource.getFileSetTitle();
        }
 else {
          fileName=vizResource.getContents().getAbsolutePath();
        }
        IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        File file=vizResource.getContents();
        fileName=file.getAbsolutePath();
        if (fileName.matches("String_Node_Str")) {
          try {
            CSVPlot plot=new CSVPlot();
            plot.setDataSource(file.toURI());
            page.openEditor(new PlotEditorInput(plot),PlotEditor.ID);
          }
 catch (          PartInitException e) {
            logger.error("String_Node_Str" + file.getAbsolutePath(),e);
          }
        }
 else {
          try {
            getSite().getWorkbenchWindow().getActivePage().showView(VisitPlotViewer.ID);
            IViewReference[] refs=getSite().getWorkbenchWindow().getActivePage().getViewReferences();
            for (            IViewReference ref : refs) {
              if ("String_Node_Str".equals(ref.getPartName())) {
                VisitPlotViewer view=(VisitPlotViewer)ref.getView(false);
                view.setResource(vizResource);
              }
            }
          }
 catch (          PartInitException e) {
            logger.error(getClass().getName() + "String_Node_Str",e);
          }
        }
      }
    }
  }
  return;
}

Fixed version (ground truth):
/** 
 * This listens for selection change events in the fileTreeViewer and updates   {@link #deleteFileAction} depending on whether or not a file isselected. Also, this method shows an appropriate plot viewer based on the file type of the selection.
 * @param event The SelectionChangedEvent that fired this method.
 */
@Override public void selectionChanged(SelectionChangedEvent event){
  ISelection selection=event.getSelection();
  if (selection instanceof IStructuredSelection) {
    deleteFileAction.setEnabled(!selection.isEmpty());
    IStructuredSelection structuredSelection=(IStructuredSelection)selection;
    if (!structuredSelection.isEmpty()) {
      Object object=structuredSelection.getFirstElement();
      if (object instanceof VizResource) {
        VizResource vizResource=(VizResource)object;
        String fileName="String_Node_Str";
        if (vizResource.getFileSet() != null && vizResource.getFileSetTitle() != null) {
          fileName=vizResource.getFileSetTitle();
        }
 else {
          fileName=vizResource.getContents().getAbsolutePath();
        }
        IWorkbenchPage page=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        File file=vizResource.getContents();
        fileName=file.getAbsolutePath();
        if (fileName.matches("String_Node_Str")) {
          try {
            CSVPlot dataPlot=new CSVPlot();
            dataPlot.setDataSource(file.toURI());
            CSVProxyPlot plot=new CSVProxyPlot();
            plot.setSource(dataPlot);
            page.openEditor(new PlotEditorInput(plot),PlotEditor.ID);
          }
 catch (          Exception e) {
            logger.error("String_Node_Str" + file.getAbsolutePath(),e);
          }
        }
 else {
          try {
            getSite().getWorkbenchWindow().getActivePage().showView(VisitPlotViewer.ID);
            IViewReference[] refs=getSite().getWorkbenchWindow().getActivePage().getViewReferences();
            for (            IViewReference ref : refs) {
              if ("String_Node_Str".equals(ref.getPartName())) {
                VisitPlotViewer view=(VisitPlotViewer)ref.getView(false);
                view.setResource(vizResource);
              }
            }
          }
 catch (          PartInitException e) {
            logger.error(getClass().getName() + "String_Node_Str",e);
          }
        }
      }
    }
  }
  return;
}