Program: 73170
Project: 73170
Buggy source:
/** 
 * Set the local director for execution of this CompositeActor. This should not be called be directly.  Instead, call setContainer() on the director.  This method removes any previous director from this container, and caches a local reference to the director so that this composite does not need to search its attributes each time the director is accessed.
 * @param director The Director responsible for execution.
 * @exception IllegalActionException If removing the old directorcauses this to be thrown. Should not be thrown.
 * @exception NameDuplicationException If removing the old directorcauses this to be thrown. Should not be thrown.
 */
protected void _setDirector(Director director) throws IllegalActionException, NameDuplicationException {
  Director oldDirector=getDirector();
  if (director != oldDirector) {
    if (oldDirector != null) {
      oldDirector.invalidateSchedule();
      oldDirector.invalidateResolvedTypes();
    }
    if (director == null || oldDirector == null) {
      _notifyHierarchyListenersBeforeChange();
    }
    _director=director;
    try {
      if (director != null) {
        director.invalidateSchedule();
        director.invalidateResolvedTypes();
      }
 else {
        Director executiveDirector=getExecutiveDirector();
        if (executiveDirector != null) {
          executiveDirector.invalidateSchedule();
        }
      }
    }
  finally {
      if (director == null || oldDirector == null) {
        _notifyHierarchyListenersBeforeChange();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Set the local director for execution of this CompositeActor. This should not be called be directly.  Instead, call setContainer() on the director.  This method removes any previous director from this container, and caches a local reference to the director so that this composite does not need to search its attributes each time the director is accessed.
 * @param director The Director responsible for execution.
 * @exception IllegalActionException If removing the old directorcauses this to be thrown. Should not be thrown.
 * @exception NameDuplicationException If removing the old directorcauses this to be thrown. Should not be thrown.
 */
protected void _setDirector(Director director) throws IllegalActionException, NameDuplicationException {
  Director oldDirector=getDirector();
  if (director != oldDirector) {
    if (oldDirector != null) {
      oldDirector.invalidateSchedule();
      oldDirector.invalidateResolvedTypes();
    }
  }
  if (director != _director) {
    if (director == null || oldDirector == null) {
      _notifyHierarchyListenersBeforeChange();
    }
  }
  Director previousLocalDirector=_director;
  try {
    if (director != oldDirector) {
      _director=director;
      if (director != null) {
        director.invalidateSchedule();
        director.invalidateResolvedTypes();
      }
 else {
        Director executiveDirector=getExecutiveDirector();
        if (executiveDirector != null) {
          executiveDirector.invalidateSchedule();
        }
      }
    }
  }
  finally {
    if (director == null || previousLocalDirector == null) {
      _notifyHierarchyListenersAfterChange();
    }
  }
}