Program: 75880
Project: 75880
Buggy source:
/** 
 * Connect the given edge to the given tail node. This class queues a new change request with the ptolemy model to make this modification.
 * @param edge The edge, which is assumed to be a link.
 * @param tail The new tail for the edge, which is assumed tobe a location representing a port, a port or a vertex.
 */
public void setTail(final Object edge,final Object newLinkTail){
  final Link link=(Link)edge;
  final NamedObj linkHead=(NamedObj)link.getHead();
  final NamedObj linkTail=(NamedObj)link.getTail();
  Relation linkRelation=(Relation)link.getRelation();
  final StringBuffer moml=new StringBuffer();
  final StringBuffer failmoml=new StringBuffer();
  moml.append("String_Node_Str");
  failmoml.append("String_Node_Str");
  final CompositeEntity container=(CompositeEntity)getChangeRequestParent(getToplevel());
  String relationName="String_Node_Str";
  try {
    _unlinkMoML(container,moml,linkHead,linkTail,linkRelation);
    relationName=_linkMoML(container,moml,failmoml,linkHead,(NamedObj)newLinkTail);
  }
 catch (  Exception ex) {
    _linkSet.remove(link);
    link.setHead(null);
    link.setTail(null);
    dispatchGraphEvent(new GraphEvent(PtolemyGraphModel.this,GraphEvent.STRUCTURE_CHANGED,getRoot()));
  }
  moml.append("String_Node_Str");
  failmoml.append("String_Node_Str");
  final String relationNameToAdd=relationName;
  ChangeRequest request=new MoMLChangeRequest(PtolemyGraphModel.this,container,moml.toString()){
    protected void _execute() throws Exception {
      super._execute();
      link.setTail(newLinkTail);
      if (relationNameToAdd != null) {
        ComponentRelation relation=(ComponentRelation)container.getRelation(relationNameToAdd);
        link.setRelation(relation);
      }
 else {
        link.setRelation(null);
      }
    }
  }
;
  request.addChangeListener(new LinkChangeListener(link,container,failmoml));
  container.requestChange(request);
}

Fixed version (ground truth):
/** 
 * Connect the given edge to the given tail node. This class queues a new change request with the ptolemy model to make this modification.
 * @param edge The edge, which is assumed to be a link.
 * @param tail The new tail for the edge, which is assumed tobe a location representing a port, a port or a vertex.
 */
public void setTail(final Object edge,final Object newLinkTail){
  final Link link=(Link)edge;
  final NamedObj linkHead=(NamedObj)link.getHead();
  final NamedObj linkTail=(NamedObj)link.getTail();
  Relation linkRelation=(Relation)link.getRelation();
  final StringBuffer moml=new StringBuffer();
  final StringBuffer failmoml=new StringBuffer();
  moml.append("String_Node_Str");
  failmoml.append("String_Node_Str");
  final CompositeEntity container=(CompositeEntity)getChangeRequestParent(getToplevel());
  String relationName="String_Node_Str";
  try {
    _unlinkMoML(container,moml,linkHead,linkTail,linkRelation);
    relationName=_linkMoML(container,moml,failmoml,linkHead,(NamedObj)newLinkTail);
  }
 catch (  Exception ex) {
    _linkSet.remove(link);
    link.setHead(null);
    link.setTail(null);
    dispatchGraphEvent(new GraphEvent(PtolemyGraphModel.this,GraphEvent.STRUCTURE_CHANGED,getRoot()));
  }
  moml.append("String_Node_Str");
  failmoml.append("String_Node_Str");
  final String relationNameToAdd=relationName;
  ChangeRequest request=new MoMLChangeRequest(PtolemyGraphModel.this,container,moml.toString()){
    protected void _execute() throws Exception {
      super._execute();
      link.setTail(newLinkTail);
      if (relationNameToAdd != null) {
        ComponentRelation relation=(ComponentRelation)container.getRelation(relationNameToAdd);
        if (relation == null)         throw new InternalErrorException("String_Node_Str" + relationNameToAdd + "String_Node_Str"+ container);
        link.setRelation(relation);
      }
 else {
        link.setRelation(null);
      }
    }
  }
;
  request.addChangeListener(new LinkChangeListener(link,container,failmoml));
  container.requestChange(request);
}