Program: 74511
Project: 74511
Buggy source:
/** 
 * Return a list of derived objects. If the <i>propagate</i> argument is true, then this list will contain only those derived objects whose values are not overridden and that are not shadowed by objects whose values are overridden. Also, if that argument is true, then the value of this object is propagated to those returned objects during the construction of the list. This method is read-synchronized on the workspace. If the <i>force</i> argument is true, then if an expected derived object does not exist, then it is created by calling the _propagateExistence() protected method.
 * @param visited A set of objects that have previously beenvisited. This should be non-null only on the recursive calls to this method.
 * @param propagate True to propagate the value of this object(if any) to derived objects that have not been overridden while the list is being constructed.
 * @param force Force derived objects to exist where they shouldbe if they do not already exist.
 * @param context The context (this except in recursive calls).
 * @param depth The depth (0 except in recursive calls).
 * @param relativeName The name of the object relative to thecontext (null except in recursive calls).
 * @param override The list of override breadths (one per depth).If propagate is true, then this should be a list with a single Integer 0 for outside callers, and otherwise it should be null.
 * @return A list of instances of the same class as this objectwhich are derived from this object. The list is empty in this base class, but subclasses that override _getContainedObject() can return non-empty lists.
 * @exception IllegalActionException If propagate is trueand propagation fails.
 */
