Program: 91861
Project: 91861
Buggy source:
@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (window == null) {
    return false;
  }
  fLock.lock();
  try {
    final CommandParameter param=fParam.clone();
    IProject project=TmfProjectRegistry.createProject(DEFAULT_REMOTE_PROJECT_NAME,null,null);
    if (param.getSession().isLiveTrace()) {
      importLiveTrace(new LttngRelaydConnectionInfo(param.getSession().getLiveUrl(),param.getSession().getLivePort(),param.getSession().getName()),project);
      return null;
    }
 else     if (param.getSession().isStreamedTrace()) {
      IPreferenceStore store=Activator.getDefault().getPreferenceStore();
      String notify=store.getString(NOTIFY_IMPORT_STREAMED_PREF_KEY);
      if (!MessageDialogWithToggle.ALWAYS.equals(notify)) {
        MessageDialogWithToggle.openInformation(window.getShell(),null,Messages.TraceControl_ImportDialogStreamedTraceNotification,Messages.TraceControl_ImportDialogStreamedTraceNotificationToggle,false,store,NOTIFY_IMPORT_STREAMED_PREF_KEY);
      }
      TmfProjectElement projectElement=TmfProjectRegistry.getProject(project,true);
      TmfTraceFolder traceFolder=projectElement.getTracesFolder();
      ImportTraceWizard wizard=new ImportTraceWizard();
      wizard.init(PlatformUI.getWorkbench(),new StructuredSelection(traceFolder));
      WizardDialog dialog=new WizardDialog(window.getShell(),wizard);
      dialog.open();
      return null;
    }
    final IImportDialog dialog=TraceControlDialogFactory.getInstance().getImportDialog();
    dialog.setSession(param.getSession());
    dialog.setDefaultProject(DEFAULT_REMOTE_PROJECT_NAME);
    if (dialog.open() != Window.OK) {
      return null;
    }
    Job job=new Job(Messages.TraceControl_ImportJob){
      @Override protected IStatus run(      IProgressMonitor monitor){
        MultiStatus status=new MultiStatus(Activator.PLUGIN_ID,IStatus.OK,Messages.TraceControl_ImportFailure,null);
        List<ImportFileInfo> traces=dialog.getTracePathes();
        IProject selectedProject=dialog.getProject();
        for (Iterator<ImportFileInfo> iterator=traces.iterator(); iterator.hasNext(); ) {
          try {
            if (monitor.isCanceled()) {
              status.add(Status.CANCEL_STATUS);
              break;
            }
            ImportFileInfo remoteFile=iterator.next();
            downloadTrace(remoteFile,selectedProject,monitor);
            IFolder traceFolder=remoteFile.getDestinationFolder();
            IResource file=traceFolder.findMember(remoteFile.getLocalTraceName());
            if (file != null) {
              TraceTypeHelper helper=null;
              try {
                helper=TmfTraceTypeUIUtils.selectTraceType(file.getLocationURI().getPath(),null,null);
              }
 catch (              TmfTraceImportException e) {
              }
              if (helper != null) {
                status.add(TmfTraceTypeUIUtils.setTraceType(file,helper));
              }
              try {
                final String scheme="String_Node_Str";
                String host=remoteFile.getImportFile().getHost().getName();
                int port=remoteFile.getImportFile().getParentRemoteFileSubSystem().getConnectorService().getPort();
                String path=remoteFile.getImportFile().getAbsolutePath();
                if (file instanceof IFolder) {
                  path+=IPath.SEPARATOR;
                }
                URI uri=new URI(scheme,null,host,port,path,null,null);
                String sourceLocation=URIUtil.toUnencodedString(uri);
                file.setPersistentProperty(TmfCommonConstants.SOURCE_LOCATION,sourceLocation);
              }
 catch (              URISyntaxException e) {
              }
            }
          }
 catch (          ExecutionException e) {
            status.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,Messages.TraceControl_ImportFailure,e));
          }
catch (          CoreException e) {
            status.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,Messages.TraceControl_ImportFailure,e));
          }
        }
        return status;
      }
    }
;
    job.setUser(true);
    job.schedule();
  }
  finally {
    fLock.unlock();
  }
  return null;
}

