nus-yam/ex-repair huggingface dataset:
Program: 74278
Project: 74278
Buggy source:
/** 
 * Insert initial events into the event queue, and request firing from the director at the higher level, if any.
 * @exception IllegalActionException If whether an event is initial eventcannot be checked.
 */
protected void _insertInitialEvents() throws IllegalActionException {
  ERGController controller=getController();
  if (_isInController()) {
    ERGModalModel modalModel=(ERGModalModel)getContainer().getContainer();
    _currentTime=modalModel.getDirector().getModelTime();
    Iterator<?> entities=controller.deepEntityList().iterator();
    while (entities.hasNext()) {
      Event event=(Event)entities.next();
      if (event.isInitialEvent()) {
        TimedEvent newEvent=new TimedEvent(_currentTime,event,null,null,0);
        _addEvent(newEvent);
      }
    }
  }
 else {
    TimedEvent newEvent=new TimedEvent(_currentTime,controller,null,null,0);
    _addEvent(newEvent);
    if (_isEmbedded()) {
      _requestFiring();
    }
  }
  if (_isEmbedded()) {
    _delegateFireAt=true;
  }
}

Fixed version (ground truth):
/** 
 * Insert initial events into the event queue, and request firing from the director at the higher level, if any.
 * @exception IllegalActionException If whether an event is initial eventcannot be checked.
 */
protected void _insertInitialEvents() throws IllegalActionException {
  ERGController controller=getController();
  if (_isInController()) {
    ERGModalModel modalModel=(ERGModalModel)getContainer().getContainer();
    _currentTime=modalModel.getDirector().getModelTime();
    Iterator<?> entities=controller.deepEntityList().iterator();
    while (entities.hasNext()) {
      Event event=(Event)entities.next();
      if (event.isInitialEvent()) {
        TimedEvent newEvent=new TimedEvent(_currentTime,event,null,null,0);
        _addEvent(newEvent);
      }
    }
    if (getController().getRefinedState() != null) {
      _requestFiring();
    }
  }
 else {
    TimedEvent newEvent=new TimedEvent(_currentTime,controller,null,null,0);
    _addEvent(newEvent);
    if (_isEmbedded()) {
      _requestFiring();
    }
  }
  if (_isEmbedded()) {
    _delegateFireAt=true;
  }
}
Program: 74279
Project: 74279
Buggy source:
/** 
 * Fire an actor. The prefire(), fire() and postfire() methods of the actor are called. If timedEvent is not null, then it is removed from the event queues.
 * @param actor The actor to fire.
 * @param timedEvent The timed event that contains the actor as itscontents, or null if none.
 * @return True if an event is processed or an actor is fired, or false ifthe prefire() method of the actor returns false.
 * @exception IllegalActionException If firing the actor throws it.
 */
