Program: 74061
Project: 74061
Buggy source:
/** 
 * Parse the command-line arguments.
 * @param args The command-line arguments to be parsed.
 * @exception Exception If an argument is not understood or triggersan error.
 */
protected void _parseArgs(String[] args) throws Exception {
  if (args.length > 0) {
    _configuration=_createDefaultConfiguration();
  }
 else {
    _configuration=_createEmptyConfiguration();
  }
  if (_configuration != null) {
    Parameter classesToRemoveParameter=(Parameter)_configuration.getAttribute("String_Node_Str");
    if (classesToRemoveParameter != null) {
      ArrayToken classesToRemoveToken=(ArrayToken)classesToRemoveParameter.getToken();
      RemoveGraphicalClasses filter=new RemoveGraphicalClasses();
      RemoveGraphicalClasses.clear();
      for (int i=0; i < classesToRemoveToken.length(); i++) {
        String classNameToRemove=((StringToken)classesToRemoveToken.getElement(i)).stringValue();
        filter.put(classNameToRemove,null);
      }
      MoMLParser.addMoMLFilter(filter);
    }
    Parameter removeGraphicalClassesParameter=(Parameter)_configuration.getAttribute("String_Node_Str");
    if (removeGraphicalClassesParameter != null && removeGraphicalClassesParameter.equals("String_Node_Str")) {
      RemoveGraphicalClasses filter=new RemoveGraphicalClasses();
      MoMLParser.addMoMLFilter(filter);
    }
  }
  for (int i=0; i < args.length; i++) {
    String arg=args[i];
    if (_parseArg(arg) == false) {
      if (arg.trim().startsWith("String_Node_Str")) {
        if (i >= (args.length - 1)) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + arg + "String_Node_Str"+ "String_Node_Str");
        }
        _parameterNames.add(arg.substring(1));
        _parameterValues.add(args[i + 1]);
        i++;
      }
 else {
        throw new IllegalActionException("String_Node_Str" + arg);
      }
    }
  }
  if (_expectingClass) {
    throw new IllegalActionException("String_Node_Str");
  }
  Iterator names=_parameterNames.iterator();
  Iterator values=_parameterValues.iterator();
  while (names.hasNext() && values.hasNext()) {
    String name=(String)names.next();
    String value=(String)values.next();
    boolean match=false;
    ModelDirectory directory=(ModelDirectory)_configuration.getEntity("String_Node_Str");
    if (directory == null) {
      throw new InternalErrorException("String_Node_Str");
    }
    Iterator effigies=directory.entityList(Effigy.class).iterator();
    while (effigies.hasNext()) {
      Effigy effigy=(Effigy)effigies.next();
      if (effigy instanceof PtolemyEffigy) {
        NamedObj model=((PtolemyEffigy)effigy).getModel();
        Attribute attribute=model.getAttribute(name);
        if (attribute instanceof Settable) {
          match=true;
          String moml="String_Node_Str" + name + "String_Node_Str"+ value+ "String_Node_Str";
          MoMLChangeRequest request=new MoMLChangeRequest(this,model,moml);
          model.requestChange(request);
        }
        if (model instanceof CompositeActor) {
          Director director=((CompositeActor)model).getDirector();
          if (director != null) {
            attribute=director.getAttribute(name);
            if (attribute instanceof Settable) {
              match=true;
              String moml="String_Node_Str" + name + "String_Node_Str"+ value+ "String_Node_Str";
              MoMLChangeRequest request=new MoMLChangeRequest(this,director,moml);
              director.requestChange(request);
            }
          }
        }
      }
    }
    if (!match) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + name);
    }
  }
  if (_configuration == null) {
    throw new IllegalActionException("String_Node_Str");
  }
  _configuration.showAll();
}

Fixed version (ground truth):
/** 
 * Parse the command-line arguments.
 * @param args The command-line arguments to be parsed.
 * @exception Exception If an argument is not understood or triggersan error.
 */
