Program: 126509
Project: 126509
Buggy source:
/** 
 * The repository view selection.
 * @return the selection
 */
public ISelection getSelection(){
  if (specialSelectionProvider != null) {
    return specialSelectionProvider.getSelection();
  }
  IWorkbenchPart activePart=getActivePage().getActivePart();
  if (activePart instanceof PropertySheet) {
    return getActivePage().getSelection();
  }
  if (activePart instanceof IJobSettingsView) {
    ISelection selection=((IJobSettingsView)activePart).getSelection();
    if (selection == null) {
      selection=getRepositorySelection();
    }
    return selection;
  }
  if (activePart instanceof IRepositoryView) {
    workbenchPart=activePart;
    ISelection selection=((IRepositoryView)activePart).getViewer().getSelection();
    if (!selection.isEmpty()) {
      return ((IRepositoryView)activePart).getViewer().getSelection();
    }
 else {
      selection=new StructuredSelection(node);
      return selection;
    }
  }
  if (workbenchPart != null) {
    if (workbenchPart instanceof IRepositoryView) {
      IRepositoryView view=(IRepositoryView)workbenchPart;
      return view.getViewer().getSelection();
    }
  }
  if (getActivePage().getActiveEditor() == null) {
    workbenchPart=activePart;
    if (workbenchPart instanceof IRepositoryView) {
      IRepositoryView view=(IRepositoryView)workbenchPart;
      return view.getViewer().getSelection();
    }
    return null;
  }
  IWorkbenchPartSite site=getActivePage().getActiveEditor().getSite();
  ISelectionProvider selectionProvider=site.getSelectionProvider();
  return selectionProvider == null ? null : selectionProvider.getSelection();
}

Fixed version (ground truth):
/** 
 * The repository view selection.
 * @return the selection
 */
public ISelection getSelection(){
  if (specialSelectionProvider != null) {
    return specialSelectionProvider.getSelection();
  }
  IWorkbenchPart activePart=getActivePage().getActivePart();
  if (activePart instanceof PropertySheet) {
    return getActivePage().getSelection();
  }
  if (activePart instanceof IJobSettingsView) {
    ISelection selection=((IJobSettingsView)activePart).getSelection();
    if (selection == null) {
      selection=getRepositorySelection();
    }
    return selection;
  }
  if (activePart instanceof IRepositoryView) {
    workbenchPart=activePart;
    ISelection selection=((IRepositoryView)activePart).getViewer().getSelection();
    if (!selection.isEmpty()) {
      return ((IRepositoryView)activePart).getViewer().getSelection();
    }
 else {
      if (node != null) {
        selection=new StructuredSelection(node);
      }
      return selection;
    }
  }
  if (workbenchPart != null) {
    if (workbenchPart instanceof IRepositoryView) {
      IRepositoryView view=(IRepositoryView)workbenchPart;
      return view.getViewer().getSelection();
    }
  }
  if (getActivePage().getActiveEditor() == null) {
    workbenchPart=activePart;
    if (workbenchPart instanceof IRepositoryView) {
      IRepositoryView view=(IRepositoryView)workbenchPart;
      return view.getViewer().getSelection();
    }
    return null;
  }
  IWorkbenchPartSite site=getActivePage().getActiveEditor().getSite();
  ISelectionProvider selectionProvider=site.getSelectionProvider();
  return selectionProvider == null ? null : selectionProvider.getSelection();
}