Program: 74776
Project: 74776
Buggy source:
/** 
 * Add an actor to the PtalonActor.  In the case of an actor specifed by an import statement, the actor will be a PtalonActor.  In the case of an actor specified by a  parameter, the actor will be arbitrary.
 * @param name The unique name of the actor declaration.
 * @exception PtalonRuntimeException If there is any troubleloading the actor.
 */
public void addActor(String name) throws PtalonRuntimeException {
  try {
    if (_currentActorTree == null) {
      throw new PtalonRuntimeException("String_Node_Str");
    }
    String symbol=_currentActorTree.getSymbol();
    if (symbol.equals("String_Node_Str")) {
      _currentActorTree.created=true;
      _currentActorTree.createdIteration=_currentIfTree.entered;
      _currentActorTree.assignPtalonParameters(_actor);
      _currentActorTree.makeThisConnections();
      _currentActorTree.removeDynamicLeftHandSides();
      return;
    }
    String uniqueName=_actor.uniqueName(symbol);
    if (_getType(symbol).equals("String_Node_Str")) {
      PtalonActor actor=new PtalonActor(_actor,uniqueName);
      FileParameter location=actor.ptalonCodeLocation;
      File file=_imports.get(symbol);
      location.setToken(new StringToken(file.toString()));
      actor.setNestedDepth(_actor.getNestedDepth() + 1);
      _currentActorTree.assignPtalonParameters(actor);
      _currentActorTree.makeConnections(actor);
      _currentActorTree.removeDynamicLeftHandSides();
    }
 else     if (_getType(symbol).equals("String_Node_Str")) {
      PtalonParameter parameter=(PtalonParameter)_actor.getAttribute(getMappedName(symbol));
      if (!parameter.hasValue()) {
        throw new PtalonRuntimeException("String_Node_Str" + symbol + "String_Node_Str");
      }
      String expression=parameter.getExpression();
      String[] parsedExpression;
      if (expression.contains("String_Node_Str")) {
        parsedExpression=_parseActorExpression(expression);
      }
 else {
        parsedExpression=new String[1];
        parsedExpression[0]=expression;
      }
      String actor=parsedExpression[0];
      if (actor.startsWith("String_Node_Str")) {
        File file=new File(_parameterToImport(actor));
        PtalonActor ptalonActor=new PtalonActor(_actor,uniqueName);
        ptalonActor.ptalonCodeLocation.setToken(new StringToken(file.toString()));
        ptalonActor.setNestedDepth(_actor.getNestedDepth() + 1);
        for (int i=1; i < parsedExpression.length; i=i + 2) {
          String lhs=parsedExpression[i];
          String rhs=parsedExpression[i + 1];
          if (rhs.startsWith("String_Node_Str")) {
            rhs=rhs.substring(1,rhs.length() - 2);
          }
          Parameter param=(Parameter)ptalonActor.getAttribute(lhs);
          param.setExpression(rhs);
        }
        _currentActorTree.assignPtalonParameters(ptalonActor);
        _currentActorTree.makeConnections(ptalonActor);
        _currentActorTree.removeDynamicLeftHandSides();
      }
 else {
        Class<?> genericClass=Class.forName(actor);
        Class<? extends ComponentEntity> entityClass=genericClass.asSubclass(ComponentEntity.class);
        Constructor<? extends ComponentEntity> entityConstructor=entityClass.getConstructor(CompositeEntity.class,String.class);
        ComponentEntity entity=entityConstructor.newInstance(_actor,uniqueName);
        for (int i=1; i < parsedExpression.length; i=i + 2) {
          String lhs=parsedExpression[i];
          String rhs=parsedExpression[i + 1];
          if (rhs.startsWith("String_Node_Str")) {
            rhs=rhs.substring(1,rhs.length() - 2);
          }
          Parameter param=(Parameter)entity.getAttribute(lhs);
          param.setExpression(rhs);
        }
        _currentActorTree.makeConnections(entity);
        _currentActorTree.assignNonPtalonParameters(entity);
        _currentActorTree.removeDynamicLeftHandSides();
      }
      _currentActorTree.created=true;
      _currentActorTree.createdIteration=_currentIfTree.entered;
    }
 else {
      throw new PtalonRuntimeException("String_Node_Str" + name);
    }
  }
 catch (  Exception e) {
    throw new PtalonRuntimeException("String_Node_Str" + name,e);
  }
}

Fixed version (ground truth):
/** 
 * Add an actor to the PtalonActor.  In the case of an actor specifed by an import statement, the actor will be a PtalonActor.  In the case of an actor specified by a  parameter, the actor will be arbitrary.
 * @param name The unique name of the actor declaration.
 * @exception PtalonRuntimeException If there is any troubleloading the actor.
 */
