Program: 73628
Project: 73628
Buggy source:
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableDeclaration() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  CompositeActor container=(CompositeActor)_director.getContainer();
  GenericCodeGenerator codeGenerator=getCodeGenerator();
{
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(container);
    code.append(_generateVariableDeclaration(adapterObject));
  }
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    if (actor instanceof CompositeActor) {
      code.append(adapterObject.generateVariableDeclaration());
    }
 else {
      code.append(_generateVariableDeclaration(adapterObject));
    }
  }
  ptolemy.actor.sched.StaticSchedulingDirector director=(ptolemy.actor.sched.StaticSchedulingDirector)getComponent();
  Schedule schedule=director.getScheduler().getSchedule();
  Iterator<?> actorsToFire=schedule.firingIterator();
  while (actorsToFire.hasNext()) {
    Firing firing=(Firing)actorsToFire.next();
    Actor actor=firing.getActor();
    if (actor instanceof ModularCodeGenTypedCompositeActor || actor instanceof ModularCompiledSDFTypedCompositeActor) {
      String className=NamedProgramCodeGeneratorAdapter.generateName((NamedObj)actor);
      String actorName=ModularCodeGenTypedCompositeActor.classToActorName(className);
      code.append(className + "String_Node_Str" + actorName+ "String_Node_Str"+ _eol);
    }
  }
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate variable declarations for inputs and outputs and parameters. Append the declarations to the given string buffer.
 * @return code The generated code.
 * @exception IllegalActionException If the adapter class for the modeldirector cannot be found.
 */
@Override public String generateVariableDeclaration() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  CompositeActor container=(CompositeActor)_director.getContainer();
  GenericCodeGenerator codeGenerator=getCodeGenerator();
{
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(container);
    code.append(_generateVariableDeclaration(adapterObject));
  }
  Iterator<?> actors=container.deepEntityList().iterator();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    NamedProgramCodeGeneratorAdapter adapterObject=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    if (actor instanceof CompositeActor && !(actor instanceof ModularCodeGenTypedCompositeActor)) {
      code.append(adapterObject.generateVariableDeclaration());
    }
 else {
      code.append(_generateVariableDeclaration(adapterObject));
    }
  }
  ptolemy.actor.sched.StaticSchedulingDirector director=(ptolemy.actor.sched.StaticSchedulingDirector)getComponent();
  Schedule schedule=director.getScheduler().getSchedule();
  Iterator<?> actorsToFire=schedule.firingIterator();
  while (actorsToFire.hasNext()) {
    Firing firing=(Firing)actorsToFire.next();
    Actor actor=firing.getActor();
    if (actor instanceof ModularCodeGenTypedCompositeActor || actor instanceof ModularCompiledSDFTypedCompositeActor) {
      String className=NamedProgramCodeGeneratorAdapter.generateName((NamedObj)actor);
      String actorName=ModularCodeGenTypedCompositeActor.classToActorName(className);
      code.append(className + "String_Node_Str" + actorName+ "String_Node_Str"+ _eol);
    }
  }
  return code.toString();
}