Program: 92895
Project: 92895
Buggy source:
public void selectExperiment(TmfExperimentNode experiment){
  String expId=experiment.getName();
  try {
    TmfTraceNode[] traceEntries=experiment.getTraces();
    int nbTraces=traceEntries.length;
    List<ITmfTrace> traces=new ArrayList<ITmfTrace>();
    int cacheSize=Integer.MAX_VALUE;
    for (int i=0; i < nbTraces; i++) {
      IResource resource=traceEntries[i].getResource();
      resource=experiment.getProject().getTracesFolder().getTraceForLocation(resource.getLocation()).getResource();
      ITmfTrace expTrace=ParserProviderManager.getTrace(resource);
      if (expTrace != null) {
        traces.add(expTrace);
        cacheSize=Math.min(cacheSize,expTrace.getCacheSize());
        try {
          ITmfTrace trace=ParserProviderManager.getTrace(resource);
          IEditorInput editorInput=new TmfEditorInput(resource,trace);
          IWorkbench wb=PlatformUI.getWorkbench();
          IWorkbenchPage activePage=wb.getActiveWorkbenchWindow().getActivePage();
          String editorId=ParserProviderManager.getEditorId(resource);
          IEditorPart editor=activePage.findEditor(editorInput);
          if (editor != null && editor instanceof IReusableEditor) {
            activePage.reuseEditor((IReusableEditor)editor,editorInput);
            activePage.activate(editor);
          }
 else {
            editor=activePage.openEditor(editorInput,editorId);
          }
        }
 catch (        PartInitException e) {
          e.printStackTrace();
        }
      }
    }
    TmfExperiment<TmfEvent> selectedExperiment=new TmfExperiment<TmfEvent>(TmfEvent.class,expId,traces.toArray(new ITmfTrace[0]),cacheSize);
    broadcast(new TmfExperimentSelectedSignal<TmfEvent>(this,selectedExperiment));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void selectExperiment(TmfExperimentNode experiment){
  String expId=experiment.getName();
  try {
    TmfTraceNode[] traceEntries=experiment.getTraces();
    int nbTraces=traceEntries.length;
    List<ITmfTrace> traces=new ArrayList<ITmfTrace>();
    int cacheSize=Integer.MAX_VALUE;
    for (int i=0; i < nbTraces; i++) {
      IResource resource=traceEntries[i].getResource();
      resource=experiment.getProject().getTracesFolder().getTraceForLocation(resource.getLocation()).getResource();
      ITmfTrace expTrace=ParserProviderManager.getTrace(resource);
      if (expTrace != null) {
        traces.add(expTrace);
        cacheSize=Math.min(cacheSize,expTrace.getCacheSize());
        try {
          ITmfTrace trace=ParserProviderManager.getTrace(resource);
          IEditorInput editorInput=new TmfEditorInput(resource,trace);
          IWorkbench wb=PlatformUI.getWorkbench();
          IWorkbenchPage activePage=wb.getActiveWorkbenchWindow().getActivePage();
          String editorId=ParserProviderManager.getEditorId(resource);
          if (resource instanceof IFile) {
            IDE.setDefaultEditor((IFile)resource,editorId);
          }
          IEditorPart editor=activePage.findEditor(editorInput);
          if (editor != null && editor instanceof IReusableEditor) {
            activePage.reuseEditor((IReusableEditor)editor,editorInput);
            activePage.activate(editor);
          }
 else {
            editor=activePage.openEditor(editorInput,editorId);
          }
        }
 catch (        PartInitException e) {
          e.printStackTrace();
        }
      }
    }
    TmfExperiment<TmfEvent> selectedExperiment=new TmfExperiment<TmfEvent>(TmfEvent.class,expId,traces.toArray(new ITmfTrace[0]),cacheSize);
    broadcast(new TmfExperimentSelectedSignal<TmfEvent>(this,selectedExperiment));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}