Program: 72910
Project: 72910
Buggy source:
/** 
 * Generate and write the code for a composite actor. This method is called recursively, for any composite actor present in the model. There are 5 phases in this method : First we initialize the parameters for the container Then we generate and write the code for the container Then we call the generation for each contained actor Then we call the generation for the director Finally we generate the makefile corresponding
 * @param container The actor that needs to be generated
 * @param containerDirectory A string describing where to write the files
 * @exception IllegalActionException If anything goes wrong during the generation.
 */
protected void _generateAndWriteCompositeActorCode(CompositeEntity container,String containerDirectory) throws IllegalActionException {
  Director director=null;
  if (container instanceof CompositeActor)   director=((CompositeActor)container).getDirector();
 else   throw new IllegalActionException(container,"String_Node_Str" + container.getFullName());
  Attribute generateEmbeddedCode=getAttribute("String_Node_Str");
  if (generateEmbeddedCode instanceof Parameter) {
    ((Parameter)generateEmbeddedCode).setExpression("String_Node_Str");
  }
  if (container instanceof ptolemy.cg.lib.CompiledCompositeActor) {
    if (generateEmbeddedCode instanceof Parameter)     ((Parameter)generateEmbeddedCode).setExpression("String_Node_Str");
  }
  boolean inlineValue=((BooleanToken)inline.getToken()).booleanValue();
  if (inlineValue && director != null && director instanceof DEDirector) {
    throw new IllegalActionException("String_Node_Str");
  }
  String directory=codeDirectory.stringValue();
  if (!directory.endsWith("String_Node_Str"))   directory+="String_Node_Str";
  String sanitizedContainerName=container.getName();
  containerDirectory+="String_Node_Str" + sanitizedContainerName;
  String directorySrc=directory + "String_Node_Str" + containerDirectory;
  String directoryIncludes=directory + "String_Node_Str" + containerDirectory;
  String directoryBuild=directory + "String_Node_Str" + containerDirectory;
  if (new File(directorySrc).mkdirs() || new File(directoryIncludes).mkdirs() || new File(directoryBuild).mkdirs()) {
    directory+="String_Node_Str";
  }
  if (!_includes.contains("String_Node_Str" + directoryIncludes))   _includes.add("String_Node_Str" + directoryIncludes);
  _generateAndWriteActorCode(container,(NamedProgramCodeGeneratorAdapter)getAdapter(director),container,directoryIncludes,directorySrc);
  List actorList=container.deepEntityList();
  Iterator<?> actors=actorList.iterator();
  while (actors.hasNext()) {
    NamedObj actor=(NamedObj)actors.next();
    if (actor instanceof ModalController)     continue;
 else     if (actor instanceof AtomicActor || actor instanceof FSMActor)     _generateAndWriteActorCode(actor,(NamedProgramCodeGeneratorAdapter)getAdapter(director),container,directoryIncludes,directorySrc);
 else     if (actor instanceof CompositeEntity)     _generateAndWriteCompositeActorCode((CompositeEntity)actor,containerDirectory);
 else     if (actor instanceof State)     for (    TypedActor act : ((State)actor).getRefinement()) {
      Refinement r=(Refinement)act;
      _generateAndWriteCompositeActorCode(r,containerDirectory);
    }
 else     throw new IllegalActionException(container,"String_Node_Str" + actor.getFullName());
  }
  _generateAndWriteDirectorCode(director,directoryIncludes,directorySrc);
}

Fixed version (ground truth):
/** 
 * Generate and write the code for a composite actor. This method is called recursively, for any composite actor present in the model. There are 5 phases in this method : First we initialize the parameters for the container Then we generate and write the code for the container Then we call the generation for each contained actor Then we call the generation for the director Finally we generate the makefile corresponding
 * @param container The actor that needs to be generated
 * @param containerDirectory A string describing where to write the files
 * @exception IllegalActionException If anything goes wrong during the generation.
 */
protected void _generateAndWriteCompositeActorCode(CompositeEntity container,String containerDirectory) throws IllegalActionException {
  Director director=null;
  if (container instanceof CompositeActor)   director=((CompositeActor)container).getDirector();
 else   throw new IllegalActionException(container,"String_Node_Str" + container.getFullName());
  Attribute generateEmbeddedCode=getAttribute("String_Node_Str");
  if (generateEmbeddedCode instanceof Parameter) {
    ((Parameter)generateEmbeddedCode).setExpression("String_Node_Str");
  }
  if (container instanceof ptolemy.cg.lib.CompiledCompositeActor) {
    if (generateEmbeddedCode instanceof Parameter)     ((Parameter)generateEmbeddedCode).setExpression("String_Node_Str");
  }
  boolean inlineValue=((BooleanToken)inline.getToken()).booleanValue();
  if (inlineValue && director != null && director instanceof DEDirector) {
    throw new IllegalActionException("String_Node_Str");
  }
  String directory=codeDirectory.stringValue();
  if (!directory.endsWith("String_Node_Str"))   directory+="String_Node_Str";
  String sanitizedContainerName=container.getName();
  containerDirectory+="String_Node_Str" + sanitizedContainerName;
  String directorySrc=directory + "String_Node_Str" + containerDirectory;
  String directoryIncludes=directory + "String_Node_Str" + containerDirectory;
  String directoryBuild=directory + "String_Node_Str" + containerDirectory;
  if (new File(directorySrc).mkdirs() && new File(directoryIncludes).mkdirs() && new File(directoryBuild).mkdirs()) {
    directory+="String_Node_Str";
  }
  if (!_includes.contains("String_Node_Str" + directoryIncludes))   _includes.add("String_Node_Str" + directoryIncludes);
  _generateAndWriteActorCode(container,(NamedProgramCodeGeneratorAdapter)getAdapter(director),container,directoryIncludes,directorySrc);
  List actorList=container.deepEntityList();
  Iterator<?> actors=actorList.iterator();
  while (actors.hasNext()) {
    NamedObj actor=(NamedObj)actors.next();
    if (actor instanceof ModalController)     continue;
 else     if (actor instanceof AtomicActor || actor instanceof FSMActor)     _generateAndWriteActorCode(actor,(NamedProgramCodeGeneratorAdapter)getAdapter(director),container,directoryIncludes,directorySrc);
 else     if (actor instanceof CompositeEntity)     _generateAndWriteCompositeActorCode((CompositeEntity)actor,containerDirectory);
 else     if (actor instanceof State)     for (    TypedActor act : ((State)actor).getRefinement()) {
      Refinement r=(Refinement)act;
      _generateAndWriteCompositeActorCode(r,containerDirectory);
    }
 else     throw new IllegalActionException(container,"String_Node_Str" + actor.getFullName());
  }
  _generateAndWriteDirectorCode(director,directoryIncludes,directorySrc);
}