Program: 138653
Project: 138653
Buggy source:
/** 
 * Install a drag&drop function for target table viewer.
 * @param targetViewer the target table viewer for installing drag&drop, it's input value must a <code>List</code>type.
 * @param installDragListener decide to whether install a drag listener for targetViewer: if true, will install thelistener; else, will not install.
 * @param validateType
 * @see ComparisonTableViewerDNDDecorate#NON_VALIDATETYPE
 * @see ComparisonTableViewerDNDDecorate#COLUMN_VALIDATETYPE
 */
public void installDND(final TableViewer targetViewer,final boolean installDragListener,final int validateType){
  int operations=DND.DROP_COPY | DND.DROP_MOVE;
  if (installDragListener) {
    installDragListener(targetViewer,operations);
  }
  DropTarget dropTarget=new DropTarget(targetViewer.getTable(),operations);
  dropTarget.setTransfer(transferTypes);
  DropTargetListener dndListener=new AbstractSelectionReceiver(targetViewer.getTable(),null){
    @SuppressWarnings("String_Node_Str") public void drop(    DropTargetEvent event,    LocalSelectionTransfer transfer){
      List inputElements=(List)targetViewer.getInput();
      if (inputElements == null) {
        inputElements=new ArrayList();
      }
      if (dragSelectedElement != null) {
        TableItem item=(TableItem)event.item;
        TableItem[] items=targetViewer.getTable().getItems();
        int index=0;
        for (int i=0; i < items.length; i++) {
          if (items[i] == item) {
            index=i;
            break;
          }
        }
        inputElements.remove(dragSelectedElement);
        inputElements.add(index,dragSelectedElement);
        dragSelectedElement=null;
      }
 else {
        StructuredSelection selection=(StructuredSelection)transfer.getSelection();
        List selectionElements=selection.toList();
        inputElements.addAll(selectionElements);
      }
      targetViewer.setInput(inputElements);
      compareTreeViewer.updateBindConnection(masterPage,tableViewerPosStack);
      compareTreeViewer.setDirty(true);
    }
    public boolean doDropValidation(    DropTargetEvent event,    LocalSelectionTransfer transfer){
      if (dragSelectedElement != null) {
        return true;
      }
      boolean doDropValidation=false;
      StructuredSelection selection=(StructuredSelection)transfer.getSelection();
switch (validateType) {
case COLUMN_VALIDATETYPE:
        doDropValidation=validateColumnType(selection,targetViewer);
      break;
default :
    doDropValidation=true;
}
return doDropValidation;
}
}
;
dropTarget.addDropListener(dndListener);
}

Fixed version (ground truth):
/** 
 * Install a drag&drop function for target table viewer.
 * @param targetViewer the target table viewer for installing drag&drop, it's input value must a <code>List</code>type.
 * @param installDragListener decide to whether install a drag listener for targetViewer: if true, will install thelistener; else, will not install.
 * @param validateType
 * @see ComparisonTableViewerDNDDecorate#NON_VALIDATETYPE
 * @see ComparisonTableViewerDNDDecorate#COLUMN_VALIDATETYPE
 */
public void installDND(final TableViewer targetViewer,final boolean installDragListener,final int validateType){
  int operations=DND.DROP_COPY | DND.DROP_MOVE;
  if (installDragListener) {
    installDragListener(targetViewer,operations);
  }
  DropTarget dropTarget=new DropTarget(targetViewer.getTable(),operations);
  dropTarget.setTransfer(transferTypes);
  DropTargetListener dndListener=new AbstractSelectionReceiver(targetViewer.getTable(),null){
    @SuppressWarnings("String_Node_Str") public void drop(    DropTargetEvent event,    LocalSelectionTransfer transfer){
      List inputElements=(List)targetViewer.getInput();
      if (inputElements == null) {
        inputElements=new ArrayList();
      }
      if (dragSelectedElement != null) {
        TableItem item=(TableItem)event.item;
        TableItem[] items=targetViewer.getTable().getItems();
        int index=0;
        for (int i=0; i < items.length; i++) {
          if (items[i] == item) {
            index=i;
            break;
          }
        }
        inputElements.remove(dragSelectedElement);
        inputElements.add(index,dragSelectedElement);
        dragSelectedElement=null;
      }
 else {
        StructuredSelection selection=(StructuredSelection)transfer.getSelection();
        List selectionElements=selection.toList();
        inputElements.addAll(selectionElements);
      }
      targetViewer.setInput(inputElements);
      compareTreeViewer.updateBindConnection(masterPage,tableViewerPosStack);
      compareTreeViewer.setDirty(true);
    }
    public boolean doDropValidation(    DropTargetEvent event,    LocalSelectionTransfer transfer){
      StructuredSelection selection=(StructuredSelection)transfer.getSelection();
      if (dragSelectedElement != null && selection != null) {
        return true;
      }
      boolean doDropValidation=false;
switch (validateType) {
case COLUMN_VALIDATETYPE:
        doDropValidation=validateColumnType(selection,targetViewer);
      break;
default :
    doDropValidation=true;
}
return doDropValidation;
}
}
;
dropTarget.addDropListener(dndListener);
}