Program: 136204
Project: 136204
Buggy source:
/** 
 * Import/Copy selected components into the destination library. User is asked about type assignment changes. Used by DND and right-click copy operations.
 * @param destination
 */
public void importSelectedToLibrary(LibraryNode destination){
  if (destination.isInChain())   destination=destination.getHead();
  if (destination == null) {
    LOGGER.error("String_Node_Str");
    return;
  }
  if (!destination.isTLLibrary()) {
    LOGGER.error("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  if (!destination.isEditable()) {
    LOGGER.error("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  final List<Node> sourceNodes=mc.getSelectedNodes_NavigatorView();
  if (sourceNodes == null || sourceNodes.size() <= 0) {
    LOGGER.error("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  LOGGER.info("String_Node_Str" + sourceNodes.size() + "String_Node_Str"+ destination);
  final List<Node> eligibleForImporting=new ArrayList<Node>();
  for (  Node n : sourceNodes) {
    if (n instanceof LibraryNode)     eligibleForImporting.addAll(n.getDescendants_LibraryMemberNodes());
 else     if (!(n.getLibrary()).equals(destination))     eligibleForImporting.add(n);
  }
  Node done=null;
  for (  Node n : sourceNodes)   if (n instanceof ResourceNode) {
    destination.copyMember((LibraryMemberInterface)n);
    done=n.getLibrary();
  }
 else   if (n instanceof ContextualFacetNode) {
    done=(Node)destination.copyMember((ContextualFacetNode)n);
    ContextualFacetOwnerInterface owner=askForNewCFOwner((ContextualFacetNode)done);
    if (owner != null)     ((ContextualFacetNode)done).setOwner(owner);
 else {
      done.delete();
      mc.refresh();
      return;
    }
  }
  if (done != null) {
    mc.refresh(done);
    return;
  }
  if (destination.hasService()) {
    for (    Node n : eligibleForImporting)     if (n instanceof ServiceNode) {
      eligibleForImporting.remove(n);
      break;
    }
  }
  if (eligibleForImporting == null || eligibleForImporting.size() <= 0) {
    LOGGER.error("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  int ans=DialogUserNotifier.openQuestionWithCancel(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
switch (ans) {
case 0:
    ArrayList<Node> selected=new ArrayList<Node>(eligibleForImporting);
  for (  Node n : selected) {
    for (    Node nn : n.getDescendants_AssignedTypes(true))     if (!eligibleForImporting.contains(nn))     eligibleForImporting.add(nn);
  }
case 1:
break;
case 2:
return;
}
LOGGER.info("String_Node_Str" + eligibleForImporting.size() + "String_Node_Str");
mc.postStatus("String_Node_Str" + eligibleForImporting.size() + "String_Node_Str");
GlobalDialogResult result=askGlobalLocalNone(eligibleForImporting,destination);
Collection<Node> importedNodesMap=null;
switch (result) {
case GLOBAL:
importedNodesMap=destination.importNodes(eligibleForImporting,true);
break;
case LOCAL:
importedNodesMap=destination.importNodes(eligibleForImporting,false);
break;
case NONE:
importedNodesMap=destination.importNodes(eligibleForImporting).values();
break;
case CANCEL:
default :
break;
}
selectImportedNodesInNavigation(importedNodesMap);
mc.postStatus("String_Node_Str" + eligibleForImporting.size() + "String_Node_Str"+ destination);
mc.refresh(destination);
}

Fixed version (ground truth):
/** 
 * Import/Copy selected components into the destination library. User is asked about type assignment changes. Used by DND and right-click copy operations.
 * @param destination
 */
public void importSelectedToLibrary(LibraryNode destination){
  if (destination.isInChain())   destination=destination.getHead();
  if (destination == null) {
    LOGGER.error("String_Node_Str");
    return;
  }
  if (!destination.isTLLibrary()) {
    LOGGER.error("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  if (!destination.isEditable()) {
    LOGGER.error("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  final List<Node> sourceNodes=mc.getSelectedNodes_NavigatorView();
  if (sourceNodes == null || sourceNodes.size() <= 0) {
    LOGGER.error("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  LOGGER.info("String_Node_Str" + sourceNodes.size() + "String_Node_Str"+ destination);
  final List<Node> eligibleForImporting=new ArrayList<Node>();
  for (  Node n : sourceNodes) {
    if (n instanceof LibraryNode)     eligibleForImporting.addAll(n.getDescendants_LibraryMemberNodes());
 else     if (!(n.getLibrary()).equals(destination))     eligibleForImporting.add(n);
  }
  Node done=null;
  for (  Node n : sourceNodes)   if (n instanceof ResourceNode) {
    destination.copyMember((LibraryMemberInterface)n);
    done=n.getLibrary();
  }
 else   if (n instanceof ContributedFacetNode) {
    done=importNode(((ContributedFacetNode)n).getContributor(),destination);
  }
 else   if (n instanceof ContextualFacetNode) {
    done=importNode((ContextualFacetNode)n,destination);
  }
  if (done != null) {
    mc.refresh(done);
    return;
  }
  if (destination.hasService()) {
    for (    Node n : eligibleForImporting)     if (n instanceof ServiceNode) {
      eligibleForImporting.remove(n);
      break;
    }
  }
  if (eligibleForImporting == null || eligibleForImporting.size() <= 0) {
    LOGGER.error("String_Node_Str");
    DialogUserNotifier.openInformation("String_Node_Str","String_Node_Str");
    return;
  }
  int ans=DialogUserNotifier.openQuestionWithCancel(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
switch (ans) {
case 0:
    ArrayList<Node> selected=new ArrayList<Node>(eligibleForImporting);
  for (  Node n : selected) {
    for (    Node nn : n.getDescendants_AssignedTypes(true))     if (!eligibleForImporting.contains(nn))     eligibleForImporting.add(nn);
  }
case 1:
break;
case 2:
return;
}
LOGGER.info("String_Node_Str" + eligibleForImporting.size() + "String_Node_Str");
mc.postStatus("String_Node_Str" + eligibleForImporting.size() + "String_Node_Str");
GlobalDialogResult result=askGlobalLocalNone(eligibleForImporting,destination);
Collection<Node> importedNodesMap=null;
switch (result) {
case GLOBAL:
importedNodesMap=destination.importNodes(eligibleForImporting,true);
break;
case LOCAL:
importedNodesMap=destination.importNodes(eligibleForImporting,false);
break;
case NONE:
importedNodesMap=destination.importNodes(eligibleForImporting).values();
break;
case CANCEL:
default :
break;
}
selectImportedNodesInNavigation(importedNodesMap);
mc.postStatus("String_Node_Str" + eligibleForImporting.size() + "String_Node_Str"+ destination);
mc.refresh(destination);
}