private boolean _fireActor(Actor actor,TimedEvent timedEvent) throws IllegalActionException {
  if (actor.prefire()) {
    if (timedEvent != null) {
      _eventQueue.remove(timedEvent);
      _refinementQueue.remove(timedEvent);
    }
    actor.fire();
    if (!actor.postfire()) {
      List<Event> events=getController().entityList(Event.class);
      for (      Event event : events) {
        TypedActor[] refinements=event.getRefinement();
        boolean scheduled=false;
        if (refinements != null) {
          for (          TypedActor refinement : refinements) {
            if (refinement == actor && event._isActiveRefinement(refinement)) {
              if (event.isFinalEvent()) {
                _eventQueue.clear();
                _refinementQueue.clear();
              }
 else {
                event.scheduleEvents();
              }
              scheduled=true;
              break;
            }
          }
        }
        if (scheduled) {
          break;
        }
      }
    }
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Fire an actor. The prefire(), fire() and postfire() methods of the actor are called. If timedEvent is not null, then it is removed from the event queues.
 * @param actor The actor to fire.
 * @param timedEvent The timed event that contains the actor as itscontents, or null if none.
 * @return True if an event is processed or an actor is fired, or false ifthe prefire() method of the actor returns false.
 * @exception IllegalActionException If firing the actor throws it.
 */
private boolean _fireActor(Actor actor,TimedEvent timedEvent) throws IllegalActionException {
  if (actor.prefire()) {
    if (timedEvent != null) {
      _eventQueue.remove(timedEvent);
      _refinementQueue.remove(timedEvent);
    }
    actor.fire();
    if (!actor.postfire()) {
      _initializedRefinements.remove(actor);
      Event event=(Event)((RefinementActor)actor).getRefinedState();
      if (event != null) {
        if (event.isFinalEvent()) {
          _eventQueue.clear();
          _refinementQueue.clear();
        }
 else {
          event.scheduleEvents();
        }
      }
    }
    return true;
  }
 else {
    return false;
  }
}
Program: 74280
Project: 74280
Buggy source:
/** 
 * Invoke the preinitialize() method of the superclass. If this director is directly associated with a modal model (i.e., not in any controller), then preinitialize() of the director in the controller of the modal model is also called.
 * @exception IllegalActionException If the preinitialize() method ofone of the associated actors throws it.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  _realStartTime=System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Invoke the preinitialize() method of the superclass. If this director is directly associated with a modal model (i.e., not in any controller), then preinitialize() of the director in the controller of the modal model is also called.
 * @exception IllegalActionException If the preinitialize() method ofone of the associated actors throws it.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  _clearState();
  _realStartTime=System.currentTimeMillis();
}
Program: 74281
Project: 74281
Buggy source:
/** 
 * Clone the director into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new director.
 * @param workspace The workspace for the new director.
 * @return A new director.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ERGDirector newObject=(ERGDirector)super.clone(workspace);
  newObject._controller=null;
  newObject._controllerVersion=-1;
  newObject._eventQueue=new LinkedList<TimedEvent>();
  newObject._eventsListeningToPorts=new HashMap<Port,Set<TimedEvent>>();
  newObject._eventsListeningToVariables=new HashMap<Variable,Set<TimedEvent>>();
  newObject._refinementQueue=new LinkedList<TimedEvent>();
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the director into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new director.
 * @param workspace The workspace for the new director.
 * @return A new director.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ERGDirector newObject=(ERGDirector)super.clone(workspace);
  newObject._controller=null;
  newObject._controllerVersion=-1;
  newObject._eventQueue=new LinkedList<TimedEvent>();
  newObject._eventsListeningToPorts=new HashMap<Port,Set<TimedEvent>>();
  newObject._eventsListeningToVariables=new HashMap<Variable,Set<TimedEvent>>();
  newObject._initializedRefinements=new HashSet<TypedActor>();
  newObject._refinementQueue=new LinkedList<TimedEvent>();
  return newObject;
}
Program: 74283
Project: 74283
Buggy source:
/** 
 * In this class, do nothing.
 * @param container The object created by this element.
 * @param elementName The element name.
 * @param currentCharData The character data, which appearsonly in the doc and configure elements
 * @exception Exception Not thrown in this base class.
 */
public void filterEndElement(NamedObj container,String elementName,StringBuffer currentCharData) throws Exception {
}

Fixed version (ground truth):
/** 
 * Clear recorded state for this element so that it does not interfere with the next element.
 * @param container The object created by this element.
 * @param elementName The element name.
 * @param currentCharData The character data, which appearsonly in the doc and configure elements
 * @exception Exception Not thrown in this base class.
 */
public void filterEndElement(NamedObj container,String elementName,StringBuffer currentCharData) throws Exception {
  if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")) {
    _currentActorFullName=null;
    _currentlyProcessingActorWithPortNameChanges=false;
    _doneProcessingActorWithPortNameChanges=false;
    _lastNameSeen=null;
  }
}
Program: 74284
Project: 74284
Buggy source:
/** 
 * Set a flag that causes recalculation of various local variables that are used in execution on the next invocation of fire().
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the attribute containsan invalid value or if the super method throws it.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == interpolation) {
    IntToken token=(IntToken)(interpolation.getToken());
    _interpolationValue=token.intValue();
    if (_interpolationValue <= 0) {
      throw new IllegalActionException(this,"String_Node_Str" + _interpolationValue + "String_Node_Str");
    }
    _reinitializeNeeded=true;
  }
 else   if (attribute == decimation) {
    IntToken token=(IntToken)(decimation.getToken());
    _decimationValue=token.intValue();
    if (_decimationValue <= 0) {
      throw new IllegalActionException(this,"String_Node_Str" + _decimationValue + "String_Node_Str");
    }
    _reinitializeNeeded=true;
  }
 else   if (attribute == decimationPhase) {
    IntToken token=(IntToken)(decimationPhase.getToken());
    _decimationPhaseValue=token.intValue();
    if (_decimationPhaseValue < 0) {
      throw new IllegalActionException(this,"String_Node_Str" + _decimationPhaseValue + "String_Node_Str");
    }
    _reinitializeNeeded=true;
  }
 else   if (attribute == taps) {
    ArrayToken tapsToken=(ArrayToken)(taps.getToken());
    _taps=tapsToken.arrayValue();
    _zero=_taps[0].zero();
    _reinitializeNeeded=true;
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * Set a flag that causes recalculation of various local variables that are used in execution on the next invocation of fire().
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the attribute containsan invalid value or if the super method throws it.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == interpolation) {
    IntToken token=(IntToken)(interpolation.getToken());
    _interpolationValue=token.intValue();
    if (_interpolationValue <= 0) {
      throw new IllegalActionException(this,"String_Node_Str" + _interpolationValue + "String_Node_Str");
    }
    _reinitializeNeeded=true;
  }
 else   if (attribute == decimation) {
    IntToken token=(IntToken)(decimation.getToken());
    _decimationValue=token.intValue();
    if (_decimationValue <= 0) {
      throw new IllegalActionException(this,"String_Node_Str" + _decimationValue + "String_Node_Str");
    }
    _reinitializeNeeded=true;
  }
 else   if (attribute == decimationPhase) {
    IntToken token=(IntToken)(decimationPhase.getToken());
    _decimationPhaseValue=token.intValue();
    if (_decimationPhaseValue < 0) {
      throw new IllegalActionException(this,"String_Node_Str" + _decimationPhaseValue + "String_Node_Str");
    }
    _reinitializeNeeded=true;
  }
 else   if (attribute == taps) {
    _initializeTaps();
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 74285
Project: 74285
Buggy source:
/** 
 * Override the base class to initialize the taps to the initial values.
 * @exception IllegalActionException If the superclass throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  taps.setToken(initialTaps.getToken());
}

Fixed version (ground truth):
/** 
 * Override the base class to re initialize the taps
 * @exception IllegalActionException If the superclass throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _initializeTaps();
}
Program: 74287
Project: 74287
Buggy source:
/** 
 * Create an instance of a model and convert it.
 * @param args The command-line arguments providing the numberof entities threshold and naming the .xml file to convert.
 */
public static void main(String[] args){
  try {
    if (args.length == 0) {
      System.err.println("String_Node_Str");
      return;
    }
    if (args.length == 1) {
      new ConvertToLazy(args[0],100);
      return;
    }
    int threshold=Integer.parseInt(args[0]);
    new ConvertToLazy(args[1],threshold);
  }
 catch (  Throwable ex) {
    System.err.println("String_Node_Str" + ex);
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Create an instance of a model and convert it.
 * @param args The command-line arguments providing the numberof entities threshold and naming the .xml file to convert.
 */
public static void main(String[] args){
  try {
    if (args.length == 0) {
      System.err.println("String_Node_Str");
      return;
    }
    if (args.length == 1) {
      new ConvertToLazy(args[0],100);
      return;
    }
    int threshold=Integer.parseInt(args[1]);
    new ConvertToLazy(args[0],threshold);
  }
 catch (  Throwable ex) {
    System.err.println("String_Node_Str" + ex);
    ex.printStackTrace();
  }
}
Program: 74288
Project: 74288
Buggy source:
/** 
 * Convert the model.
 * @param actor The model to convert.
 * @param threshold The threshold to use.
 */
public void convert(TypedCompositeActor actor,int threshold){
  List<ComponentEntity> entities=actor.entityList();
  for (  ComponentEntity entity : entities) {
    if (!entity.isAtomic() && entity instanceof TypedAtomicActor) {
      convert((TypedCompositeActor)entity,threshold);
      if (count((TypedCompositeActor)entity) >= threshold) {
        entity.setClassName("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Convert the model.
 * @param actor The model to convert.
 * @param threshold The threshold to use.
 */
public void convert(TypedCompositeActor actor,int threshold){
  List<ComponentEntity> entities=actor.entityList();
  for (  ComponentEntity entity : entities) {
    if (entity instanceof TypedCompositeActor) {
      convert((TypedCompositeActor)entity,threshold);
      if (count((TypedCompositeActor)entity) >= threshold) {
        entity.setClassName("String_Node_Str");
      }
    }
  }
}
Program: 74289
Project: 74289
Buggy source:
/** 
 * Return the (presumably Settable) attribute modified by this actor.  This is the attribute in the container of this actor with the name given by the variableName attribute.  If no such attribute is found, then this method creates a new variable in the actor's container with the correct name.  This method gets write access on the workspace.
 * @exception IllegalActionException If the variable cannot be found.
 * @return The attribute modified by this actor.
 */
public Attribute getModifiedVariable() throws IllegalActionException {
  if (_workspace.getVersion() == _attributeVersion) {
    return _attribute;
  }
  NamedObj container=getContainer();
  if (container == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  String variableNameValue=variableName.getExpression();
  _attribute=null;
  if (!variableNameValue.equals("String_Node_Str")) {
    _attribute=ModelScope.getScopedVariable(null,container,variableNameValue);
    if (_attribute == null) {
      try {
        workspace().getWriteAccess();
        _attribute=new Variable(getContainer(),variableNameValue);
      }
 catch (      NameDuplicationException ex) {
        throw new InternalErrorException(ex);
      }
 finally {
        workspace().doneWriting();
      }
    }
    _attributeVersion=_workspace.getVersion();
  }
  return _attribute;
}

Fixed version (ground truth):
/** 
 * Return the (presumably Settable) attribute modified by this actor.  This is the attribute in the container of this actor with the name given by the variableName attribute.  If no such attribute is found, then this method creates a new variable in the actor's container with the correct name.  This method gets write access on the workspace.
 * @exception IllegalActionException If the variable cannot be found.
 * @return The attribute modified by this actor.
 */
public Attribute getModifiedVariable() throws IllegalActionException {
  if (_workspace.getVersion() == _attributeVersion) {
    return _attribute;
  }
  NamedObj container=getContainer();
  if (container == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  String variableNameValue=variableName.getExpression();
  _attribute=null;
  if (!variableNameValue.equals("String_Node_Str")) {
    _attribute=ModelScope.getScopedAttribute(null,container,variableNameValue);
    if (_attribute == null) {
      try {
        workspace().getWriteAccess();
        _attribute=new Variable(getContainer(),variableNameValue);
      }
 catch (      NameDuplicationException ex) {
        throw new InternalErrorException(ex);
      }
 finally {
        workspace().doneWriting();
      }
    }
    _attributeVersion=_workspace.getVersion();
  }
  return _attribute;
}
Program: 74290
Project: 74290
Buggy source:
/** 
 * Get the variable with the given name in the scope of the given container.  If the name contains the "::" scoping specifier, then an attribute more deeply in the hierarchy is searched for.  The scope of the object includes any container of the given object, and any variable contained in a scope extending attribute inside any of those containers.
 * @param exclude A variable to exclude from the search.
 * @param container The container to search upwards from.
 * @param name The variable name to search for.
 * @return The variable with the given name or null if the variabledoes not exist.
 */
public static Variable getScopedVariable(Variable exclude,NamedObj container,String name){
  String insideName=name.replaceAll("String_Node_Str","String_Node_Str");
  while (container != null) {
    Variable result=_searchIn(exclude,container,insideName);
    if (result != null) {
      return result;
    }
 else {
      List attributes=(container).attributeList(ContainmentExtender.class);
      Iterator attrIterator=attributes.iterator();
      NamedObj extendedContainer=null;
      while (extendedContainer == null && attrIterator.hasNext()) {
        ContainmentExtender extender=(ContainmentExtender)attrIterator.next();
        try {
          extendedContainer=extender.getExtendedContainer();
        }
 catch (        IllegalActionException e) {
        }
      }
      if (extendedContainer == null) {
        container=container.getContainer();
      }
 else {
        container=extendedContainer;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the variable with the given name in the scope of the given container.  If the name contains the "::" scoping specifier, then an attribute more deeply in the hierarchy is searched for.  The scope of the object includes any container of the given object, and any variable contained in a scope extending attribute inside any of those containers.
 * @param exclude A variable to exclude from the search.
 * @param container The container to search upwards from.
 * @param name The variable name to search for.
 * @return The variable with the given name or null if the variabledoes not exist.
 */
public static Variable getScopedVariable(Variable exclude,NamedObj container,String name){
  String insideName=name.replaceAll("String_Node_Str","String_Node_Str");
  while (container != null) {
    Variable result=_searchVariableIn(exclude,container,insideName);
    if (result != null) {
      return result;
    }
 else {
      List attributes=(container).attributeList(ContainmentExtender.class);
      Iterator attrIterator=attributes.iterator();
      NamedObj extendedContainer=null;
      while (extendedContainer == null && attrIterator.hasNext()) {
        ContainmentExtender extender=(ContainmentExtender)attrIterator.next();
        try {
          extendedContainer=extender.getExtendedContainer();
        }
 catch (        IllegalActionException e) {
        }
      }
      if (extendedContainer == null) {
        container=container.getContainer();
      }
 else {
        container=extendedContainer;
      }
    }
  }
  return null;
}
Program: 74292
Project: 74292
Buggy source:
/** 
 * If the inserts all succeeded, then commit the changes.
 * @exception IllegalActionException If the commit fails.
 */
public void wrapup() throws IllegalActionException {
  super.wrapup();
  if (_succeeded) {
    String databaseName=databaseManager.stringValue();
    DatabaseManager database=DatabaseManager.findDatabaseManager(databaseName,this);
    database.commit();
  }
}

Fixed version (ground truth):
/** 
 * If the inserts all succeeded, then commit the changes.
 * @exception IllegalActionException If the commit fails.
 */
public void wrapup() throws IllegalActionException {
  super.wrapup();
  String databaseName=databaseManager.stringValue();
  DatabaseManager database=DatabaseManager.findDatabaseManager(databaseName,this);
  if (_succeeded) {
    database.commit(true);
  }
 else {
    database.commit(false);
  }
}
Program: 74293
Project: 74293
Buggy source:
/** 
 * Update the table to contain all the rows in input array of records.
 * @throws IllegalActionException If the database update fails.
 */
public void fire() throws IllegalActionException {
  _succeeded=false;
  super.fire();
  if (input.hasToken(0)) {
    String databaseName=databaseManager.stringValue();
    DatabaseManager database=DatabaseManager.findDatabaseManager(databaseName,this);
    String prefix="String_Node_Str" + table.stringValue() + "String_Node_Str";
    StringBuffer columnNames=new StringBuffer();
    StringBuffer values=new StringBuffer();
    ArrayToken inputArray=(ArrayToken)input.get(0);
    for (int i=0; i < inputArray.length(); i++) {
      RecordToken row=(RecordToken)inputArray.getElement(i);
      Set<String> columns=row.labelSet();
      for (      String column : columns) {
        if (columnNames.length() != 0) {
          columnNames.append("String_Node_Str");
          values.append("String_Node_Str");
        }
        columnNames.append(column);
        values.append(row.get(column).toString());
      }
      String sql=prefix + columnNames.toString() + "String_Node_Str"+ values.toString()+ "String_Node_Str";
      if (_debugging) {
        _debug("String_Node_Str" + sql);
      }
      database.execute(sql,false);
    }
  }
  _succeeded=true;
}

Fixed version (ground truth):
/** 
 * Update the table to contain all the rows in input array of records.
 * @throws IllegalActionException If the database update fails.
 */
public void fire() throws IllegalActionException {
  _succeeded=false;
  super.fire();
  if (input.hasToken(0)) {
    String databaseName=databaseManager.stringValue();
    DatabaseManager database=DatabaseManager.findDatabaseManager(databaseName,this);
    String prefix="String_Node_Str" + table.stringValue() + "String_Node_Str";
    ArrayToken inputArray=(ArrayToken)input.get(0);
    for (int i=0; i < inputArray.length(); i++) {
      StringBuffer columnNames=new StringBuffer();
      StringBuffer values=new StringBuffer();
      RecordToken row=(RecordToken)inputArray.getElement(i);
      Set<String> columns=row.labelSet();
      for (      String column : columns) {
        if (columnNames.length() != 0) {
          columnNames.append("String_Node_Str");
          values.append("String_Node_Str");
        }
        columnNames.append(column);
        values.append(row.get(column).toString());
      }
      String sql=prefix + columnNames.toString() + "String_Node_Str"+ values.toString()+ "String_Node_Str";
      if (_debugging) {
        _debug("String_Node_Str" + sql);
      }
      database.execute(sql,false);
    }
  }
  _succeeded=true;
}
Program: 74294
Project: 74294
Buggy source:
/** 
 * Commit any previously uncommitted changes effected by the  {@link #execute(String,boolean)} method.
 * @throws IllegalActionException If the commit fails. 
 */
public void commit() throws IllegalActionException {
  Connection connection=getConnection();
  try {
    connection.commit();
  }
 catch (  SQLException e) {
    throw new IllegalActionException(this,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Commit or roll back any previously uncommitted changes effected by the  {@link #execute(String,boolean)} method.
 * @param commit True to commit, false to roll back.
 * @throws IllegalActionException If the commit fails. 
 */
public void commit(boolean commit) throws IllegalActionException {
  Connection connection=getConnection();
  try {
    if (commit) {
      connection.commit();
    }
 else {
      connection.rollback();
    }
  }
 catch (  SQLException e) {
    throw new IllegalActionException(this,e,"String_Node_Str");
  }
}
Program: 74295
Project: 74295
Buggy source:
/** 
 * Update the table to contain all the rows in input array of records.
 * @throws IllegalActionException If the database update fails.
 */
public void fire() throws IllegalActionException {
  _succeeded=false;
  super.fire();
  if (input.hasToken(0)) {
    String databaseName=databaseManager.stringValue();
    DatabaseManager database=DatabaseManager.findDatabaseManager(databaseName,this);
    String prefix="String_Node_Str" + table.stringValue() + "String_Node_Str";
    StringBuffer columnNames=new StringBuffer();
    StringBuffer values=new StringBuffer();
    ArrayToken inputArray=(ArrayToken)input.get(0);
    for (int i=0; i < inputArray.length(); i++) {
      RecordToken row=(RecordToken)inputArray.getElement(i);
      Set<String> columns=row.labelSet();
      for (      String column : columns) {
        if (columnNames.length() != 0) {
          columnNames.append("String_Node_Str");
          values.append("String_Node_Str");
        }
        columnNames.append(column);
        values.append(row.get(column).toString());
      }
    }
    String sql=prefix + columnNames.toString() + "String_Node_Str"+ values.toString()+ "String_Node_Str";
    if (_debugging) {
      _debug("String_Node_Str" + sql);
    }
    database.execute(sql,false);
  }
  _succeeded=true;
}

Fixed version (ground truth):
/** 
 * Update the table to contain all the rows in input array of records.
 * @throws IllegalActionException If the database update fails.
 */
public void fire() throws IllegalActionException {
  _succeeded=false;
  super.fire();
  if (input.hasToken(0)) {
    String databaseName=databaseManager.stringValue();
    DatabaseManager database=DatabaseManager.findDatabaseManager(databaseName,this);
    String prefix="String_Node_Str" + table.stringValue() + "String_Node_Str";
    StringBuffer columnNames=new StringBuffer();
    StringBuffer values=new StringBuffer();
    ArrayToken inputArray=(ArrayToken)input.get(0);
    for (int i=0; i < inputArray.length(); i++) {
      RecordToken row=(RecordToken)inputArray.getElement(i);
      Set<String> columns=row.labelSet();
      for (      String column : columns) {
        if (columnNames.length() != 0) {
          columnNames.append("String_Node_Str");
          values.append("String_Node_Str");
        }
        columnNames.append(column);
        values.append(row.get(column).toString());
      }
      String sql=prefix + columnNames.toString() + "String_Node_Str"+ values.toString()+ "String_Node_Str";
      if (_debugging) {
        _debug("String_Node_Str" + sql);
      }
      database.execute(sql,false);
    }
  }
  _succeeded=true;
}
Program: 74296
Project: 74296
Buggy source:
/** 
 * If the attribute is the channel, increment the workspace version to force cached receiver lists to be updated, and invalidate the schedule and resolved types of the director, if there is one.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the change is not acceptableto this container.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == channel) {
    if (!isWithinClassDefinition()) {
      String newValue=channel.stringValue();
      if (!newValue.equals(_channel)) {
        _channel=newValue;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * If the attribute is the channel, increment the workspace version to force cached receiver lists to be updated, and invalidate the schedule and resolved types of the director, if there is one.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the change is not acceptableto this container.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == channel) {
    if (!isWithinClassDefinition()) {
      String newValue=channel.stringValue();
      if (!newValue.equals(_channel)) {
        _channel=newValue;
      }
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 74297
Project: 74297
Buggy source:
private void _transform(){
  _beginTransform();
  CompositeEntity currentModel=(CompositeEntity)getModel();
  CompositeEntity oldModel;
  try {
    oldModel=(CompositeEntity)GTTools.cleanupModel(currentModel,currentModel.workspace());
    currentModel.workspace().remove(currentModel);
    _delegateUndoStack(getModel(),oldModel);
    GraphTransformer.transform(_rule,_results.get(_currentPosition));
  }
 catch (  Exception e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
  _finishTransform(oldModel);
}

Fixed version (ground truth):
private void _transform(){
  _beginTransform();
  CompositeEntity currentModel=(CompositeEntity)getModel();
  CompositeEntity oldModel;
  try {
    oldModel=(CompositeEntity)GTTools.cleanupModel(currentModel);
    _delegateUndoStack(currentModel,oldModel);
    GraphTransformer.transform(_rule,_results.get(_currentPosition));
  }
 catch (  Exception e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
  _finishTransform(oldModel);
}
Program: 74298
Project: 74298
Buggy source:
private void _finishTransform(CompositeEntity oldModel){
  CompositeEntity currentModel=(CompositeEntity)getModel();
  CompositeEntity model;
  try {
    model=(CompositeEntity)GTTools.cleanupModel(currentModel);
    currentModel.workspace().remove(currentModel);
  }
 catch (  IllegalActionException e) {
    throw new InternalErrorException(currentModel,e,"String_Node_Str");
  }
  if (_topFrame == null) {
    GTFrameTools.changeModel(this,model,true,true,new UndoChangeModelAction(oldModel,_currentPosition));
  }
  _setTableauFactory(this,model);
  List<MatchResult> results=null;
  if (_rule != null) {
    Pattern pattern=_rule.getPattern();
    MatchResultRecorder recorder=new MatchResultRecorder();
    GraphMatcher matcher=new GraphMatcher();
    matcher.setMatchCallback(recorder);
    matcher.match(pattern,model);
    results=recorder.getResults();
  }
  setMatchResult(_rule,_sourceFileName,results);
  _closeSubviewers();
  _enableOrDisableActions();
  ((UpdateController)_getGraphModel()).startUpdate();
}

Fixed version (ground truth):
private void _finishTransform(CompositeEntity oldModel){
  CompositeEntity currentModel=(CompositeEntity)getModel();
  CompositeEntity model;
  Workspace workspace=currentModel.workspace();
  try {
    model=(CompositeEntity)GTTools.cleanupModel(currentModel,workspace);
    workspace.remove(currentModel);
  }
 catch (  IllegalActionException e) {
    throw new InternalErrorException(currentModel,e,"String_Node_Str");
  }
  if (_topFrame == null) {
    GTFrameTools.changeModel(this,model,true,true,new UndoChangeModelAction(oldModel,_currentPosition));
  }
  _setTableauFactory(this,model);
  List<MatchResult> results=null;
  if (_rule != null) {
    Pattern pattern=_rule.getPattern();
    MatchResultRecorder recorder=new MatchResultRecorder();
    GraphMatcher matcher=new GraphMatcher();
    matcher.setMatchCallback(recorder);
    matcher.match(pattern,model);
    results=recorder.getResults();
  }
  setMatchResult(_rule,_sourceFileName,results);
  _closeSubviewers();
  _enableOrDisableActions();
  ((UpdateController)_getGraphModel()).startUpdate();
}
Program: 74299
Project: 74299
Buggy source:
public void execute() throws Exception {
  MatchResultViewer viewer=MatchResultViewer.this;
  CompositeEntity currentModel=(CompositeEntity)getModel();
  CompositeEntity oldModel=(CompositeEntity)GTTools.cleanupModel(currentModel);
  currentModel.workspace().remove(currentModel);
  _delegateUndoStack(getModel(),oldModel);
  ModelChangeRequest request=new ModelChangeRequest(viewer,viewer,_model,new UndoChangeModelAction(oldModel,_currentPosition));
  request.setUndoable(true);
  request.execute();
  List<MatchResult> results=null;
  if (_rule != null) {
    Pattern pattern=_rule.getPattern();
    MatchResultRecorder recorder=new MatchResultRecorder();
    GraphMatcher matcher=new GraphMatcher();
    matcher.setMatchCallback(recorder);
    matcher.match(pattern,_model);
    results=recorder.getResults();
  }
  setMatchResult(_rule,_sourceFileName,results,_position);
  _closeSubviewers();
  _enableOrDisableActions();
}

Fixed version (ground truth):
public void execute() throws Exception {
  MatchResultViewer viewer=MatchResultViewer.this;
  CompositeEntity currentModel=(CompositeEntity)getModel();
  CompositeEntity oldModel=(CompositeEntity)GTTools.cleanupModel(currentModel);
  _delegateUndoStack(currentModel,oldModel);
  ModelChangeRequest request=new ModelChangeRequest(viewer,viewer,_model,new UndoChangeModelAction(oldModel,_currentPosition));
  request.setUndoable(true);
  request.execute();
  List<MatchResult> results=null;
  if (_rule != null) {
    Pattern pattern=_rule.getPattern();
    MatchResultRecorder recorder=new MatchResultRecorder();
    GraphMatcher matcher=new GraphMatcher();
    matcher.setMatchCallback(recorder);
    matcher.match(pattern,_model);
    results=recorder.getResults();
  }
  setMatchResult(_rule,_sourceFileName,results,_position);
  _closeSubviewers();
  _enableOrDisableActions();
}
Program: 74300
Project: 74300
Buggy source:
private void _delegateUndoStack(NamedObj from,NamedObj to) throws CloneNotSupportedException, IllegalActionException, NameDuplicationException {
  UndoStackAttribute prevStack=UndoStackAttribute.getUndoInfo(from);
  UndoStackAttribute stack=(UndoStackAttribute)prevStack.clone();
  stack.setContainer(to);
}

Fixed version (ground truth):
private void _delegateUndoStack(NamedObj from,NamedObj to) throws CloneNotSupportedException, IllegalActionException, NameDuplicationException {
  UndoStackAttribute prevStack=UndoStackAttribute.getUndoInfo(from);
  UndoStackAttribute stack=(UndoStackAttribute)prevStack.clone(to.workspace());
  stack.setContainer(to);
}
Program: 74301
Project: 74301
Buggy source:
private void _transformUntilFixpoint(){
  _beginTransform();
  CompositeEntity currentModel=(CompositeEntity)getModel();
  CompositeEntity oldModel;
  try {
    oldModel=(CompositeEntity)GTTools.cleanupModel(currentModel);
    currentModel.workspace().remove(currentModel);
    _delegateUndoStack(getModel(),oldModel);
    GraphMatcher matcher=null;
    int i=0;
    while (!_results.isEmpty()) {
      int pos=(int)(Math.random() * _results.size());
      GraphTransformer.transform(_rule,_results.get(pos));
      MatchResultRecorder recorder=new MatchResultRecorder();
      if (matcher == null) {
        matcher=new GraphMatcher();
      }
      matcher.setMatchCallback(recorder);
      matcher.match(_rule.getPattern(),currentModel);
      _results=recorder.getResults();
      if (i >= 0) {
        i++;
      }
      if (i >= _PROMPT_TO_CONTINUE_COUNT && !_results.isEmpty()) {
        boolean answer=MessageHandler.yesNoQuestion("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + _PROMPT_TO_CONTINUE_COUNT + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
        if (!answer) {
          break;
        }
        i=-1;
      }
    }
  }
 catch (  Exception e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
  _finishTransform(oldModel);
}

Fixed version (ground truth):
private void _transformUntilFixpoint(){
  _beginTransform();
  CompositeEntity currentModel=(CompositeEntity)getModel();
  CompositeEntity oldModel;
  try {
    oldModel=(CompositeEntity)GTTools.cleanupModel(currentModel);
    _delegateUndoStack(getModel(),oldModel);
    GraphMatcher matcher=null;
    int i=0;
    while (!_results.isEmpty()) {
      int pos=(int)(Math.random() * _results.size());
      GraphTransformer.transform(_rule,_results.get(pos));
      MatchResultRecorder recorder=new MatchResultRecorder();
      if (matcher == null) {
        matcher=new GraphMatcher();
      }
      matcher.setMatchCallback(recorder);
      matcher.match(_rule.getPattern(),currentModel);
      _results=recorder.getResults();
      if (i >= 0) {
        i++;
      }
      if (i >= _PROMPT_TO_CONTINUE_COUNT && !_results.isEmpty()) {
        boolean answer=MessageHandler.yesNoQuestion("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + _PROMPT_TO_CONTINUE_COUNT + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
        if (!answer) {
          break;
        }
        i=-1;
      }
    }
  }
 catch (  Exception e) {
    MessageHandler.error("String_Node_Str",e);
    return;
  }
  _finishTransform(oldModel);
}
Program: 74302
Project: 74302
Buggy source:
private void _showInDefaultEditor(){
  boolean modified=isModified();
  setModified(false);
  close();
  try {
    CompositeEntity currentModel=(CompositeEntity)getModel();
    CompositeEntity model=(CompositeEntity)GTTools.cleanupModel(currentModel);
    currentModel.workspace().remove(currentModel);
    Tableau tableau=getFrameController().getConfiguration().openModel(model);
    ((Effigy)tableau.getContainer()).uri.setURI(null);
    String name=model.getName();
    if (name.equals("String_Node_Str")) {
      name="String_Node_Str";
    }
    tableau.setTitle(name);
    Frame frame=tableau.getFrame();
    if (modified && (frame instanceof TableauFrame)) {
      ((TableauFrame)tableau.getFrame()).setModified(true);
    }
  }
 catch (  Exception e) {
    MessageHandler.error("String_Node_Str" + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void _showInDefaultEditor(){
  boolean modified=isModified();
  setModified(false);
  close();
  try {
    CompositeEntity currentModel=(CompositeEntity)getModel();
    Workspace workspace=currentModel.workspace();
    CompositeEntity model=(CompositeEntity)GTTools.cleanupModel(currentModel,workspace);
    workspace.remove(currentModel);
    Tableau tableau=getFrameController().getConfiguration().openModel(model);
    ((Effigy)tableau.getContainer()).uri.setURI(null);
    String name=model.getName();
    if (name.equals("String_Node_Str")) {
      name="String_Node_Str";
    }
    tableau.setTitle(name);
    Frame frame=tableau.getFrame();
    if (modified && (frame instanceof TableauFrame)) {
      ((TableauFrame)tableau.getFrame()).setModified(true);
    }
  }
 catch (  Exception e) {
    MessageHandler.error("String_Node_Str" + "String_Node_Str",e);
  }
}
Program: 74303
Project: 74303
Buggy source:
/** 
 * Return true if the container entity is opaque.
 * @return True if the container entity is opaque.
 */
public boolean isOpaque(){
  long workspaceVersion=_workspace.getVersion();
  if (_isOpaqueVersion != workspaceVersion) {
    ComponentEntity entity=(ComponentEntity)getContainer();
    if (entity == null) {
      _isOpqaue=true;
    }
 else {
      _isOpqaue=entity.isOpaque();
    }
    _isOpaqueVersion=workspaceVersion;
  }
  return _isOpqaue;
}

Fixed version (ground truth):
/** 
 * Return true if the container entity is opaque.
 * @return True if the container entity is opaque.
 */
public boolean isOpaque(){
  long workspaceVersion=_workspace.getVersion();
  if (_isOpaqueVersion != workspaceVersion) {
    ComponentEntity entity=(ComponentEntity)getContainer();
    if (entity == null) {
      _isOpaque=true;
    }
 else {
      _isOpaque=entity.isOpaque();
    }
    _isOpaqueVersion=workspaceVersion;
  }
  return _isOpaque;
}
Program: 74304
Project: 74304
Buggy source:
/** 
 * Clone the controller into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new actor.
 * @param workspace The workspace for the new controller.
 * @return A new ERGController.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ERGController controller=(ERGController)super.clone(workspace);
  controller._executiveDirector=null;
  controller._executiveDirectorVersion=-1;
  return controller;
}

Fixed version (ground truth):
/** 
 * Clone the controller into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new actor.
 * @param workspace The workspace for the new controller.
 * @return A new ERGController.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ERGController controller=(ERGController)super.clone(workspace);
  controller._executiveDirector=null;
  controller._executiveDirectorVersion=-1;
  controller.director=(ERGDirector)controller.getAttribute("String_Node_Str");
  return controller;
}
Program: 74305
Project: 74305
Buggy source:
/** 
 * Clone the director into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new director.
 * @param workspace The workspace for the new director.
 * @return A new director.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ERGDirector newObject=(ERGDirector)super.clone(workspace);
  newObject._controller=null;
  newObject._controllerVersion=-1;
  newObject._eventComparator=new EventComparator();
  newObject._eventQueue=new PriorityQueue<TimedEvent>(10,newObject._eventComparator);
  newObject._eventInstanceList=null;
  newObject._eventInstanceTable=new HashMap<TimedEvent,List<TimedEvent>>();
  newObject._eventsListeningToPorts=new HashMap<Port,Set<TimedEvent>>();
  newObject._eventsListeningToVariables=new HashMap<Variable,Set<TimedEvent>>();
  newObject._refinementQueue=new PriorityQueue<TimedEvent>(5,newObject._eventComparator);
  newObject._scheduledRefinements=new HashSet<TypedActor>();
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the director into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new director.
 * @param workspace The workspace for the new director.
 * @return A new director.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ERGDirector newObject=(ERGDirector)super.clone(workspace);
  newObject._controller=null;
  newObject._controllerVersion=-1;
  newObject._eventComparator=newObject.new EventComparator();
  newObject._eventQueue=new PriorityQueue<TimedEvent>(10,newObject._eventComparator);
  newObject._eventInstanceList=null;
  newObject._eventInstanceTable=new HashMap<TimedEvent,List<TimedEvent>>();
  newObject._eventsListeningToPorts=new HashMap<Port,Set<TimedEvent>>();
  newObject._eventsListeningToVariables=new HashMap<Variable,Set<TimedEvent>>();
  newObject._refinementQueue=new PriorityQueue<TimedEvent>(5,newObject._eventComparator);
  newObject._scheduledRefinements=new HashSet<TypedActor>();
  return newObject;
}
Program: 74308
Project: 74308
Buggy source:
/** 
 * Return invocation of node for a port closest to a given time.
 * @param port
 * @param upper
 * @return
 */
private Node _getLastNodeBeforeTime(IOPort port,Time upper){
  List<Node> nodes=(List<Node>)_graph.nodes();
  Node lastNodeBeforeTime=null;
  Time time=Time.NEGATIVE_INFINITY;
  for (  Node node : nodes) {
    TDLAction gnode=(TDLAction)node.getWeight();
    if (gnode.object.equals(port) && upper.compareTo(gnode.time) >= 0 && time.compareTo(gnode.time) < 0) {
      lastNodeBeforeTime=node;
      time=gnode.time;
    }
  }
  return lastNodeBeforeTime;
}

Fixed version (ground truth):
/** 
 * Return invocation of node for a port closest to a given time.
 * @param port
 * @param upper
 * @return
 */
private Node _getLastNodeBeforeTime(IOPort port,Time upper){
  List<Node> nodes=(List<Node>)_graph.nodes();
  Node lastNodeBeforeTime=null;
  Time time=Time.NEGATIVE_INFINITY;
  for (  Node node : nodes) {
    TDLAction gnode=(TDLAction)node.getWeight();
    if (gnode.object != null && gnode.object.equals(port) && upper.compareTo(gnode.time) >= 0 && time.compareTo(gnode.time) < 0) {
      lastNodeBeforeTime=node;
      time=gnode.time;
    }
  }
  return lastNodeBeforeTime;
}