Program: 44866
Project: 44866
Buggy source:
private Collection initCommandBarActionsList(){
  String[] commandBarActionIds=CommandBarAttributes.getActions();
  int nbCommandBarActionIds=commandBarActionIds.length;
  for (int i=0; i < nbCommandBarActionIds; ++i)   commandBarButtons.add(CommandBarButtonForDisplay.create(commandBarActionIds[i]));
  commandBarButtonsList=new DynamicList(commandBarButtons);
  commandBarButtonsList.setCellRenderer(new CommandBarButtonListCellRenderer());
  commandBarButtonsList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
  commandBarButtonsList.setVisibleRowCount(1);
  commandBarButtonsList.setDragEnabled(true);
  commandBarButtonsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  commandBarButtonsList.setTransferHandler(new CommandBarActionsListTransferHandler());
  commandBarButtonsList.setBackground(JBUTTON_BACKGROUND_COLOR);
  try {
    commandBarButtonsList.getDropTarget().addDropTargetListener(new DropTargetListener(){
      public void dragEnter(      DropTargetDragEvent dtde){
      }
      public void dragExit(      DropTargetEvent dte){
        selectedCommandBarButtonIndex=-2;
        commandBarButtonsList.repaint();
      }
      public void dragOver(      DropTargetDragEvent dtde){
        int index;
        int newSide=0;
        if (canImport) {
          Point dropLocation=dtde.getLocation();
          index=commandBarButtonsList.locationToIndex(dropLocation);
          Point cellLocation=commandBarButtonsList.indexToLocation(index);
          newSide=cellLocation.x + CommandBarButtonForDisplay.PREFERRED_SIZE.width / 2 > dropLocation.x ? LEFT : RIGHT;
        }
 else         index=-2;
        if (index != selectedCommandBarButtonIndex || selectedCommandBarButtonSide != newSide) {
          selectedCommandBarButtonIndex=index;
          selectedCommandBarButtonSide=newSide;
          commandBarButtonsList.repaint();
        }
      }
      public void drop(      DropTargetDropEvent dtde){
        if (!isImported)         return;
        Point dropLocation=dtde.getLocation();
        int index=commandBarButtonsList.locationToIndex(dropLocation);
        Point cellLocation=commandBarButtonsList.indexToLocation(index);
        if (cellLocation.x + CommandBarButtonForDisplay.PREFERRED_SIZE.width / 2 < dropLocation.x)         index++;
        commandBarButtons.add(index,transferedButton);
        commandBarAlternativeButtons.add(index,transferedButtonProperties.getSource() == COMMAND_BAR_BUTTONS_LIST_ID ? commandBarAlternativeButtons.remove(transferedButtonProperties.getIndex()) : null);
        commandBarButtonsList.ensureIndexIsVisible(index);
      }
      public void dropActionChanged(      DropTargetDragEvent dtde){
      }
    }
);
  }
 catch (  TooManyListenersException e) {
    AppLogger.fine("String_Node_Str",e);
  }
  return Arrays.asList(commandBarActionIds);
}

Fixed version (ground truth):
private Collection initCommandBarActionsList(){
  String[] commandBarActionIds=CommandBarAttributes.getActions();
  int nbCommandBarActionIds=commandBarActionIds.length;
  for (int i=0; i < nbCommandBarActionIds; ++i)   commandBarButtons.add(CommandBarButtonForDisplay.create(commandBarActionIds[i]));
  commandBarButtonsList=new DynamicList(commandBarButtons);
  commandBarButtonsList.setCellRenderer(new CommandBarButtonListCellRenderer());
  commandBarButtonsList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
  commandBarButtonsList.setVisibleRowCount(1);
  commandBarButtonsList.setDragEnabled(true);
  commandBarButtonsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  commandBarButtonsList.setTransferHandler(new CommandBarActionsListTransferHandler());
  commandBarButtonsList.setBackground(JBUTTON_BACKGROUND_COLOR);
  try {
    commandBarButtonsList.getDropTarget().addDropTargetListener(new DropTargetListener(){
      public void dragEnter(      DropTargetDragEvent dtde){
      }
      public void dragExit(      DropTargetEvent dte){
        selectedCommandBarButtonIndex=-2;
        commandBarButtonsList.repaint();
      }
      public void dragOver(      DropTargetDragEvent dtde){
        int index;
        int newSide=0;
        if (canImport) {
          Point dropLocation=dtde.getLocation();
          index=commandBarButtonsList.locationToIndex(dropLocation);
          Point cellLocation=commandBarButtonsList.indexToLocation(index);
          newSide=cellLocation.x + CommandBarButtonForDisplay.PREFERRED_SIZE.width / 2 > dropLocation.x ? LEFT : RIGHT;
        }
 else         index=-2;
        if (index != selectedCommandBarButtonIndex || selectedCommandBarButtonSide != newSide) {
          selectedCommandBarButtonIndex=index;
          selectedCommandBarButtonSide=newSide;
          commandBarButtonsList.repaint();
        }
      }
      public void drop(      DropTargetDropEvent dtde){
        if (!isImported)         return;
        Point dropLocation=dtde.getLocation();
        int index=commandBarButtonsList.locationToIndex(dropLocation);
        Point cellLocation=commandBarButtonsList.indexToLocation(index);
        if (cellLocation.x + CommandBarButtonForDisplay.PREFERRED_SIZE.width / 2 < dropLocation.x)         index++;
        index+=transferedButtonProperties.getSource() == COMMAND_BAR_BUTTONS_LIST_ID && index > transferedButtonProperties.getIndex() ? -1 : 0;
        commandBarButtons.add(index,transferedButton);
        commandBarAlternativeButtons.add(index,transferedButtonProperties.getSource() == COMMAND_BAR_BUTTONS_LIST_ID ? commandBarAlternativeButtons.remove(transferedButtonProperties.getIndex()) : null);
        commandBarButtonsList.ensureIndexIsVisible(index);
      }
      public void dropActionChanged(      DropTargetDragEvent dtde){
      }
    }
);
  }
 catch (  TooManyListenersException e) {
    AppLogger.fine("String_Node_Str",e);
  }
  return Arrays.asList(commandBarActionIds);
}