private List _getDerivedList(Collection visited,boolean propagate,boolean force,NamedObj context,int depth,List override,String relativeName) throws IllegalActionException {
  try {
    workspace().getReadAccess();
    LinkedList result=new LinkedList();
    if (visited == null) {
      visited=new HashSet();
    }
 else {
      if (visited.contains(context)) {
        return result;
      }
    }
    visited.add(context);
    NamedObj container=context.getContainer();
    if (container != null) {
      String newRelativeName;
      if (relativeName == null) {
        newRelativeName=context.getName();
      }
 else {
        newRelativeName=context.getName() + "String_Node_Str" + relativeName;
      }
      List newOverride=null;
      if (propagate) {
        newOverride=new LinkedList(override);
        if (newOverride.size() <= (depth + 1)) {
          newOverride.add(Integer.valueOf(0));
        }
      }
      result.addAll(_getDerivedList(visited,propagate,force,container,depth + 1,newOverride,newRelativeName));
    }
    if (!(context instanceof Instantiable)) {
      return result;
    }
    int myBreadth=0;
    if (propagate) {
      myBreadth=((Integer)override.get(depth)).intValue();
    }
    List othersList=((Instantiable)context).getChildren();
    if (othersList != null) {
      Iterator others=othersList.iterator();
      while (others.hasNext()) {
        WeakReference reference=(WeakReference)others.next();
        NamedObj other=(NamedObj)reference.get();
        if (other != null) {
          NamedObj candidate=other;
          if (relativeName != null) {
            candidate=_getContainedObject(other,relativeName);
          }
          if (candidate == null) {
            if (force) {
              NamedObj remoteContainer=other;
              int lastPeriod=relativeName.lastIndexOf("String_Node_Str");
              if (lastPeriod > 0) {
                String containerName=relativeName.substring(0,lastPeriod);
                remoteContainer=getContainer()._getContainedObject(other,containerName);
              }
              candidate=_propagateExistence(remoteContainer);
              candidate.setDerivedLevel(depth);
              candidate._markContentsDerived(depth);
              candidate._adjustOverride(depth);
            }
 else {
              continue;
            }
          }
          if (visited.contains(candidate)) {
            continue;
          }
          List newOverride=null;
          if (propagate) {
            newOverride=new LinkedList(override);
            newOverride.set(depth,Integer.valueOf(myBreadth + 1));
            if (_isShadowed(candidate._override,newOverride)) {
              continue;
            }
            _propagateValue(candidate);
            candidate._override=newOverride;
          }
          result.add(candidate);
          result.addAll(candidate._getDerivedList(visited,propagate,force,candidate,0,newOverride,null));
        }
      }
    }
    return result;
  }
  finally {
    workspace().doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Return a list of derived objects. If the <i>propagate</i> argument is true, then this list will contain only those derived objects whose values are not overridden and that are not shadowed by objects whose values are overridden. Also, if that argument is true, then the value of this object is propagated to those returned objects during the construction of the list. This method is read-synchronized on the workspace. If the <i>force</i> argument is true, then if an expected derived object does not exist, then it is created by calling the _propagateExistence() protected method.
 * @param visited A set of objects that have previously beenvisited. This should be non-null only on the recursive calls to this method.
 * @param propagate True to propagate the value of this object(if any) to derived objects that have not been overridden while the list is being constructed.
 * @param force Force derived objects to exist where they shouldbe if they do not already exist.
 * @param context The context (this except in recursive calls).
 * @param depth The depth (0 except in recursive calls).
 * @param relativeName The name of the object relative to thecontext (null except in recursive calls).
 * @param override The list of override breadths (one per depth).If propagate is true, then this should be a list with a single Integer 0 for outside callers, and otherwise it should be null.
 * @return A list of instances of the same class as this objectwhich are derived from this object. The list is empty in this base class, but subclasses that override _getContainedObject() can return non-empty lists.
 * @exception IllegalActionException If propagate is trueand propagation fails.
 */
private List _getDerivedList(Collection visited,boolean propagate,boolean force,NamedObj context,int depth,List override,String relativeName) throws IllegalActionException {
  try {
    workspace().getReadAccess();
    LinkedList result=new LinkedList();
    if (visited == null) {
      visited=new HashSet();
    }
 else {
      if (visited.contains(context)) {
        return result;
      }
    }
    visited.add(context);
    NamedObj container=context.getContainer();
    if (container != null) {
      String newRelativeName;
      if (relativeName == null) {
        newRelativeName=context.getName();
      }
 else {
        newRelativeName=context.getName() + "String_Node_Str" + relativeName;
      }
      List newOverride=null;
      if (propagate) {
        newOverride=new LinkedList(override);
        if (newOverride.size() <= (depth + 1)) {
          newOverride.add(Integer.valueOf(0));
        }
      }
      result.addAll(_getDerivedList(visited,propagate,force,container,depth + 1,newOverride,newRelativeName));
    }
    if (!(context instanceof Instantiable)) {
      return result;
    }
    int myBreadth=0;
    if (propagate) {
      myBreadth=((Integer)override.get(depth)).intValue();
    }
    List othersList=((Instantiable)context).getChildren();
    if (othersList != null) {
      Iterator others=othersList.iterator();
      while (others.hasNext()) {
        WeakReference reference=(WeakReference)others.next();
        NamedObj other=(NamedObj)reference.get();
        if (other != null) {
          NamedObj candidate=other;
          if (relativeName != null) {
            candidate=_getContainedObject(other,relativeName);
          }
          if (candidate == null) {
            if (force) {
              NamedObj remoteContainer=other;
              int lastPeriod=relativeName.lastIndexOf("String_Node_Str");
              if (lastPeriod > 0) {
                String containerName=relativeName.substring(0,lastPeriod);
                remoteContainer=getContainer()._getContainedObject(other,containerName);
              }
              candidate=_propagateExistence(remoteContainer);
              if (depth < candidate._derivedLevel) {
                candidate._derivedLevel=depth;
              }
              candidate._markContentsDerived(depth);
              candidate._adjustOverride(depth);
            }
 else {
              continue;
            }
          }
          if (visited.contains(candidate)) {
            continue;
          }
          List newOverride=null;
          if (propagate) {
            newOverride=new LinkedList(override);
            newOverride.set(depth,Integer.valueOf(myBreadth + 1));
            if (_isShadowed(candidate._override,newOverride)) {
              continue;
            }
            _propagateValue(candidate);
            candidate._override=newOverride;
          }
          result.add(candidate);
          result.addAll(candidate._getDerivedList(visited,propagate,force,candidate,0,newOverride,null));
        }
      }
    }
    return result;
  }
  finally {
    workspace().doneReading();
  }
}