Fixed version (ground truth):
@Override public Object execute(ExecutionEvent event) throws ExecutionException {
  IWorkbenchWindow window=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  if (window == null) {
    return false;
  }
  fLock.lock();
  try {
    final CommandParameter param=fParam.clone();
    IProject project=TmfProjectRegistry.createProject(DEFAULT_REMOTE_PROJECT_NAME,null,null);
    if (param.getSession().isLiveTrace()) {
      importLiveTrace(new LttngRelaydConnectionInfo(param.getSession().getLiveUrl(),param.getSession().getLivePort(),param.getSession().getName()),project);
      return null;
    }
 else     if (param.getSession().isStreamedTrace()) {
      IPreferenceStore store=Activator.getDefault().getPreferenceStore();
      String notify=store.getString(NOTIFY_IMPORT_STREAMED_PREF_KEY);
      if (!MessageDialogWithToggle.ALWAYS.equals(notify)) {
        MessageDialogWithToggle.openInformation(window.getShell(),null,Messages.TraceControl_ImportDialogStreamedTraceNotification,Messages.TraceControl_ImportDialogStreamedTraceNotificationToggle,false,store,NOTIFY_IMPORT_STREAMED_PREF_KEY);
      }
      TmfProjectElement projectElement=TmfProjectRegistry.getProject(project,true);
      TmfTraceFolder traceFolder=projectElement.getTracesFolder();
      ImportTraceWizard wizard=new ImportTraceWizard();
      wizard.init(PlatformUI.getWorkbench(),new StructuredSelection(traceFolder));
      WizardDialog dialog=new WizardDialog(window.getShell(),wizard);
      dialog.open();
      return null;
    }
    final IImportDialog dialog=TraceControlDialogFactory.getInstance().getImportDialog();
    dialog.setSession(param.getSession());
    dialog.setDefaultProject(DEFAULT_REMOTE_PROJECT_NAME);
    if (dialog.open() != Window.OK) {
      return null;
    }
    Job job=new Job(Messages.TraceControl_ImportJob){
      @Override protected IStatus run(      IProgressMonitor monitor){
        MultiStatus status=new MultiStatus(Activator.PLUGIN_ID,IStatus.OK,Messages.TraceControl_ImportFailure,null);
        List<ImportFileInfo> traces=dialog.getTracePathes();
        IProject selectedProject=dialog.getProject();
        for (Iterator<ImportFileInfo> iterator=traces.iterator(); iterator.hasNext(); ) {
          try {
            if (monitor.isCanceled()) {
              status.add(Status.CANCEL_STATUS);
              break;
            }
            ImportFileInfo remoteFile=iterator.next();
            downloadTrace(remoteFile,selectedProject,monitor);
            IFolder traceFolder=remoteFile.getDestinationFolder();
            IResource file=traceFolder.findMember(remoteFile.getLocalTraceName());
            if (file != null) {
              TraceTypeHelper helper=null;
              try {
                helper=TmfTraceTypeUIUtils.selectTraceType(file.getLocation().toOSString(),null,null);
              }
 catch (              TmfTraceImportException e) {
              }
              if (helper != null) {
                status.add(TmfTraceTypeUIUtils.setTraceType(file,helper));
              }
              try {
                final String scheme="String_Node_Str";
                String host=remoteFile.getImportFile().getHost().getName();
                int port=remoteFile.getImportFile().getParentRemoteFileSubSystem().getConnectorService().getPort();
                String path=remoteFile.getImportFile().getAbsolutePath();
                if (file instanceof IFolder) {
                  path+=IPath.SEPARATOR;
                }
                URI uri=new URI(scheme,null,host,port,path,null,null);
                String sourceLocation=URIUtil.toUnencodedString(uri);
                file.setPersistentProperty(TmfCommonConstants.SOURCE_LOCATION,sourceLocation);
              }
 catch (              URISyntaxException e) {
              }
            }
          }
 catch (          ExecutionException e) {
            status.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,Messages.TraceControl_ImportFailure,e));
          }
catch (          CoreException e) {
            status.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,Messages.TraceControl_ImportFailure,e));
          }
        }
        return status;
      }
    }
;
    job.setUser(true);
    job.schedule();
  }
  finally {
    fLock.unlock();
  }
  return null;
}