Program: 7717
Project: 7717
Buggy source:
/** 
 * Shared implementation to be called from an implementation of  {@link org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)}<p> Perform a rebase operation, moving the commits from the branch tip <code>commit</code> onto the currently checked out branch. The actual operation is deferred to a   {@link RebaseOperation} executedas a  {@link Job}. <p>
 * @param repository
 * @param jobname
 * @param ref
 */
public static void runRebaseJob(final Repository repository,String jobname,Ref ref){
  final RebaseOperation rebase=new RebaseOperation(repository,ref);
  Job job=new Job(jobname){
    @Override protected IStatus run(    IProgressMonitor monitor){
      try {
        rebase.execute(monitor);
      }
 catch (      final CoreException e) {
        try {
          new RebaseOperation(repository,Operation.ABORT).execute(monitor);
        }
 catch (        CoreException e1) {
          return e1.getStatus();
        }
        return e.getStatus();
      }
      return Status.OK_STATUS;
    }
  }
;
  job.setUser(true);
  job.setRule(rebase.getSchedulingRule());
  job.addJobChangeListener(new JobChangeAdapter(){
    @Override public void done(    IJobChangeEvent cevent){
      IStatus result=cevent.getJob().getResult();
      if (result.getSeverity() == IStatus.CANCEL) {
        Display.getDefault().asyncExec(new Runnable(){
          public void run(){
            Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
            MessageDialog.openInformation(shell,UIText.RebaseCurrentRefCommand_RebaseCanceledTitle,UIText.RebaseCurrentRefCommand_RebaseCanceledMessage);
          }
        }
);
      }
 else       if (result.isOK()) {
        RebaseResultDialog.show(rebase.getResult(),repository);
      }
    }
  }
);
  job.schedule();
}

Fixed version (ground truth):
/** 
 * Shared implementation to be called from an implementation of  {@link org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)}<p> Perform a rebase operation, moving the commits from the branch tip <code>commit</code> onto the currently checked out branch. The actual operation is deferred to a   {@link RebaseOperation} executedas a  {@link Job}. <p>
 * @param repository
 * @param jobname
 * @param ref
 */
public static void runRebaseJob(final Repository repository,String jobname,Ref ref){
  final RebaseOperation rebase=new RebaseOperation(repository,ref);
  Job job=new Job(jobname){
    @Override protected IStatus run(    IProgressMonitor monitor){
      try {
        rebase.execute(monitor);
      }
 catch (      final CoreException e) {
        if (!repository.getRepositoryState().equals(RepositoryState.SAFE)) {
          try {
            new RebaseOperation(repository,Operation.ABORT).execute(monitor);
          }
 catch (          CoreException e1) {
            return createMultiStatus(e,e1);
          }
        }
        return e.getStatus();
      }
      return Status.OK_STATUS;
    }
  }
;
  job.setUser(true);
  job.setRule(rebase.getSchedulingRule());
  job.addJobChangeListener(new JobChangeAdapter(){
    @Override public void done(    IJobChangeEvent cevent){
      IStatus result=cevent.getJob().getResult();
      if (result.getSeverity() == IStatus.CANCEL) {
        Display.getDefault().asyncExec(new Runnable(){
          public void run(){
            Shell shell=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
            MessageDialog.openInformation(shell,UIText.RebaseCurrentRefCommand_RebaseCanceledTitle,UIText.RebaseCurrentRefCommand_RebaseCanceledMessage);
          }
        }
);
      }
 else       if (result.isOK()) {
        RebaseResultDialog.show(rebase.getResult(),repository);
      }
    }
  }
);
  job.schedule();
}