public void addActor(String name) throws PtalonRuntimeException {
  try {
    if (_currentActorTree == null) {
      throw new PtalonRuntimeException("String_Node_Str");
    }
    String symbol=_currentActorTree.getSymbol();
    if (symbol.equals("String_Node_Str")) {
      _currentActorTree.created=true;
      if (_inNewWhileIteration()) {
        if (_currentIfTree.isForStatement) {
          _currentActorTree.createdIteration=_currentIfTree.entered;
        }
 else {
          IfTree tree=_currentIfTree;
          while (!tree.isForStatement) {
            tree=tree.getParent();
            if (tree == null) {
              throw new PtalonRuntimeException("String_Node_Str" + "String_Node_Str");
            }
          }
          _currentActorTree.createdIteration=tree.entered;
        }
      }
 else {
        _currentActorTree.createdIteration=_currentIfTree.entered;
      }
      _currentActorTree.assignPtalonParameters(_actor);
      _currentActorTree.makeThisConnections();
      _currentActorTree.removeDynamicLeftHandSides();
      return;
    }
    String uniqueName=_actor.uniqueName(symbol);
    if (_getType(symbol).equals("String_Node_Str")) {
      PtalonActor actor=new PtalonActor(_actor,uniqueName);
      FileParameter location=actor.ptalonCodeLocation;
      File file=_imports.get(symbol);
      location.setToken(new StringToken(file.toString()));
      actor.setNestedDepth(_actor.getNestedDepth() + 1);
      _currentActorTree.assignPtalonParameters(actor);
      _currentActorTree.makeConnections(actor);
      _currentActorTree.removeDynamicLeftHandSides();
    }
 else     if (_getType(symbol).equals("String_Node_Str")) {
      PtalonParameter parameter=(PtalonParameter)_actor.getAttribute(getMappedName(symbol));
      if (!parameter.hasValue()) {
        throw new PtalonRuntimeException("String_Node_Str" + symbol + "String_Node_Str");
      }
      String expression=parameter.getExpression();
      String[] parsedExpression;
      if (expression.contains("String_Node_Str")) {
        parsedExpression=_parseActorExpression(expression);
      }
 else {
        parsedExpression=new String[1];
        parsedExpression[0]=expression;
      }
      String actor=parsedExpression[0];
      if (actor.startsWith("String_Node_Str")) {
        File file=new File(_parameterToImport(actor));
        PtalonActor ptalonActor=new PtalonActor(_actor,uniqueName);
        ptalonActor.ptalonCodeLocation.setToken(new StringToken(file.toString()));
        ptalonActor.setNestedDepth(_actor.getNestedDepth() + 1);
        for (int i=1; i < parsedExpression.length; i=i + 2) {
          String lhs=parsedExpression[i];
          String rhs=parsedExpression[i + 1];
          if (rhs.startsWith("String_Node_Str")) {
            rhs=rhs.substring(1,rhs.length() - 2);
          }
          Parameter param=(Parameter)ptalonActor.getAttribute(lhs);
          param.setExpression(rhs);
        }
        _currentActorTree.assignPtalonParameters(ptalonActor);
        _currentActorTree.makeConnections(ptalonActor);
        _currentActorTree.removeDynamicLeftHandSides();
      }
 else {
        Class<?> genericClass=Class.forName(actor);
        Class<? extends ComponentEntity> entityClass=genericClass.asSubclass(ComponentEntity.class);
        Constructor<? extends ComponentEntity> entityConstructor=entityClass.getConstructor(CompositeEntity.class,String.class);
        ComponentEntity entity=entityConstructor.newInstance(_actor,uniqueName);
        for (int i=1; i < parsedExpression.length; i=i + 2) {
          String lhs=parsedExpression[i];
          String rhs=parsedExpression[i + 1];
          if (rhs.startsWith("String_Node_Str")) {
            rhs=rhs.substring(1,rhs.length() - 2);
          }
          Parameter param=(Parameter)entity.getAttribute(lhs);
          param.setExpression(rhs);
        }
        _currentActorTree.makeConnections(entity);
        _currentActorTree.assignNonPtalonParameters(entity);
        _currentActorTree.removeDynamicLeftHandSides();
      }
      _currentActorTree.created=true;
      if (_inNewWhileIteration()) {
        if (_currentIfTree.isForStatement) {
          _currentActorTree.createdIteration=_currentIfTree.entered;
        }
 else {
          IfTree tree=_currentIfTree;
          while (!tree.isForStatement) {
            tree=tree.getParent();
            if (tree == null) {
              throw new PtalonRuntimeException("String_Node_Str" + "String_Node_Str");
            }
          }
          _currentActorTree.createdIteration=tree.entered;
        }
      }
 else {
        _currentActorTree.createdIteration=_currentIfTree.entered;
      }
    }
 else {
      throw new PtalonRuntimeException("String_Node_Str" + name);
    }
  }
 catch (  Exception e) {
    throw new PtalonRuntimeException("String_Node_Str" + name,e);
  }
}