Program: 75909
Project: 75909
Buggy source:
/** 
 * Create a model.  In this base class, we check to see whether the applet has a parameter <i>modelClass</i>, and if so, then we instantiate the class specified in that parameter.  If not, then we create an empty instance of CompositeActor. It is required that the class specified in the modelClass parameter have a constructor that takes one argument, an instance of Workspace. In either case, if the resulting model does not have a manager, then we give it a manager.
 * @param workspace The workspace in which to create the model.
 * @return A model.
 * @throws Exception If something goes wrong.  This is a broadexception to allow derived classes wide lattitude as to which exception to throw.
 */
protected CompositeActor _createModel(Workspace workspace) throws Exception {
  CompositeActor result=null;
  String modelSpecification=getParameter("String_Node_Str");
  if (modelSpecification != null) {
    Object[] arguments=new Object[1];
    arguments[0]=workspace;
    Class modelClass=Class.forName(modelSpecification);
    Constructor[] constructors=modelClass.getConstructors();
    boolean foundConstructor=false;
    for (int i=0; i < constructors.length; i++) {
      Constructor constructor=constructors[i];
      Class[] parameterTypes=constructor.getParameterTypes();
      if (parameterTypes.length != arguments.length)       continue;
      boolean match=true;
      for (int j=0; j < parameterTypes.length; j++) {
        if (!(parameterTypes[j].isInstance(arguments[j]))) {
          match=false;
          break;
        }
      }
      if (match) {
        result=(CompositeActor)constructor.newInstance(arguments);
        foundConstructor=true;
      }
    }
    if (!foundConstructor) {
      throw new IllegalActionException("String_Node_Str" + modelSpecification);
    }
  }
  if (result == null) {
    if (_toplevel == null) {
      throw new Exception("String_Node_Str");
    }
 else {
      return _toplevel;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Create a model.  In this base class, we check to see whether the applet has a parameter <i>modelClass</i>, and if so, then we instantiate the class specified in that parameter.  If not, then we create an empty instance of NamedObj. It is required that the class specified in the modelClass parameter have a constructor that takes one argument, an instance of Workspace. In either case, if the resulting model does not have a manager, then we give it a manager.
 * @param workspace The workspace in which to create the model.
 * @return A model.
 * @throws Exception If something goes wrong.  This is a broadexception to allow derived classes wide lattitude as to which exception to throw.
 */
protected NamedObj _createModel(Workspace workspace) throws Exception {
  NamedObj result=null;
  String modelSpecification=getParameter("String_Node_Str");
  if (modelSpecification != null) {
    Object[] arguments=new Object[1];
    arguments[0]=workspace;
    Class modelClass=Class.forName(modelSpecification);
    Constructor[] constructors=modelClass.getConstructors();
    boolean foundConstructor=false;
    for (int i=0; i < constructors.length; i++) {
      Constructor constructor=constructors[i];
      Class[] parameterTypes=constructor.getParameterTypes();
      if (parameterTypes.length != arguments.length)       continue;
      boolean match=true;
      for (int j=0; j < parameterTypes.length; j++) {
        if (!(parameterTypes[j].isInstance(arguments[j]))) {
          match=false;
          break;
        }
      }
      if (match) {
        result=(NamedObj)constructor.newInstance(arguments);
        foundConstructor=true;
      }
    }
    if (!foundConstructor) {
      throw new IllegalActionException("String_Node_Str" + modelSpecification);
    }
  }
  if (result == null) {
    if (_toplevel == null) {
      throw new Exception("String_Node_Str");
    }
 else {
      return _toplevel;
    }
  }
  return result;
}