Program: 74842
Project: 74842
Buggy source:
/** 
 * Create new receivers for this port, replacing any that may previously exist, and validate any instances of Settable that this port may contain. This method should only be called on opaque ports. <p> If the port is an input port, receivers are created as necessary for each relation connecting to the port from the outside. If the port is an output port, receivers are created as necessary for each relation connected to the port from the inside. Note that only composite entities will have relations connecting to ports from the inside. <p> Note that it is perfectly allowable for a zero width output port to have insideReceivers.  This can be used to allow a model to be embedded in a container that does not connect the port to anything. <p> This method is <i>not</i> write-synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException If this port is notan opaque input port or if there is no director.
 */
public void createReceivers() throws IllegalActionException {
  if (!isOpaque()) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  if (_debugging) {
    _debug("String_Node_Str");
  }
  if (_localReceiversTable != null) {
    Iterator relations=_localReceiversTable.keySet().iterator();
    while (relations.hasNext()) {
      Relation relation=(Relation)relations.next();
      _removeReceivers(relation);
    }
  }
  _localReceiversTable=new HashMap();
  boolean input=isInput();
  boolean output=isOutput();
  if (input) {
    Iterator outsideRelations=linkedRelationList().iterator();
    int myWidth=getWidth();
    boolean madeOne=false;
    while (outsideRelations.hasNext()) {
      IORelation relation=(IORelation)outsideRelations.next();
      if (relation != null) {
        int width=relation.getWidth();
        if (!madeOne && (myWidth == 1) && (width > 1)) {
          width=1;
        }
        Receiver[][] result=new Receiver[width][1];
        for (int i=0; i < width; i++) {
          result[i][0]=_newReceiver();
          madeOne=true;
        }
        if (_localReceiversTable.containsKey(relation)) {
          List occurrences=(List)(_localReceiversTable.get(relation));
          occurrences.add(result);
        }
 else {
          List occurrences=new LinkedList();
          occurrences.add(result);
          _localReceiversTable.put(relation,occurrences);
        }
        if ((myWidth == 1) && madeOne) {
          break;
        }
      }
    }
  }
  if (output) {
    Iterator insideRelations=insideRelationList().iterator();
    while (insideRelations.hasNext()) {
      IORelation relation=(IORelation)insideRelations.next();
      int width=relation.getWidth();
      Receiver[][] result=new Receiver[width][1];
      for (int i=0; i < width; i++) {
        result[i][0]=_newInsideReceiver();
      }
      if (_localReceiversTable.containsKey(relation)) {
        List occurrences=(List)(_localReceiversTable.get(relation));
        occurrences.add(result);
      }
 else {
        List occurrences=new LinkedList();
        occurrences.add(result);
        _localReceiversTable.put(relation,occurrences);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Create new receivers for this port, replacing any that may previously exist, and validate any instances of Settable that this port may contain. This method should only be called on opaque ports. <p> If the port is an input port, receivers are created as necessary for each relation connecting to the port from the outside. If the port is an output port, receivers are created as necessary for each relation connected to the port from the inside. Note that only composite entities will have relations connecting to ports from the inside. <p> Note that it is perfectly allowable for a zero width output port to have insideReceivers.  This can be used to allow a model to be embedded in a container that does not connect the port to anything. <p> This method is <i>not</i> write-synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException If this port is notan opaque input port or if there is no director.
 */
public void createReceivers() throws IllegalActionException {
  if (!isOpaque()) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  if (_debugging) {
    _debug("String_Node_Str");
  }
  if (_localReceiversTable != null) {
    Iterator relations=_localReceiversTable.keySet().iterator();
    while (relations.hasNext()) {
      Relation relation=(Relation)relations.next();
      _removeReceivers(relation);
    }
  }
  _localReceiversTable=new HashMap();
  _localReceiversVersion=-1;
  boolean input=isInput();
  boolean output=isOutput();
  if (input) {
    Iterator outsideRelations=linkedRelationList().iterator();
    int myWidth=getWidth();
    boolean madeOne=false;
    while (outsideRelations.hasNext()) {
      IORelation relation=(IORelation)outsideRelations.next();
      if (relation != null) {
        int width=relation.getWidth();
        if (!madeOne && (myWidth == 1) && (width > 1)) {
          width=1;
        }
        Receiver[][] result=new Receiver[width][1];
        for (int i=0; i < width; i++) {
          result[i][0]=_newReceiver();
          madeOne=true;
        }
        if (_localReceiversTable.containsKey(relation)) {
          List occurrences=(List)(_localReceiversTable.get(relation));
          occurrences.add(result);
        }
 else {
          List occurrences=new LinkedList();
          occurrences.add(result);
          _localReceiversTable.put(relation,occurrences);
        }
        if ((myWidth == 1) && madeOne) {
          break;
        }
      }
    }
  }
  if (output) {
    Iterator insideRelations=insideRelationList().iterator();
    while (insideRelations.hasNext()) {
      IORelation relation=(IORelation)insideRelations.next();
      int width=relation.getWidth();
      Receiver[][] result=new Receiver[width][1];
      for (int i=0; i < width; i++) {
        result[i][0]=_newInsideReceiver();
      }
      if (_localReceiversTable.containsKey(relation)) {
        List occurrences=(List)(_localReceiversTable.get(relation));
        occurrences.add(result);
      }
 else {
        List occurrences=new LinkedList();
        occurrences.add(result);
        _localReceiversTable.put(relation,occurrences);
      }
    }
  }
}