Program: 82416
Project: 82416
Buggy source:
/** 
 * @param logEvent
 */
private void addUpdate(final LogEvent logEvent){
  new SwingWorker<LogEvent,Void>(){
    @Override protected LogEvent doInBackground() throws Exception {
      return logEvent;
    }
    @Override protected void done(){
      LogEvent event;
      try {
        event=get();
        SwingTreeLogger logger=event.childLogger;
        DefaultMutableTreeNode node;
        DefaultMutableTreeNode parent;
        int idx;
        if (event.isBranchCommit) {
          SwingTreeLogger parentLogger=(SwingTreeLogger)logger.getParentLogger();
          parent=parentLogger.treeNode;
          idx=logger.getBranchedIndex();
          node=logger.treeNode;
        }
 else {
          parent=logger.treeNode;
          idx=event.index;
          node=new DefaultMutableTreeNode(event);
        }
        int insertIndex=findInsertionPoint(parent,idx);
        panel.treeModel.insertNodeInto(node,parent,insertIndex);
        if (parent == panel.treeModel.getRoot() && parent.getChildCount() == 1) {
          panel.treeModel.reload();
        }
        if (event.type.needsAttention()) {
          panel.tree.makeVisible(new TreePath(node.getPath()));
        }
        Type priority=event.getInheritedPriority();
        while (parent != panel.treeModel.getRoot()) {
          LogEvent parentEvent=(LogEvent)parent.getUserObject();
          if (!parentEvent.updateInheritedPriority(priority)) {
            break;
          }
          parent=(DefaultMutableTreeNode)parent.getParent();
        }
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
catch (      ExecutionException e) {
        e.printStackTrace();
      }
    }
    private int findInsertionPoint(    DefaultMutableTreeNode parent,    int index){
      int high=parent.getChildCount() - 1;
      if (high < 0) {
        return 0;
      }
      int low=0;
      while (low <= high) {
        final int mid=low + ((high - low) >> 1);
        DefaultMutableTreeNode midChild=(DefaultMutableTreeNode)parent.getChildAt(mid);
        final Object userObject=midChild.getUserObject();
        int compIdx=-1;
        if (userObject instanceof LogEvent) {
          LogEvent event=(LogEvent)userObject;
          compIdx=event.index;
        }
        if (compIdx < index) {
          low=mid + 1;
        }
 else         if (compIdx > index) {
          high=mid - 1;
        }
 else {
          return mid;
        }
      }
      return low;
    }
  }
.execute();
}

Fixed version (ground truth):
/** 
 * Add a log event to be processed on the event thread.
 * @param logEvent LogEvent to process
 */
private void addUpdate(final LogEvent logEvent){
  EventQueue.invokeLater(new Runnable(){
    public void run(){
      SwingTreeLogger logger=logEvent.childLogger;
      DefaultMutableTreeNode node;
      DefaultMutableTreeNode parentNode;
      int idx;
      if (logEvent.isBranchCommit) {
        SwingTreeLogger parentLogger=(SwingTreeLogger)logger.getParentLogger();
        logger.treeNode.setUserObject(logEvent);
        parentNode=parentLogger.treeNode;
        idx=logger.getBranchedIndex();
        node=logger.treeNode;
      }
 else {
        parentNode=logger.treeNode;
        idx=logEvent.index;
        node=new DefaultMutableTreeNode(logEvent);
      }
      int insertIndex=findInsertionPoint(parentNode,idx);
      panel.treeModel.insertNodeInto(node,parentNode,insertIndex);
      if (parentNode == panel.treeModel.getRoot() && parentNode.getChildCount() == 1) {
        panel.treeModel.reload();
      }
      if (logEvent.type.needsAttention()) {
        panel.tree.makeVisible(new TreePath(node.getPath()));
      }
      Type priority=logEvent.getInheritedPriority();
      while (parentNode != panel.treeModel.getRoot()) {
        LogEvent parentEvent=(LogEvent)parentNode.getUserObject();
        if (!parentEvent.updateInheritedPriority(priority)) {
          break;
        }
        parentNode=((DefaultMutableTreeNode)parentNode.getParent());
      }
    }
    private int findInsertionPoint(    DefaultMutableTreeNode parentNode,    int index){
      int high=parentNode.getChildCount() - 1;
      if (high < 0) {
        return 0;
      }
      int low=0;
      while (low <= high) {
        final int mid=low + ((high - low) >> 1);
        DefaultMutableTreeNode midChild=(DefaultMutableTreeNode)parentNode.getChildAt(mid);
        final Object userObject=midChild.getUserObject();
        int compIdx=-1;
        if (userObject instanceof LogEvent) {
          LogEvent event=(LogEvent)userObject;
          compIdx=event.index;
        }
        if (compIdx < index) {
          low=mid + 1;
        }
 else         if (compIdx > index) {
          high=mid - 1;
        }
 else {
          return mid;
        }
      }
      return low;
    }
  }
);
}