Program: 75594
Project: 75594
Buggy source:
/** 
 * Delete the currently selected objects from this document.
 */
public void delete(){
  GraphPane graphPane=_jgraph.getGraphPane();
  GraphController controller=(GraphController)graphPane.getGraphController();
  SelectionModel model=controller.getSelectionModel();
  AbstractBasicGraphModel graphModel=(AbstractBasicGraphModel)controller.getGraphModel();
  Object selection[]=model.getSelectionAsArray();
  Object userObjects[]=new Object[selection.length];
  for (int i=0; i < selection.length; i++) {
    userObjects[i]=((Figure)selection[i]).getUserObject();
    model.removeSelection(selection[i]);
  }
  HashSet namedObjNodeSet=new HashSet();
  HashSet namedObjEdgeSet=new HashSet();
  HashSet edgeSet=new HashSet();
  for (int i=0; i < selection.length; i++) {
    if (selection[i] instanceof Figure) {
      Object userObject=((Figure)selection[i]).getUserObject();
      if (graphModel.isEdge(userObject) || graphModel.isNode(userObject)) {
        NamedObj actual=(NamedObj)graphModel.getSemanticObject(userObject);
        if (actual != null) {
          if (graphModel.isEdge(userObject)) {
            namedObjEdgeSet.add(actual);
          }
 else {
            namedObjNodeSet.add(actual);
          }
        }
 else {
          edgeSet.add(userObject);
        }
      }
    }
  }
  LinkedHashSet namedObjList=new LinkedHashSet(namedObjEdgeSet);
  namedObjList.addAll(namedObjNodeSet);
  StringBuffer moml=new StringBuffer();
  moml.append("String_Node_Str");
  Iterator elements=namedObjList.iterator();
  while (elements.hasNext()) {
    NamedObj element=(NamedObj)elements.next();
    String deleteElemName="String_Node_Str";
    if (element instanceof Relation) {
      deleteElemName="String_Node_Str";
    }
 else     if (element instanceof Entity) {
      deleteElemName="String_Node_Str";
    }
 else     if (element instanceof Attribute) {
      deleteElemName="String_Node_Str";
    }
 else     if (element instanceof Port) {
      deleteElemName="String_Node_Str";
    }
 else {
    }
    if (deleteElemName.length() > 0) {
      moml.append("String_Node_Str" + deleteElemName + "String_Node_Str"+ element.getName()+ "String_Node_Str");
    }
  }
  moml.append("String_Node_Str");
  try {
    graphModel.setDispatchEnabled(false);
    Iterator edges=edgeSet.iterator();
    while (edges.hasNext()) {
      Object nextEdge=edges.next();
      if (graphModel.isEdge(nextEdge)) {
        graphModel.disconnectEdge(this,nextEdge);
      }
    }
  }
  finally {
    graphModel.setDispatchEnabled(true);
  }
  try {
    CompositeEntity toplevel=(CompositeEntity)graphModel.getRoot();
    MoMLChangeRequest change=new MoMLChangeRequest(this,toplevel,moml.toString());
    change.setUndoable(true);
    toplevel.requestChange(change);
  }
 catch (  Exception ex) {
    MessageHandler.error("String_Node_Str" + moml,ex);
  }
}

Fixed version (ground truth):
/** 
 * Delete the currently selected objects from this document.
 */
public void delete(){
  GraphPane graphPane=_jgraph.getGraphPane();
  GraphController controller=(GraphController)graphPane.getGraphController();
  SelectionModel model=controller.getSelectionModel();
  AbstractBasicGraphModel graphModel=(AbstractBasicGraphModel)controller.getGraphModel();
  Object selection[]=model.getSelectionAsArray();
  Object userObjects[]=new Object[selection.length];
  for (int i=0; i < selection.length; i++) {
    userObjects[i]=((Figure)selection[i]).getUserObject();
    model.removeSelection(selection[i]);
  }
  HashSet namedObjNodeSet=new HashSet();
  HashSet namedObjEdgeSet=new HashSet();
  HashSet edgeSet=new HashSet();
  StringBuffer moml=new StringBuffer();
  moml.append("String_Node_Str");
  for (int i=0; i < selection.length; i++) {
    Object userObject=userObjects[i];
    if (graphModel.isEdge(userObject)) {
      NamedObj actual=(NamedObj)graphModel.getSemanticObject(userObject);
      if (actual != null) {
        moml.append(graphModel.getDeleteEdgeMoML(userObject));
      }
 else {
        edgeSet.add(userObject);
      }
    }
  }
  for (int i=0; i < selection.length; i++) {
    Object userObject=userObjects[i];
    if (graphModel.isNode(userObject)) {
      moml.append(graphModel.getDeleteNodeMoML(userObject));
    }
  }
  moml.append("String_Node_Str");
  try {
    graphModel.setDispatchEnabled(false);
    Iterator edges=edgeSet.iterator();
    while (edges.hasNext()) {
      Object nextEdge=edges.next();
      if (graphModel.isEdge(nextEdge)) {
        graphModel.disconnectEdge(this,nextEdge);
      }
    }
  }
  finally {
    graphModel.setDispatchEnabled(true);
  }
  try {
    NamedObj object=(NamedObj)graphModel.getRoot();
    NamedObj container=MoMLChangeRequest.getDeferredToParent(object);
    if (container == null) {
      container=(NamedObj)object.getContainer();
    }
    if (container == null) {
      container=object;
    }
    CompositeEntity toplevel=(CompositeEntity)container;
    MoMLChangeRequest change=new MoMLChangeRequest(this,toplevel,moml.toString());
    change.setUndoable(true);
    toplevel.requestChange(change);
  }
 catch (  Exception ex) {
    MessageHandler.error("String_Node_Str" + moml,ex);
  }
  graphModel.dispatchGraphEvent(new GraphEvent(this,GraphEvent.STRUCTURE_CHANGED,graphModel.getRoot()));
}