Program: 96765
Project: 96765
Buggy source:
/** 
 * Either return a single commit transaction or user must choose from a list of valid commit transactions
 */
public static TransactionToken getTransactionIdOrPopupChoose(TeamWorkFlowArtifact teamArt,String title,boolean showMergeManager) throws OseeCoreException {
  Collection<TransactionToken> transactionIds=new HashSet<>();
  Collection<TransactionRecord> transactions=AtsClientService.get().getBranchService().getTransactionIds(teamArt,showMergeManager);
  for (  TransactionRecord id : transactions) {
    boolean workingBranch=BranchManager.getType(id).isWorkingBranch();
    BranchState state=BranchManager.getState(id.getBranch());
    if (!workingBranch || !(state.isRebaselined() && state.isCommitted())) {
      transactionIds.add(id);
    }
  }
  if (transactionIds.size() == 1) {
    return transactionIds.iterator().next();
  }
  ViewerSorter sorter=new ViewerSorter(){
    @Override public int compare(    Viewer viewer,    Object e1,    Object e2){
      if (e1 == null || e2 == null) {
        return 0;
      }
      TransactionId tx1=(TransactionId)e1;
      TransactionId tx2=(TransactionId)e2;
      return (int)(tx1.getId() - tx2.getId());
    }
  }
;
  FilteredTreeDialog dialog=new FilteredTreeDialog(title,"String_Node_Str",new ArrayTreeContentProvider(),new TransactionIdLabelProvider(),sorter);
  dialog.setInput(transactionIds);
  if (dialog.open() == 0) {
    return dialog.getSelectedFirst();
  }
  return TransactionToken.SENTINEL;
}

Fixed version (ground truth):
/** 
 * Either return a single commit transaction or user must choose from a list of valid commit transactions
 */
public static TransactionToken getTransactionIdOrPopupChoose(TeamWorkFlowArtifact teamArt,String title,boolean showMergeManager) throws OseeCoreException {
  Collection<TransactionToken> transactionIds=new HashSet<>();
  Collection<TransactionRecord> transactions=AtsClientService.get().getBranchService().getTransactionIds(teamArt,showMergeManager);
  final Map<IOseeBranch,TransactionId> branchToTx=new LinkedHashMap<>();
  if (transactionIds.size() == 1) {
    return transactionIds.iterator().next();
  }
  for (  TransactionRecord id : transactions) {
    boolean workingBranch=BranchManager.getType(id).isWorkingBranch();
    BranchState state=BranchManager.getState(id.getBranch());
    if (!workingBranch || !(state.isRebaselined() && state.isCommitted())) {
      IOseeBranch branch=BranchManager.getBranchToken(id.getBranch());
      branchToTx.put(branch,id);
    }
  }
  ViewerSorter sorter=new ViewerSorter(){
    @Override public int compare(    Viewer viewer,    Object e1,    Object e2){
      if (e1 == null || e2 == null) {
        return 0;
      }
      Long b1=((IOseeBranch)e1).getId();
      Long b2=((IOseeBranch)e1).getId();
      if (b1 > b2) {
        return -1;
      }
      if (b2 > b1) {
        return 1;
      }
      return 0;
    }
  }
;
  FilteredTreeDialog dialog=new FilteredTreeDialog(title,"String_Node_Str",new ArrayTreeContentProvider(),new NameLabelProvider(),sorter);
  dialog.setInput(branchToTx.keySet());
  if (dialog.open() == 0) {
    IOseeBranch branch=dialog.getSelectedFirst();
    if (branch != null) {
      TransactionId id=branchToTx.get(branch);
      return TransactionToken.valueOf(id,branch);
    }
  }
  return TransactionToken.SENTINEL;
}