Program: 91392
Project: 91392
Buggy source:
boolean doFetch(){
  final RefSpec spec=new RefSpec().setSource(refText.getText()).setDestination(Constants.FETCH_HEAD);
  final String uri=uriCombo.getText();
  final CheckoutMode mode=getCheckoutMode();
  final boolean doCheckoutNewBranch=(mode == CheckoutMode.CREATE_BRANCH) && branchCheckoutButton.getSelection();
  final boolean doActivateAdditionalRefs=showAdditionalRefs();
  final String textForTag=tagText.getText();
  final String textForBranch=branchText.getText();
  Job job=new WorkspaceJob(UIText.FetchGerritChangePage_GetChangeTaskName){
    @Override public IStatus runInWorkspace(    IProgressMonitor monitor){
      try {
        SubMonitor progress=SubMonitor.convert(monitor,UIText.FetchGerritChangePage_GetChangeTaskName,getTotalWork(mode));
        RevCommit commit=fetchChange(uri,spec,progress.newChild(1));
switch (mode) {
case CHECKOUT_FETCH_HEAD:
          checkout(commit.name(),progress.newChild(1));
        break;
case CREATE_TAG:
      createTag(spec,textForTag,commit,progress.newChild(1));
    checkout(commit.name(),progress.newChild(1));
  break;
case CREATE_BRANCH:
createBranch(textForBranch,doCheckoutNewBranch,commit,progress.newChild(1));
break;
default :
}
if (doActivateAdditionalRefs) {
activateAdditionalRefs();
}
if (mode == CheckoutMode.NOCHECKOUT) {
repository.fireEvent(new FetchHeadChangedEvent());
}
storeLastUsedUri(uri);
}
 catch (CoreException ce) {
return ce.getStatus();
}
catch (Exception e) {
return Activator.createErrorStatus(e.getLocalizedMessage(),e);
}
 finally {
monitor.done();
}
return Status.OK_STATUS;
}
private int getTotalWork(final CheckoutMode m){
switch (m) {
case CHECKOUT_FETCH_HEAD:
case CREATE_BRANCH:
return 2;
case CREATE_TAG:
return 3;
default :
return 1;
}
}
@Override public boolean belongsTo(Object family){
if (JobFamilies.FETCH.equals(family)) return true;
return super.belongsTo(family);
}
}
;
job.setUser(true);
job.schedule();
return true;
}

Fixed version (ground truth):
boolean doFetch(){
  final RefSpec spec=new RefSpec().setSource(refText.getText()).setDestination(Constants.FETCH_HEAD);
  final String uri=uriCombo.getText();
  final CheckoutMode mode=getCheckoutMode();
  final boolean doCheckoutNewBranch=(mode == CheckoutMode.CREATE_BRANCH) && branchCheckoutButton.getSelection();
  final boolean doActivateAdditionalRefs=showAdditionalRefs();
  final String textForTag=tagText.getText();
  final String textForBranch=branchText.getText();
  Job job=new WorkspaceJob(UIText.FetchGerritChangePage_GetChangeTaskName){
    @Override public IStatus runInWorkspace(    IProgressMonitor monitor){
      try {
        SubMonitor progress=SubMonitor.convert(monitor,UIText.FetchGerritChangePage_GetChangeTaskName,getTotalWork(mode));
        RevCommit commit=fetchChange(uri,spec,progress.newChild(1));
switch (mode) {
case CHECKOUT_FETCH_HEAD:
          checkout(commit.name(),progress.newChild(1));
        break;
case CREATE_TAG:
      createTag(spec,textForTag,commit,progress.newChild(1));
    checkout(commit.name(),progress.newChild(1));
  break;
case CREATE_BRANCH:
createBranch(textForBranch,doCheckoutNewBranch,commit,progress.newChild(1));
break;
default :
break;
}
if (doActivateAdditionalRefs) {
activateAdditionalRefs();
}
if (mode == CheckoutMode.NOCHECKOUT) {
repository.fireEvent(new FetchHeadChangedEvent());
}
storeLastUsedUri(uri);
}
 catch (CoreException ce) {
return ce.getStatus();
}
catch (Exception e) {
return Activator.createErrorStatus(e.getLocalizedMessage(),e);
}
 finally {
monitor.done();
}
return Status.OK_STATUS;
}
private int getTotalWork(final CheckoutMode m){
switch (m) {
case CHECKOUT_FETCH_HEAD:
case CREATE_BRANCH:
return 2;
case CREATE_TAG:
return 3;
default :
return 1;
}
}
@Override public boolean belongsTo(Object family){
if (JobFamilies.FETCH.equals(family)) return true;
return super.belongsTo(family);
}
}
;
job.setUser(true);
job.schedule();
return true;
}