Program: 152085
Project: 152085
Buggy source:
/** 
 * Activates this group.
 */
public void activate(){
  if (tree == null) {
    tree=new JTree(new ConfigTreeNode(null,null),true);
    tree.setRootVisible(false);
    tree.setEditable(true);
    InputMap imap=tree.getInputMap().getParent();
    imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_X,KeyEvent.CTRL_MASK));
    imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_C,KeyEvent.CTRL_MASK));
    imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_V,KeyEvent.CTRL_MASK));
    tree.setDragEnabled(true);
    tree.setTransferHandler(new TransferHandler(){
      public int getSourceActions(      JComponent comp){
        return COPY_OR_MOVE;
      }
      public boolean canImport(      JComponent comp,      DataFlavor[] flavors){
        return ListUtil.contains(flavors,ToolUtil.SERIALIZED_WRAPPED_FLAVOR);
      }
      public boolean importData(      JComponent comp,      Transferable t){
        boolean local=t.isDataFlavorSupported(LOCAL_NODE_TRANSFER_FLAVOR);
        DataFlavor flavor=local ? LOCAL_NODE_TRANSFER_FLAVOR : ToolUtil.SERIALIZED_WRAPPED_FLAVOR;
        Object data;
        try {
          data=t.getTransferData(local ? LOCAL_NODE_TRANSFER_FLAVOR : ToolUtil.SERIALIZED_WRAPPED_FLAVOR);
        }
 catch (        Exception e) {
          log.warning("String_Node_Str",e);
          return false;
        }
        ConfigTreeNode node, onode=null;
        if (local) {
          NodeTransfer transfer=(NodeTransfer)data;
          node=transfer.cnode;
          onode=transfer.onode;
        }
 else {
          data=((SerializableWrapper)data).getObject();
          if (!(data instanceof ConfigTreeNode)) {
            return false;
          }
          node=(ConfigTreeNode)data;
        }
        if (!node.verifyConfigClass(group.getConfigClass())) {
          return false;
        }
        ConfigTreeNode snode=getSelectedNode();
        if (onode != null && onode == snode) {
          return false;
        }
        ConfigTreeNode parent=(ConfigTreeNode)tree.getModel().getRoot();
        int index=parent.getChildCount();
        if (snode != null && snode.getParent() != null) {
          if (snode.getAllowsChildren()) {
            parent=snode;
            index=snode.getChildCount();
          }
 else {
            parent=(ConfigTreeNode)snode.getParent();
            int oidx=(onode == null) ? -1 : parent.getIndex(onode);
            int sidx=parent.getIndex(snode);
            index=sidx + ((oidx >= 0 && sidx > oidx) ? 1 : 0);
          }
        }
        node=(ConfigTreeNode)node.clone();
        ((DefaultTreeModel)tree.getModel()).insertNodeInto(node,parent,index);
        tree.setSelectionPath(new TreePath(node.getPath()));
        return true;
      }
      protected Transferable createTransferable(      JComponent c){
        ConfigTreeNode node=getSelectedNode();
        return (node == null) ? null : new NodeTransfer(node,false);
      }
      protected void exportDone(      JComponent source,      Transferable data,      int action){
        if (action == MOVE) {
          ConfigTreeNode onode=((NodeTransfer)data).onode;
          ((DefaultTreeModel)tree.getModel()).removeNodeFromParent(onode);
        }
      }
    }
);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.addTreeSelectionListener(this);
    tree.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  }
  _pane.setViewportView(tree);
  _paste.setEnabled(_clipgroup == this);
  updateSelection();
}

Fixed version (ground truth):
/** 
 * Activates this group.
 */
public void activate(){
  if (tree == null) {
    tree=new JTree(new DefaultTreeModel(new ConfigTreeNode(null,null),true){
      public void valueForPathChanged(      TreePath path,      Object newValue){
        super.valueForPathChanged(path,newValue);
        ConfigTreeNode node=(ConfigTreeNode)path.getLastPathComponent();
        ConfigTreeNode parent=(ConfigTreeNode)node.getParent();
        removeNodeFromParent(node);
        insertNodeInto(node,parent,parent.getInsertionIndex(node));
      }
    }
);
    tree.setRootVisible(false);
    tree.setEditable(true);
    InputMap imap=tree.getInputMap().getParent();
    imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_X,KeyEvent.CTRL_MASK));
    imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_C,KeyEvent.CTRL_MASK));
    imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_V,KeyEvent.CTRL_MASK));
    tree.setDragEnabled(true);
    tree.setTransferHandler(new TransferHandler(){
      public int getSourceActions(      JComponent comp){
        return COPY_OR_MOVE;
      }
      public boolean canImport(      JComponent comp,      DataFlavor[] flavors){
        return ListUtil.contains(flavors,ToolUtil.SERIALIZED_WRAPPED_FLAVOR);
      }
      public boolean importData(      JComponent comp,      Transferable t){
        boolean local=t.isDataFlavorSupported(LOCAL_NODE_TRANSFER_FLAVOR);
        DataFlavor flavor=local ? LOCAL_NODE_TRANSFER_FLAVOR : ToolUtil.SERIALIZED_WRAPPED_FLAVOR;
        Object data;
        try {
          data=t.getTransferData(local ? LOCAL_NODE_TRANSFER_FLAVOR : ToolUtil.SERIALIZED_WRAPPED_FLAVOR);
        }
 catch (        Exception e) {
          log.warning("String_Node_Str",e);
          return false;
        }
        ConfigTreeNode node, onode=null;
        if (local) {
          NodeTransfer transfer=(NodeTransfer)data;
          node=transfer.cnode;
          onode=transfer.onode;
        }
 else {
          data=((SerializableWrapper)data).getObject();
          if (!(data instanceof ConfigTreeNode)) {
            return false;
          }
          node=(ConfigTreeNode)data;
        }
        if (!node.verifyConfigClass(group.getConfigClass())) {
          return false;
        }
        ConfigTreeNode snode=getSelectedNode();
        ConfigTreeNode parent=(ConfigTreeNode)tree.getModel().getRoot();
        if (snode != null) {
          parent=snode.getAllowsChildren() ? snode : (ConfigTreeNode)snode.getParent();
        }
        if (onode != null && onode.getParent() == parent) {
          return false;
        }
        node=(ConfigTreeNode)node.clone();
        ((DefaultTreeModel)tree.getModel()).insertNodeInto(node,parent,parent.getInsertionIndex(node));
        tree.setSelectionPath(new TreePath(node.getPath()));
        return true;
      }
      protected Transferable createTransferable(      JComponent c){
        ConfigTreeNode node=getSelectedNode();
        return (node == null) ? null : new NodeTransfer(node,false);
      }
      protected void exportDone(      JComponent source,      Transferable data,      int action){
        if (action == MOVE) {
          ConfigTreeNode onode=((NodeTransfer)data).onode;
          ((DefaultTreeModel)tree.getModel()).removeNodeFromParent(onode);
        }
      }
    }
);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.addTreeSelectionListener(this);
    tree.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  }
  _pane.setViewportView(tree);
  _paste.setEnabled(_clipgroup == this);
  updateSelection();
}