protected void _parseArgs(String[] args) throws Exception {
  boolean configExists=false;
  String configurationPath=null;
  int configurationIndex=-99;
  for (int i=0; i < args.length; i++) {
    if (args[i].trim().equals("String_Node_Str")) {
      configurationPath=args[i + 1];
      configurationIndex=i;
      configExists=true;
      break;
    }
  }
  if (configExists) {
    String[] newArgs=new String[args.length - 2];
    int j=0;
    for (int i=0; i < args.length; i++) {
      if (i != configurationIndex && i != configurationIndex + 1) {
        newArgs[j]=args[i];
        j++;
      }
    }
    args=newArgs;
    _configurationURL=specToURL(configurationPath);
    _configuration=readConfiguration(_configurationURL);
  }
 else {
    _configuration=_createDefaultConfiguration();
  }
  if (_configuration != null) {
    Parameter classesToRemoveParameter=(Parameter)_configuration.getAttribute("String_Node_Str");
    if (classesToRemoveParameter != null) {
      ArrayToken classesToRemoveToken=(ArrayToken)classesToRemoveParameter.getToken();
      RemoveGraphicalClasses filter=new RemoveGraphicalClasses();
      RemoveGraphicalClasses.clear();
      for (int i=0; i < classesToRemoveToken.length(); i++) {
        String classNameToRemove=((StringToken)classesToRemoveToken.getElement(i)).stringValue();
        filter.put(classNameToRemove,null);
      }
      MoMLParser.addMoMLFilter(filter);
    }
    Parameter removeGraphicalClassesParameter=(Parameter)_configuration.getAttribute("String_Node_Str");
    if (removeGraphicalClassesParameter != null && removeGraphicalClassesParameter.getValueAsString().equals("String_Node_Str")) {
      RemoveGraphicalClasses filter=new RemoveGraphicalClasses();
      MoMLParser.addMoMLFilter(filter);
    }
  }
  for (int i=0; i < args.length; i++) {
    String arg=args[i];
    if (_parseArg(arg) == false) {
      if (arg.trim().startsWith("String_Node_Str")) {
        if (i >= (args.length - 1)) {
          throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + arg + "String_Node_Str"+ "String_Node_Str");
        }
        _parameterNames.add(arg.substring(1));
        _parameterValues.add(args[i + 1]);
        i++;
      }
 else {
        throw new IllegalActionException("String_Node_Str" + arg);
      }
    }
  }
  if (_expectingClass) {
    throw new IllegalActionException("String_Node_Str");
  }
  Iterator names=_parameterNames.iterator();
  Iterator values=_parameterValues.iterator();
  while (names.hasNext() && values.hasNext()) {
    String name=(String)names.next();
    String value=(String)values.next();
    boolean match=false;
    ModelDirectory directory=(ModelDirectory)_configuration.getEntity("String_Node_Str");
    if (directory == null) {
      throw new InternalErrorException("String_Node_Str");
    }
    Iterator effigies=directory.entityList(Effigy.class).iterator();
    while (effigies.hasNext()) {
      Effigy effigy=(Effigy)effigies.next();
      if (effigy instanceof PtolemyEffigy) {
        NamedObj model=((PtolemyEffigy)effigy).getModel();
        Attribute attribute=model.getAttribute(name);
        if (attribute instanceof Settable) {
          match=true;
          String moml="String_Node_Str" + name + "String_Node_Str"+ value+ "String_Node_Str";
          MoMLChangeRequest request=new MoMLChangeRequest(this,model,moml);
          model.requestChange(request);
        }
        if (model instanceof CompositeActor) {
          Director director=((CompositeActor)model).getDirector();
          if (director != null) {
            attribute=director.getAttribute(name);
            if (attribute instanceof Settable) {
              match=true;
              String moml="String_Node_Str" + name + "String_Node_Str"+ value+ "String_Node_Str";
              MoMLChangeRequest request=new MoMLChangeRequest(this,director,moml);
              director.requestChange(request);
            }
          }
        }
      }
    }
    if (!match) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + name);
    }
  }
  if (_configuration == null) {
    throw new IllegalActionException("String_Node_Str");
  }
  _configuration.showAll();
}