Program: 75477
Project: 75477
Buggy source:
/** 
 * Set the value of the shadow variables for the channel of the port. If the specified port is not an input port, then do nothing.
 * @see #_createInputVariables(IOPort port)
 * @param port An input port of this actor.
 * @param channel A channel of the input port.
 * @exception IllegalActionException If the port is not contained bythis actor, or if the shadow variable cannot take the token read from the channel (should not occur).
 */
protected void _setInputVariables(IOPort port,int channel) throws IllegalActionException {
  if (port.getContainer() != this) {
    throw new IllegalActionException(this,port,"String_Node_Str" + "String_Node_Str");
  }
  if (!port.isInput()) {
    return;
  }
  int width=port.getWidth();
  Variable[][] shadowVariables=(Variable[][])_inputVariableMap.get(port);
  if (shadowVariables == null) {
    throw new InternalErrorException(getName() + "String_Node_Str" + "String_Node_Str"+ port.getName()+ "String_Node_Str");
  }
  if (port.isKnown(channel)) {
    int portRate=SDFScheduler.getTokenConsumptionRate(port);
    if (_debug_info) {
      System.out.println(port.getName() + "String_Node_Str" + portRate);
    }
    Token[] hdfArray=new Token[portRate];
    for (int i=0; i < portRate; i++) {
      hdfArray[i]=new IntToken(0);
    }
    int index=0;
    while (index < portRate && port.hasToken(channel)) {
      shadowVariables[channel][0].setToken(BooleanToken.TRUE);
      Token token=port.get(channel);
      if (_debugging) {
        _debug("String_Node_Str",port.getName(),"String_Node_Str" + channel + "String_Node_Str",token.toString());
      }
      hdfArray[index]=token;
      if (_debug_info) {
        System.out.println("String_Node_Str" + index + "String_Node_Str"+ hdfArray[index].toString());
      }
      index++;
    }
    if (index > 0) {
      shadowVariables[channel][1].setToken(hdfArray[index - 1]);
      shadowVariables[channel][2].setToken(new ArrayToken(hdfArray));
      if (_debug_info) {
        System.out.println("String_Node_Str" + hdfArray[index - 1].toString());
      }
    }
 else {
      shadowVariables[channel][0].setToken(BooleanToken.FALSE);
      if (_debugging) {
        _debug("String_Node_Str",port.getName(),"String_Node_Str" + channel + "String_Node_Str");
      }
    }
  }
 else {
    shadowVariables[channel][0].setUnknown(true);
    shadowVariables[channel][1].setUnknown(true);
    shadowVariables[channel][2].setUnknown(true);
  }
}

Fixed version (ground truth):
/** 
 * Set the value of the shadow variables for the channel of the port. If the specified port is not an input port, then do nothing.
 * @see #_createInputVariables(IOPort port)
 * @param port An input port of this actor.
 * @param channel A channel of the input port.
 * @exception IllegalActionException If the port is not contained bythis actor, or if the shadow variable cannot take the token read from the channel (should not occur).
 */
protected void _setInputVariables(IOPort port,int channel) throws IllegalActionException {
  if (port.getContainer() != this) {
    throw new IllegalActionException(this,port,"String_Node_Str" + "String_Node_Str");
  }
  if (!port.isInput()) {
    return;
  }
  int width=port.getWidth();
  Variable[][] shadowVariables=(Variable[][])_inputVariableMap.get(port);
  if (shadowVariables == null) {
    throw new InternalErrorException(getName() + "String_Node_Str" + "String_Node_Str"+ port.getName()+ "String_Node_Str");
  }
  if (port.isKnown(channel)) {
    int portRate=SDFScheduler.getTokenConsumptionRate(port);
    if (_debug_info) {
      System.out.println(port.getName() + "String_Node_Str" + portRate);
    }
    Token[] hdfArray=new Token[portRate];
    int index=0;
    while (port.hasToken(channel)) {
      shadowVariables[channel][0].setToken(BooleanToken.TRUE);
      Token token=port.get(channel);
      if (index < portRate) {
        if (_debugging) {
          _debug("String_Node_Str",port.getName(),"String_Node_Str" + channel + "String_Node_Str",token.toString());
        }
        hdfArray[index]=token;
        if (_debug_info) {
          System.out.println("String_Node_Str" + index + "String_Node_Str"+ hdfArray[index].toString());
        }
        index++;
      }
    }
    if (index > 0) {
      shadowVariables[channel][1].setToken(hdfArray[index - 1]);
      shadowVariables[channel][2].setToken(new ArrayToken(hdfArray));
      if (_debug_info) {
        System.out.println("String_Node_Str" + hdfArray[index - 1].toString());
      }
    }
 else {
      shadowVariables[channel][0].setToken(BooleanToken.FALSE);
      if (_debugging) {
        _debug("String_Node_Str",port.getName(),"String_Node_Str" + channel + "String_Node_Str");
      }
    }
  }
 else {
    shadowVariables[channel][0].setUnknown(true);
    shadowVariables[channel][1].setUnknown(true);
    shadowVariables[channel][2].setUnknown(true);
  }
}