Program: 190296
Project: 190296
Buggy source:
public JComponent getToolbar(){
  HashMap<ToolUI,Tool> toolMap=new HashMap<ToolUI,Tool>();
  List<ToolUI> toolsUI=new ArrayList<ToolUI>();
  for (  Tool tool : tools) {
    ToolUI ui=tool.getUI();
    if (ui != null) {
      toolsUI.add(ui);
      toolMap.put(ui,tool);
    }
  }
  Collections.sort(toolsUI,new Comparator(){
    public int compare(    Object o1,    Object o2){
      Integer p1=((ToolUI)o1).getPosition();
      Integer p2=((ToolUI)o2).getPosition();
      return p1.compareTo(p2);
    }
  }
);
  final Toolbar toolbar=new Toolbar();
  for (  final ToolUI toolUI : toolsUI) {
    final Tool tool=toolMap.get(toolUI);
    JToggleButton btn;
    if (toolUI.getIcon() != null) {
      btn=new JToggleButton(toolUI.getIcon());
    }
 else {
      btn=new JToggleButton(new ImageIcon(getClass().getResource("String_Node_Str")));
    }
    btn.setToolTipText(toolUI.getName() + "String_Node_Str" + toolUI.getDescription());
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        select(tool);
        propertiesBar.select(toolUI.getPropertiesBar(tool));
      }
    }
);
    toolbar.add(btn);
  }
  VizController.getInstance().getSelectionManager().addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      SelectionManager selectionManager=VizController.getInstance().getSelectionManager();
      if (selectionManager.isRectangleSelection() && currentTool != null) {
        toolbar.clearSelection();
        unselect();
      }
 else       if (selectionManager.isSelectionEnabled() && currentTool != null && currentTool.getSelectionType() == ToolSelectionType.NONE) {
        toolbar.clearSelection();
        unselect();
      }
    }
  }
);
  return toolbar;
}

Fixed version (ground truth):
public JComponent getToolbar(){
  HashMap<ToolUI,Tool> toolMap=new HashMap<ToolUI,Tool>();
  List<ToolUI> toolsUI=new ArrayList<ToolUI>();
  for (  Tool tool : tools) {
    ToolUI ui=tool.getUI();
    if (ui != null) {
      toolsUI.add(ui);
      toolMap.put(ui,tool);
    }
  }
  Collections.sort(toolsUI,new Comparator(){
    public int compare(    Object o1,    Object o2){
      Integer p1=((ToolUI)o1).getPosition();
      Integer p2=((ToolUI)o2).getPosition();
      return p1.compareTo(p2);
    }
  }
);
  final Toolbar toolbar=new Toolbar();
  for (  final ToolUI toolUI : toolsUI) {
    final Tool tool=toolMap.get(toolUI);
    JToggleButton btn;
    if (toolUI.getIcon() != null) {
      btn=new JToggleButton(toolUI.getIcon());
    }
 else {
      btn=new JToggleButton(new ImageIcon(getClass().getResource("String_Node_Str")));
    }
    btn.setToolTipText(toolUI.getName() + "String_Node_Str" + toolUI.getDescription());
    btn.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        if (tool == currentTool) {
          toolbar.clearSelection();
          unselect();
        }
 else {
          select(tool);
          propertiesBar.select(toolUI.getPropertiesBar(tool));
        }
      }
    }
);
    toolbar.add(btn);
  }
  VizController.getInstance().getSelectionManager().addChangeListener(new ChangeListener(){
    public void stateChanged(    ChangeEvent e){
      SelectionManager selectionManager=VizController.getInstance().getSelectionManager();
      if (selectionManager.isRectangleSelection() && currentTool != null) {
        toolbar.clearSelection();
        unselect();
      }
 else       if (selectionManager.isSelectionEnabled() && currentTool != null && currentTool.getSelectionType() == ToolSelectionType.NONE) {
        toolbar.clearSelection();
        unselect();
      }
 else       if (selectionManager.isDraggingEnabled() && currentTool != null) {
        toolbar.clearSelection();
        unselect();
      }
    }
  }
);
  return toolbar;
}