Program: 76605
Project: 76605
Buggy source:
/** 
 * Create receivers for this port. This method should only be  called on input ports. It should also normally only be called  in the prefire method. It is <i>not</i> synchronized on the workspace, so the caller should be. This is because obaining write access  increases the version number of the workspace, which  invalidates any previous cached information in the workspace.
 * @exception IllegalActionException Thrown if this port is not an opaque input port or if there is no director. FIXME: perhaps we need to use writeAccess?
 */
public void createReceivers() throws IllegalActionException {
  if (!(isInput() && isOpaque())) {
    String message="String_Node_Str";
    message+="String_Node_Str";
    throw new IllegalActionException(this,message);
  }
  int portWidth=getWidth();
  if (portWidth <= 0)   return;
  boolean changed=false;
  if (_localReceiversTable == null) {
    _localReceiversTable=new Hashtable();
  }
  Enumeration relations=linkedRelations();
  while (relations.hasMoreElements()) {
    IORelation relation=(IORelation)relations.nextElement();
    boolean insideLink=isInsideLinked(relation);
    int width=relation.getWidth();
    Receiver[][] result=(Receiver[][])_localReceiversTable.get(relation);
    if (result.length != width) {
      changed=true;
      if (insideLink) {
        for (int i=0; i < width; i++) {
          result[i][0]=_newInsideReceiver();
        }
      }
 else {
        for (int i=0; i < width; i++) {
          result[i][0]=_newReceiver();
        }
      }
      _localReceiversTable.put(relation,result);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create receivers for this port. This method should only be  called on input ports. It should also normally only be called  in the prefire method. It is <i>not</i> synchronized on the workspace, so the caller should be. This is because obaining write access  increases the version number of the workspace, which  invalidates any previous cached information in the workspace.
 * @exception IllegalActionException Thrown if this port is not an opaque input port or if there is no director. FIXME: perhaps we need to use writeAccess?
 */
public void createReceivers() throws IllegalActionException {
  if (!(isInput() && isOpaque())) {
    String message="String_Node_Str";
    message+="String_Node_Str";
    throw new IllegalActionException(this,message);
  }
  System.out.println("String_Node_Str");
  int portWidth=getWidth();
  if (portWidth <= 0)   return;
  boolean changed=false;
  if (_localReceiversTable == null) {
    _localReceiversTable=new Hashtable();
  }
  Enumeration relations=linkedRelations();
  while (relations.hasMoreElements()) {
    IORelation relation=(IORelation)relations.nextElement();
    boolean insideLink=isInsideLinked(relation);
    int width=relation.getWidth();
    Receiver[][] result=null;
    if (_localReceiversTable.containsKey(relation)) {
      result=(Receiver[][])_localReceiversTable.get(relation);
    }
    if ((result == null) || (result.length != width)) {
      changed=true;
      result=new Receiver[width][1];
      if (insideLink) {
        for (int i=0; i < width; i++) {
          result[i][0]=_newInsideReceiver();
        }
      }
 else {
        for (int i=0; i < width; i++) {
          System.out.println("String_Node_Str");
          result[i][0]=_newReceiver();
        }
      }
      _localReceiversTable.put(relation,result);
    }
  }
}