Program: 72917
Project: 72917
Buggy source:
public String generateInitializeCode() throws IllegalActionException {
  CodeStream codeStream=_templateParser.getCodeStream();
  codeStream.clear();
  LinkedList args=new LinkedList();
  Parameter stopTime=((ptolemy.actor.lib.DiscreteClock)getComponent()).stopTime;
  double doubleStopTime=((DoubleToken)stopTime.getToken()).doubleValue();
  ptolemy.actor.lib.DiscreteClock actor=(ptolemy.actor.lib.DiscreteClock)getComponent();
  ptolemy.actor.CompositeActor container=(ptolemy.actor.CompositeActor)actor.getContainer();
  ptolemy.actor.Director director=container.getDirector();
  double modelStopTime=director.getModelStopTime().getDoubleValue();
  if (doubleStopTime > modelStopTime)   doubleStopTime=modelStopTime;
  Parameter period=((ptolemy.actor.lib.DiscreteClock)getComponent()).period;
  double doublePeriod=((DoubleToken)period.getToken()).doubleValue();
  args.add(Double.toString(doubleStopTime));
  args.add(Double.toString(doublePeriod));
  Parameter offsetPar=((ptolemy.actor.lib.DiscreteClock)getComponent()).offsets;
  Token offsetToken=offsetPar.getToken();
  Token[] offsets;
  double[] offsetsDouble=null;
  int size=0;
  if (offsetToken instanceof ArrayToken) {
    offsets=((ArrayToken)offsetToken).arrayValue();
    size=offsets.length;
    args.add(Integer.toString(size));
    int i=0;
    if (size > 0) {
      if (offsets[0] instanceof DoubleToken) {
        offsetsDouble=new double[size];
      }
 else {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
    }
    for (    Token t : offsets) {
      if (t instanceof DoubleToken) {
        offsetsDouble[i++]=((DoubleToken)t).doubleValue();
      }
 else {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
 else {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  String offsetsString="String_Node_Str";
  int i=0;
  for (  double offset : offsetsDouble)   offsetsString+="String_Node_Str" + i++ + "String_Node_Str"+ Double.toString(offset)+ "String_Node_Str";
  args.add(offsetsString);
  Parameter valuesPar=((ptolemy.actor.lib.DiscreteClock)getComponent()).values;
  Token valuesToken=valuesPar.getToken();
  Token[] values;
  double[] valuesDouble=null;
  int[] valuesInt=null;
  boolean[] valuesBool=null;
  size=0;
  if (valuesToken instanceof ArrayToken) {
    values=((ArrayToken)valuesToken).arrayValue();
    size=values.length;
    args.add(Integer.toString(size));
    i=0;
    if (size > 0) {
      if (values[0] instanceof DoubleToken) {
        valuesDouble=new double[size];
      }
 else       if (values[0] instanceof IntToken) {
        valuesInt=new int[size];
      }
 else       if (values[0] instanceof BooleanToken) {
        valuesBool=new boolean[size];
      }
 else {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
    }
    for (    Token t : values) {
      if (t instanceof DoubleToken) {
        valuesDouble[i++]=((DoubleToken)t).doubleValue();
      }
 else       if (t instanceof IntToken) {
        valuesInt[i++]=((IntToken)t).intValue();
      }
 else       if (t instanceof BooleanToken) {
        valuesBool[i++]=((BooleanToken)t).booleanValue();
      }
 else {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
 else {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  String valuesString="String_Node_Str";
  i=0;
  if (valuesDouble != null)   for (  double value : valuesDouble)   valuesString+="String_Node_Str" + i++ + "String_Node_Str"+ Double.toString(value)+ "String_Node_Str";
 else   if (valuesInt != null)   for (  int value : valuesInt)   valuesString+="String_Node_Str" + i++ + "String_Node_Str"+ Integer.toString(value)+ "String_Node_Str";
 else   if (valuesBool != null)   for (  boolean value : valuesBool)   valuesString+="String_Node_Str" + i++ + "String_Node_Str"+ Boolean.toString(value)+ "String_Node_Str";
  args.add(valuesString);
  codeStream.appendCodeBlock("String_Node_Str",args);
  if (((ptolemy.actor.lib.DiscreteClock)getComponent()).start.isOutsideConnected()) {
    codeStream.appendCodeBlock("String_Node_Str");
  }
  return processCode(codeStream.toString());
}

Fixed version (ground truth):
public String generateInitializeCode() throws IllegalActionException {
  CodeStream codeStream=_templateParser.getCodeStream();
  codeStream.clear();
  LinkedList args=new LinkedList();
  Parameter stopTime=((ptolemy.actor.lib.DiscreteClock)getComponent()).stopTime;
  double doubleStopTime=((DoubleToken)stopTime.getToken()).doubleValue();
  ptolemy.actor.lib.DiscreteClock actor=(ptolemy.actor.lib.DiscreteClock)getComponent();
  ptolemy.actor.CompositeActor container=(ptolemy.actor.CompositeActor)actor.getContainer();
  ptolemy.actor.Director director=container.getDirector();
  double modelStopTime=director.getModelStopTime().getDoubleValue();
  if (doubleStopTime > modelStopTime)   doubleStopTime=modelStopTime;
  Parameter period=((ptolemy.actor.lib.DiscreteClock)getComponent()).period;
  double doublePeriod=((DoubleToken)period.getToken()).doubleValue();
  args.add(Double.toString(doubleStopTime));
  args.add(Double.toString(doublePeriod));
  Parameter offsetPar=((ptolemy.actor.lib.DiscreteClock)getComponent()).offsets;
  Token offsetToken=offsetPar.getToken();
  Token[] offsets;
  double[] offsetsDouble=null;
  int size=0;
  if (offsetToken instanceof ArrayToken) {
    offsets=((ArrayToken)offsetToken).arrayValue();
    size=offsets.length;
    args.add(Integer.toString(size));
    int i=0;
    if (size > 0) {
      if (offsets[0] instanceof DoubleToken) {
        offsetsDouble=new double[size];
      }
 else {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
    }
    for (    Token t : offsets) {
      if (t instanceof DoubleToken) {
        offsetsDouble[i++]=((DoubleToken)t).doubleValue();
      }
 else {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
 else {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  StringBuffer offsetsString=new StringBuffer();
  int i=0;
  for (  double offset : offsetsDouble)   offsetsString.append("String_Node_Str" + i++ + "String_Node_Str"+ Double.toString(offset)+ "String_Node_Str"+ _eol);
  args.add(offsetsString);
  Parameter valuesPar=((ptolemy.actor.lib.DiscreteClock)getComponent()).values;
  Token valuesToken=valuesPar.getToken();
  Token[] values;
  double[] valuesDouble=null;
  int[] valuesInt=null;
  boolean[] valuesBool=null;
  size=0;
  if (valuesToken instanceof ArrayToken) {
    values=((ArrayToken)valuesToken).arrayValue();
    size=values.length;
    args.add(Integer.toString(size));
    i=0;
    if (size > 0) {
      if (values[0] instanceof DoubleToken) {
        valuesDouble=new double[size];
      }
 else       if (values[0] instanceof IntToken) {
        valuesInt=new int[size];
      }
 else       if (values[0] instanceof BooleanToken) {
        valuesBool=new boolean[size];
      }
 else {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
    }
    for (    Token t : values) {
      if (t instanceof DoubleToken) {
        valuesDouble[i++]=((DoubleToken)t).doubleValue();
      }
 else       if (t instanceof IntToken) {
        valuesInt[i++]=((IntToken)t).intValue();
      }
 else       if (t instanceof BooleanToken) {
        valuesBool[i++]=((BooleanToken)t).booleanValue();
      }
 else {
        throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
      }
    }
  }
 else {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  String valuesString="String_Node_Str";
  i=0;
  if (valuesDouble != null)   for (  double value : valuesDouble)   valuesString+="String_Node_Str" + i++ + "String_Node_Str"+ Double.toString(value)+ "String_Node_Str";
 else   if (valuesInt != null)   for (  int value : valuesInt)   valuesString+="String_Node_Str" + i++ + "String_Node_Str"+ Integer.toString(value)+ "String_Node_Str";
 else   if (valuesBool != null)   for (  boolean value : valuesBool)   valuesString+="String_Node_Str" + i++ + "String_Node_Str"+ Boolean.toString(value)+ "String_Node_Str";
  args.add(valuesString);
  codeStream.appendCodeBlock("String_Node_Str",args);
  if (((ptolemy.actor.lib.DiscreteClock)getComponent()).start.isOutsideConnected()) {
    codeStream.appendCodeBlock("String_Node_Str");
  }
  return processCode(codeStream.toString());
}