nus-yam/ex-repair huggingface dataset:
Program: 72830
Project: 72830
Buggy source:
/** 
 * When startOrResume(event_list) is called, the wrapper checks if the Metro event associated with  the current state is notified. If the event is notified, call related function of the  wrapped actor, transition to the next state, and propose the Metro event associated with  the next state. Otherwise stay in the current state. The 'next' state is defined as follows:  PREFIRE_BEGIN -> PREFIRE_END_FIRE_BEGIN -> FIRING -> FIRE_END_POSTFIRE_BEGIN -> POSTFIRE_END -> PREFIRE_BEGIN. The outgoing transitions for PREFIRE_BEGIN is as follows:   guard: PREFIRE_BEGIN is notified    action: call prefire(), propose FIRE_BEGIN PREFIRE_BEGIN ---------------------------------------> PREFIRE_END_FIRE_BEGIN guard: PREFIRE_BEGIN is not notified    action: propose PREFIRE_BEGIN PREFIRE_BEGIN ---------------------------------------> PREFIRE_BEGIN 'propose' means setting the state of the Metro event to be 'PROPOSED' and adding it into  event_list (the parameter of startOrResume(event_list)). Thus the caller of startOrResume  will get a reference to the proposed event. 
 * @param metroIIEventList a list of MetroII events that are proposed. It is set by startOrResume()not the caller.
 * @throws IllegalActionException If firing is not permitted.
 */
@Override public void startOrResume(LinkedList<Builder> metroIIEventList) throws IllegalActionException {
}

Fixed version (ground truth):
/** 
 * When startOrResume(event_list) is called, the wrapper checks if the Metro event associated with the current state is notified. If the event is notified, call related function of the wrapped actor, transition to the next state, and propose the Metro event associated with the next state. Otherwise stay in the current state. The 'next' state is defined as follows: PREFIRE_BEGIN -> PREFIRE_END_FIRE_BEGIN -> FIRING -> FIRE_END_POSTFIRE_BEGIN -> POSTFIRE_END -> PREFIRE_BEGIN. <pre> The outgoing transitions for PREFIRE_BEGIN is as follows:   guard: PREFIRE_BEGIN is notified    action: call prefire(), propose FIRE_BEGIN PREFIRE_BEGIN ---------------------------------------> PREFIRE_END_FIRE_BEGIN guard: PREFIRE_BEGIN is not notified    action: propose PREFIRE_BEGIN PREFIRE_BEGIN ---------------------------------------> PREFIRE_BEGIN </pre> <p> 'propose' means setting the state of the Metro event to be 'PROPOSED' and adding it into event_list (the parameter of startOrResume(event_list)). Thus the caller of startOrResume will get a reference to the proposed event. </p>
 * @param metroIIEventList a list of MetroII events that are proposed. It is set by startOrResume() not the caller.
 * @throws IllegalActionException If firing is not permitted.
 */
@Override public void startOrResume(LinkedList<Builder> metroIIEventList) throws IllegalActionException {
}
Program: 72831
Project: 72831
Buggy source:
/** 
 * When startOrResume(event_list) is called, the wrapper checks if the Metro event associated with  the current state is notified. If the event is notified, call related function of the  wrapped actor, transition to the next state, and propose the Metro event associated with  the next state. Otherwise stay in the current state. The 'next' state is defined as follows:  PREFIRE_BEGIN -> PREFIRE_END_FIRE_BEGIN -> FIRING -> FIRE_END_POSTFIRE_BEGIN -> POSTFIRE_END -> PREFIRE_BEGIN. The outgoing transitions for PREFIRE_BEGIN is as follows:   guard: PREFIRE_BEGIN is notified    action: call prefire(), propose FIRE_BEGIN PREFIRE_BEGIN ---------------------------------------> PREFIRE_END_FIRE_BEGIN guard: PREFIRE_BEGIN is not notified    action: propose PREFIRE_BEGIN PREFIRE_BEGIN ---------------------------------------> PREFIRE_BEGIN 'propose' means setting the state of the Metro event to be 'PROPOSED' and adding it into  event_list (the parameter of startOrResume(event_list)). Thus the caller of startOrResume  will get a reference to the proposed event. 
 * @param metroIIEventList a list of MetroII events that are proposed. It is set by startOrResume()not the caller.
 */
@Override public void startOrResume(LinkedList<Builder> metroIIEventList) throws IllegalActionException {
}

Fixed version (ground truth):
/** 
 * When startOrResume(event_list) is called, the wrapper checks if the Metro event associated with  the current state is notified. If the event is notified, call related function of the  wrapped actor, transition to the next state, and propose the Metro event associated with  the next state. Otherwise stay in the current state. The 'next' state is defined as follows:  PREFIRE_BEGIN -> PREFIRE_END_FIRE_BEGIN -> FIRING -> FIRE_END_POSTFIRE_BEGIN -> POSTFIRE_END -> PREFIRE_BEGIN. The outgoing transitions for PREFIRE_BEGIN is as follows:   guard: PREFIRE_BEGIN is notified    action: call prefire(), propose FIRE_BEGIN PREFIRE_BEGIN ---------------------------------------> PREFIRE_END_FIRE_BEGIN guard: PREFIRE_BEGIN is not notified    action: propose PREFIRE_BEGIN PREFIRE_BEGIN ---------------------------------------> PREFIRE_BEGIN 'propose' means setting the state of the Metro event to be 'PROPOSED' and adding it into  event_list (the parameter of startOrResume(event_list)). Thus the caller of startOrResume  will get a reference to the proposed event. 
 * @param metroIIEventList a list of MetroII events that are proposed. It is set by startOrResume()not the caller.
 * @throws IllegalActionException If firing is not permitted.
 */
@Override public void startOrResume(LinkedList<Builder> metroIIEventList) throws IllegalActionException {
}
Program: 72832
Project: 72832
Buggy source:
/** 
 * When startOrResume() is called, the wrapper checks if the Metro event associated  with the current state is notified. If the event is notified, call related function  of the wrapped actor, transition to the next state, and propose the  Metro event associated with the next state. If the state is associated with no state  event, simply transition to the next state, and propose the Metro event associated with  the next state. The 'next' state is defined as follows: STAR -> BEGIN -> END -> FINAL.  For example,  action: propose FIRE_BEGIN START ---------------------------------------> BEGIN guard: FIRE_BEGIN is notified    action: call fire(), propose FIRE_END BEGIN ---------------------------------------> FIRE_END guard: FIRE_BEGIN is not notified    action: propose FIRE_BEGIN BEGIN ---------------------------------------> BEGIN
 * @param metroIIEventList a list of MetroII events that are proposed. It is set by startOrResume()not the caller.
 */
@Override public void startOrResume(LinkedList<Builder> metroIIEventList) throws IllegalActionException {
}

Fixed version (ground truth):
/** 
 * When startOrResume() is called, the wrapper checks if the Metro event associated  with the current state is notified. If the event is notified, call related function  of the wrapped actor, transition to the next state, and propose the  Metro event associated with the next state. If the state is associated with no state  event, simply transition to the next state, and propose the Metro event associated with  the next state. The 'next' state is defined as follows: STAR -> BEGIN -> END -> FINAL.  For example,  action: propose FIRE_BEGIN START ---------------------------------------> BEGIN guard: FIRE_BEGIN is notified    action: call fire(), propose FIRE_END BEGIN ---------------------------------------> FIRE_END guard: FIRE_BEGIN is not notified    action: propose FIRE_BEGIN BEGIN ---------------------------------------> BEGIN
 * @param metroIIEventList a list of MetroII events that are proposed. It is set by startOrResume()not the caller.
 * @throws IllegalActionException If firing is not permitted.
 */
@Override public void startOrResume(LinkedList<Builder> metroIIEventList) throws IllegalActionException {
}
Program: 72833
Project: 72833
Buggy source:
/** 
 * Update the MetroII events in the specified list
 * @param metroIIEventList A list of MetroII events to be updated
 */
public void resolve(Iterable<Event.Builder> metroIIEventList);

Fixed version (ground truth):
/** 
 * Update the MetroII events in the specified list.
 * @param metroIIEventList a list of MetroII events to be updated.
 */
public void resolve(Iterable<Event.Builder> metroIIEventList);
Program: 72834
Project: 72834
Buggy source:
/** 
 * Clone an EventDictionary
 */
public EventDictionary clone() throws CloneNotSupportedException {
  EventDictionary newObject=(EventDictionary)super.clone();
  newObject._eventName2ID=(Hashtable<String,Integer>)_eventName2ID.clone();
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone an EventDictionary.
 * @throws CloneNotSupportedException the object's class does not implement the Cloneable interface.
 */
@Override public EventDictionary clone() throws CloneNotSupportedException {
  EventDictionary newObject=(EventDictionary)super.clone();
  newObject._eventName2ID=(Hashtable<String,Integer>)_eventName2ID.clone();
  return newObject;
}
Program: 72835
Project: 72835
Buggy source:
/** 
 * Construct an EventDictionary
 */
public EventDictionary(){
  _eventName2ID=new Hashtable<String,Integer>();
}

Fixed version (ground truth):
/** 
 * Construct an EventDictionary.
 */
public EventDictionary(){
  _eventName2ID=new Hashtable<String,Integer>();
}
Program: 72836
Project: 72836
Buggy source:
private String _trimModelName(String name){
}

Fixed version (ground truth):
/** 
 * Trim the substring until (including) '.' from name.
 * @param name the input string.
 * @return
 */
private String _trimModelName(String name){
}
Program: 72837
Project: 72837
Buggy source:
/** 
 * Set the state of the wrapped actor.
 * @param state
 * @see #getState()
 */
protected void setState(State state){
  _state=state;
}

Fixed version (ground truth):
/** 
 * Set the state of the wrapped actor.
 * @param state the state to be set.
 * @see #getState()
 */
protected void setState(State state){
  _state=state;
}
Program: 72838
Project: 72838
Buggy source:
/** 
 * An implementation of getfire() has the ability to 'yield return' in getfire() by calling 'resultHandler.handleResult(events)'.
 * @param resultHandler Iterable of events 'yield returned'
 * @exception CollectionAbortedException
 */
public void getfire(ResultHandler<Iterable<Event.Builder>> resultHandler) throws CollectionAbortedException ;

Fixed version (ground truth):
/** 
 * An implementation of getfire() has the ability to 'yield return' in getfire() by calling 'resultHandler.handleResult(events)'.
 * @param resultHandler iterable of events 'yield returned'.
 * @exception CollectionAbortedException
 */
public void getfire(ResultHandler<Iterable<Event.Builder>> resultHandler) throws CollectionAbortedException ;
Program: 72839
Project: 72839
Buggy source:
/** 
 * Return the iterator for the caller function of getfire().
 * @return iterator
 */
public YieldAdapterIterable<Iterable<Event.Builder>> adapter();

Fixed version (ground truth):
/** 
 * Return the iterator for the caller function of getfire().
 * @return iterator the iterator for the caller function of getfire()
 */
public YieldAdapterIterable<Iterable<Event.Builder>> adapter();
Program: 72840
Project: 72840
Buggy source:
/** 
 * Return the size of edges.
 * @return the size of edges
 */
public int edgeSize(){
  return _edge.size();
}

Fixed version (ground truth):
/** 
 * Return the size of edges.
 * @return the size of edges.
 */
public int edgeSize(){
  return _edge.size();
}
Program: 72841
Project: 72841
Buggy source:
/** 
 * Construct a linked list
 */
public Graph(){
  _nodeConnection=new ArrayList<ArrayList<Integer>>();
  _edge=new ArrayList<Pair<Integer,Integer>>();
}

Fixed version (ground truth):
/** 
 * Construct a linked list.
 */
public Graph(){
  _nodeConnection=new ArrayList<ArrayList<Integer>>();
  _edge=new ArrayList<Pair<Integer,Integer>>();
}
Program: 72842
Project: 72842
Buggy source:
/** 
 * Clone the linked list
 */
public Graph clone() throws CloneNotSupportedException {
  Graph newObject=(Graph)super.clone();
  newObject._nodeConnection=(ArrayList<ArrayList<Integer>>)_nodeConnection.clone();
  newObject._edge=(ArrayList<Pair<Integer,Integer>>)_edge.clone();
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the linked list.
 * @throws CloneNotSupportedException the object's class does not implement the Cloneable interface.
 */
@Override public Graph clone() throws CloneNotSupportedException {
  Graph newObject=(Graph)super.clone();
  newObject._nodeConnection=(ArrayList<ArrayList<Integer>>)_nodeConnection.clone();
  newObject._edge=(ArrayList<Pair<Integer,Integer>>)_edge.clone();
  return newObject;
}
Program: 72843
Project: 72843
Buggy source:
/** 
 * Get the edge with the given edge ID
 * @param edgeId the edge Id
 * @return the edge
 */
public Pair<Integer,Integer> getEdge(int edgeId){
  return _edge.get(edgeId);
}

Fixed version (ground truth):
/** 
 * Get the edge with the given edge ID.
 * @param edgeId the edge Id.
 * @return the edge.
 */
public Pair<Integer,Integer> getEdge(int edgeId){
  return _edge.get(edgeId);
}
Program: 72844
Project: 72844
Buggy source:
/** 
 * Read mapping constraints from a file
 * @param filename Filename of the mapping constraint file.
 * @exception IOException
 */
public void readMapping(String filename) throws IOException {
}

Fixed version (ground truth):
/** 
 * Read mapping constraints from a file.
 * @param filename Filename of the mapping constraint file.
 * @exception IOException a failed or interrupted I/O operations has occurred.
 */
public void readMapping(String filename) throws IOException {
}
Program: 72845
Project: 72845
Buggy source:
/** 
 * Add a mapping constraint
 * @param eventName1 first event in the mapping
 * @param eventName2 second event in the mapping
 */
public void addMapping(String eventName1,String eventName2){
  _eventIDDictionary.add(eventName1);
  _eventIDDictionary.add(eventName2);
  int id1=_eventIDDictionary.getID(eventName1);
  int id2=_eventIDDictionary.getID(eventName2);
  _mapping.add(id1,id2);
}

Fixed version (ground truth):
/** 
 * Add a mapping constraint.
 * @param eventName1 first event in the mapping.
 * @param eventName2 second event in the mapping.
 */
public void addMapping(String eventName1,String eventName2){
  _eventIDDictionary.add(eventName1);
  _eventIDDictionary.add(eventName2);
  int id1=_eventIDDictionary.getID(eventName1);
  int id2=_eventIDDictionary.getID(eventName2);
  _mapping.add(id1,id2);
}
Program: 72846
Project: 72846
Buggy source:
/** 
 * Return the number of mapping constraints
 * @return the number of mapping constraints
 */
public int numConstraints(){
  return _mapping.edgeSize();
}

Fixed version (ground truth):
/** 
 * Return the number of mapping constraints.
 * @return the number of mapping constraints.
 */
public int numConstraints(){
  return _mapping.edgeSize();
}
Program: 72847
Project: 72847
Buggy source:
/** 
 * turn on debugging option
 */
public void turnOnDebugging(){
  _debugging=true;
}

Fixed version (ground truth):
/** 
 * Turn on debugging option.
 */
public void turnOnDebugging(){
  _debugging=true;
}
Program: 72848
Project: 72848
Buggy source:
/** 
 * turn off debugging option
 */
public void turnOffDebugging(){
  _debugging=false;
}

Fixed version (ground truth):
/** 
 * Turn off debugging option.
 */
public void turnOffDebugging(){
  _debugging=false;
}
Program: 72850
Project: 72850
Buggy source:
private void _add(Actor actor,Time executionTime) throws IllegalActionException {
  double priority=_getPriority(actor);
  boolean added=false;
  Object[] actors=_currentlyExecuting.toArray();
  _currentlyExecuting.clear();
  for (int i=0; i < actors.length; i++) {
    Actor actorInArray=(Actor)actors[i];
    double actorInArrayPriority=_getPriority(actorInArray);
    if (!added && priority > actorInArrayPriority) {
      _currentlyExecuting.push(actor);
      _remainingTimes.put(actor,executionTime);
      added=true;
    }
    _currentlyExecuting.push(actorInArray);
  }
}

Fixed version (ground truth):
private void _add(Actor actor,Time executionTime) throws IllegalActionException {
  double priority=_getPriority(actor);
  boolean added=false;
  Object[] actors=_currentlyExecuting.toArray();
  _currentlyExecuting.clear();
  for (int i=0; i < actors.length; i++) {
    Actor actorInArray=(Actor)actors[i];
    double actorInArrayPriority=_getPriority(actorInArray);
    if (!added && priority >= actorInArrayPriority) {
      _currentlyExecuting.push(actor);
      _remainingTimes.put(actor,executionTime);
      added=true;
    }
    _currentlyExecuting.push(actorInArray);
  }
}
Program: 72851
Project: 72851
Buggy source:
/** 
 * Parse the published item from the XMPP node, save the XML and request that the actor be fired. This method is declared in the smack ItemEventListener interface. This method is called when an item is published. NOTE: This method is synchronized, and the lock is _not_ released until the method is finished processing the current item event.  The first item event is completely processed before a second item event can be started.
 * @param items  The item event from the XMPP node.  Can containmultiple pieces of information.
 */
@Override public synchronized void handlePublishedItems(ItemPublishEvent<Item> items){
  while (!_hasInitialized) {
    try {
      this.wait(0);
    }
 catch (    InterruptedException e) {
      break;
    }
  }
  _handlePublishedItems(items);
}

Fixed version (ground truth):
/** 
 * Parse the published item from the XMPP node, save the XML and request that the actor be fired. This method is declared in the smack ItemEventListener interface. This method is called when an item is published. NOTE: This method is synchronized, and the lock is _not_ released until the method is finished processing the current item event.  The first item event is completely processed before a second item event can be started.
 * @param items  The item event from the XMPP node.  Can containmultiple pieces of information.
 */
@Override public synchronized void handlePublishedItems(ItemPublishEvent<Item> items){
  while (!_hasInitialized) {
    try {
      this.wait(0);
    }
 catch (    InterruptedException e) {
      break;
    }
  }
  _handlePublishedItems(items);
  this.notify();
}
Program: 72852
Project: 72852
Buggy source:
/** 
 * Parse the published item from the XMPP node, save the XML and request that the actor be fired.  Synchronized on a lock object so this method will release the lock on the lock object so the fire() method may execute, but retain the lock on XMPPSource.this object so that future invocations of handlePublishedItems() must block until the current invocation is finished.
 * @param items  The item event from the XMPP node.  Can containmultiple pieces of information.
 */
private void _handlePublishedItems(ItemPublishEvent<Item> items){
synchronized (lock) {
    _hasFired=false;
    PayloadItem<SimplePayload> item=(PayloadItem<SimplePayload>)items.getItems().get(0);
    SimplePayload payload=item.getPayload();
    _currentValue=payload.toXML();
    try {
      long elapsedRealTime=System.currentTimeMillis() - _initializeRealTime;
      Time timeOfRequest=_initializeModelTime.add(elapsedRealTime);
      getDirector().fireAt(XMPPSource.this,timeOfRequest);
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException(this,e,"String_Node_Str");
    }
    while (!_hasFired) {
      try {
        lock.wait(0);
      }
 catch (      InterruptedException e) {
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Parse the published item from the XMPP node, save the XML and request that the actor be fired.  Synchronized on a lock object so this method will release the lock on the lock object so the fire() method may execute, but retain the lock on XMPPSource.this object so that future invocations of handlePublishedItems() must block until the current invocation is finished.
 * @param items  The item event from the XMPP node.  Can containmultiple pieces of information.
 */
private void _handlePublishedItems(ItemPublishEvent<Item> items){
synchronized (lock) {
    _hasFired=false;
    PayloadItem<SimplePayload> item=(PayloadItem<SimplePayload>)items.getItems().get(0);
    SimplePayload payload=item.getPayload();
    _currentValue=payload.toXML();
    try {
      long elapsedRealTime=System.currentTimeMillis() - _initializeRealTime;
      elapsedRealTime=elapsedRealTime / 1000;
      Time timeOfRequest=_initializeModelTime.add(elapsedRealTime);
      getDirector().fireAt(XMPPSource.this,timeOfRequest);
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException(this,e,"String_Node_Str");
    }
    while (!_hasFired) {
      try {
        lock.wait(0);
      }
 catch (      InterruptedException e) {
        break;
      }
    }
  }
}
Program: 72854
Project: 72854
Buggy source:
/** 
 * Resume the execution of an actor that was previously blocked because it didn't have all the resources it needed for execution. This method  puts an event into the queue for the current time.
 * @param actor The actor that resumes execution.
 * @throws IllegalActionException Not thrown here but in derived classes.
 */
public void resumeActor(Actor actor) throws IllegalActionException {
  DEEvent event=_actorsInExecution.get(actor);
  Time time=((CompositeActor)_getResourceScheduler(actor).getContainer()).getDirector().getModelTime();
  if (event.ioPort() != null) {
    _enqueueTriggerEvent(event.ioPort(),time);
  }
 else {
    _enqueueEvent(actor,time,1);
  }
  fireContainerAt(time);
  _actorsInExecution.remove(actor);
  if (_actorsFinished == null) {
    _actorsFinished=new ArrayList();
  }
  _actorsFinished.add(actor);
}

Fixed version (ground truth):
/** 
 * Resume the execution of an actor that was previously blocked because it didn't have all the resources it needed for execution. This method  puts an event into the queue for the current time.
 * @param actor The actor that resumes execution.
 * @throws IllegalActionException Not thrown here but in derived classes.
 */
public void resumeActor(Actor actor) throws IllegalActionException {
  List<DEEvent> events=_actorsInExecution.get(actor);
  Time time=((CompositeActor)_getResourceScheduler(actor).getContainer()).getDirector().getModelTime();
  if (events == null || events.size() == 0) {
    events=null;
  }
  DEEvent event=events.get(0);
  events.remove(event);
  _actorsInExecution.put(actor,events);
  if (event.ioPort() != null) {
    _enqueueTriggerEvent(event.ioPort(),time);
  }
 else {
    _enqueueEvent(actor,time,1);
  }
  fireContainerAt(time);
  if (_actorsFinished == null) {
    _actorsFinished=new ArrayList();
  }
  _actorsFinished.add(actor);
}
Program: 72855
Project: 72855
Buggy source:
/** 
 * Invoke the wrapup() of the super class.  Leave and quit OpenModelica environment.
 * @throws IllegalActionException If the wrapup() ofOpenModelica actor throws it.
 */
public void wrapup() throws IllegalActionException {
  super.wrapup();
  try {
    _omcProxy.quitServer();
    String loggerInfo="String_Node_Str";
    _omcLogger.getInfo(loggerInfo);
  }
 catch (  ConnectException e) {
    new IllegalActionException("String_Node_Str").printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Invoke the wrapup() of the super class.  Leave and quit OpenModelica environment.
 * @throws IllegalActionException If the wrapup() ofOpenModelica actor throws it.
 */
public void wrapup() throws IllegalActionException {
  super.wrapup();
  try {
    _omcProxy.quitServer();
  }
 catch (  ConnectException e) {
    new IllegalActionException("String_Node_Str").printStackTrace();
  }
}
Program: 72856
Project: 72856
Buggy source:
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there).
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  OpenModelicaDirector newObject=(OpenModelicaDirector)super.clone(workspace);
  try {
    newObject._omcLogger=OMCLogger.getInstance();
    newObject._omcProxy=OMCProxy.getInstance();
  }
 catch (  Throwable throwable) {
    throw new CloneNotSupportedException("String_Node_Str" + getFullName() + "String_Node_Str"+ throwable);
  }
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there).
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  OpenModelicaDirector newObject=(OpenModelicaDirector)super.clone(workspace);
  try {
    newObject._omcProxy=OMCProxy.getInstance();
  }
 catch (  Throwable throwable) {
    throw new CloneNotSupportedException("String_Node_Str" + getFullName() + "String_Node_Str"+ throwable);
  }
  return newObject;
}
Program: 72857
Project: 72857
Buggy source:
/** 
 * Invoke the preinitialize() of the super class.  Preinitialize the OpenModelica actor and initialize the OpenModelica Compiler(OMC).
 * @throws IllegalActionException If the preinitialize() ofone of the associated actors throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  try {
    _omcLogger=OMCLogger.getInstance();
    _omcProxy=OMCProxy.getInstance();
    _omcProxy.initServer();
  }
 catch (  ConnectException e) {
    e.printStackTrace();
    throw new IllegalActionException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Invoke the preinitialize() of the super class.  Preinitialize the OpenModelica actor and initialize the OpenModelica Compiler(OMC).
 * @throws IllegalActionException If the preinitialize() ofone of the associated actors throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  try {
    _omcProxy=OMCProxy.getInstance();
    _omcProxy.initServer();
  }
 catch (  ConnectException e) {
    e.printStackTrace();
    throw new IllegalActionException("String_Node_Str" + e.getMessage());
  }
}
Program: 72859
Project: 72859
Buggy source:
/** 
 * load the Modelica file and library.  
 * @param fileName File which the model should be loaded from.
 * @param modelName Name of the model which should be built.
 * @throws ConnectException If commands couldn'tbe sent to the (OpenModelic Compiler)OMC.
 * @throws IllegalActionException 
 */
public void loadFile(String fileName,String modelName) throws ConnectException, IllegalActionException ;

Fixed version (ground truth):
/** 
 * load the Modelica file and library.  
 * @param fileName File which the model should be loaded from.
 * @param modelName Name of the model which should be built.
 * @throws ConnectException If commands couldn'tbe sent to the (OpenModelic Compiler)OMC.
 * @throws IllegalActionException 
 * @throws FileNotFoundException 
 */
public void loadFile(String fileName,String modelName) throws ConnectException ;
Program: 72860
Project: 72860
Buggy source:
/** 
 * Construct an OpenModelica Compiler(OMC) proxy. This constructor has no parameter.  This private Constructor prevents other class from instantiating. 
 */
private OMCProxy(){
  if (_fOMCThread == null) {
    _fOMCThread=new OMCThread();
  }
}

Fixed version (ground truth):
/** 
 * Construct an OpenModelica Compiler(OMC) proxy. This constructor has no parameter.  This private Constructor prevents other class from instantiating. 
 */
private OMCProxy(){
}
Program: 72862
Project: 72862
Buggy source:
/** 
 * Initialize the communication with the OpenModelica compiler(OMC) server.
 * @throws ConnectException If we're unable to start communicating withthe server.
 * @throws InterruptedException 
 */
public synchronized void initServer() throws ConnectException {
  _os=getOs();
  String strDate="String_Node_Str";
  Date date=new Date();
  SimpleDateFormat timeFormat=new SimpleDateFormat("String_Node_Str");
  strDate=timeFormat.format(date);
  _corbaSessionName=strDate;
  File file=new File(_getPathToObject());
  String stringifiedObjectReference=null;
  if (!file.exists()) {
    String loggerInfo="String_Node_Str";
    _omcLogger.getInfo(loggerInfo);
    _startServer();
  }
 else {
    String loggerInfo="String_Node_Str";
    _omcLogger.getInfo(loggerInfo);
  }
  try {
    stringifiedObjectReference=_readObjectFromFile();
    _setupOmcc(stringifiedObjectReference);
  }
 catch (  Throwable throwable) {
    throw new RuntimeException("String_Node_Str" + stringifiedObjectReference,throwable);
  }
  hasInitialized=true;
}

Fixed version (ground truth):
/** 
 * Initialize the communication with the OpenModelica compiler(OMC) server.
 * @throws ConnectException If we're unable to start communicating withthe server.
 * @throws InterruptedException 
 */
public synchronized void initServer() throws ConnectException {
  _os=getOs();
  String stringDate="String_Node_Str";
  Date date=new Date();
  SimpleDateFormat timeFormat=new SimpleDateFormat("String_Node_Str");
  stringDate=timeFormat.format(date);
  _corbaSession=stringDate;
  File file=new File(_getPathToObject());
  String stringifiedObjectReference=null;
  if (!file.exists()) {
    String loggerInfo="String_Node_Str";
    _omcLogger.getInfo(loggerInfo);
    _startServer();
  }
 else {
    String loggerInfo="String_Node_Str";
    _omcLogger.getInfo(loggerInfo);
  }
  try {
    stringifiedObjectReference=_readObjectFromFile();
    _setupOmcc(stringifiedObjectReference);
  }
 catch (  Throwable throwable) {
    throw new RuntimeException("String_Node_Str" + stringifiedObjectReference,throwable);
  }
  hasInitialized=true;
}
Program: 72864
Project: 72864
Buggy source:
/** 
 * Return the path to the (OpenModelica Compiler)OMC CORBA object that is stored on a disk.
 * @return String The path to the OMC CORBA object.
 */
private String _getPathToObject(){
  String fileName=null;
switch (getOs()) {
case UNIX:
    if (_username == null) {
      System.err.println("String_Node_Str");
      _username="String_Node_Str";
    }
  if (_corbaSessionName == null || _corbaSessionName.equalsIgnoreCase("String_Node_Str")) {
    fileName=_temp + "String_Node_Str" + _username+ "String_Node_Str";
  }
 else {
    fileName=_temp + "String_Node_Str" + _username+ "String_Node_Str"+ "String_Node_Str"+ _corbaSessionName;
  }
break;
case WINDOWS:
if (_corbaSessionName == null || _corbaSessionName.equalsIgnoreCase("String_Node_Str")) {
fileName=_temp + "String_Node_Str";
}
 else {
fileName=_temp + "String_Node_Str" + "String_Node_Str"+ _corbaSessionName;
}
break;
case MAC:
if (_username == null) {
System.err.println("String_Node_Str");
_username="String_Node_Str";
}
if (_corbaSessionName == null || _corbaSessionName.equalsIgnoreCase("String_Node_Str")) {
fileName=_temp + "String_Node_Str" + _username+ "String_Node_Str";
}
 else {
fileName=_temp + "String_Node_Str" + _username+ "String_Node_Str"+ "String_Node_Str"+ _corbaSessionName;
}
break;
}
if (_omcLogger == null) {
_omcLogger=OMCLogger.getInstance();
}
String loggerInfo="String_Node_Str" + fileName + "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
return fileName;
}

Fixed version (ground truth):
/** 
 * Return the path to the (OpenModelica Compiler)OMC CORBA object that is stored on a disk.
 * @return String The path to the OMC CORBA object.
 */
private String _getPathToObject(){
  String fileName=null;
switch (getOs()) {
case UNIX:
    if (_username == null) {
      System.err.println("String_Node_Str");
      _username="String_Node_Str";
    }
  if (_corbaSession == null || _corbaSession.equalsIgnoreCase("String_Node_Str")) {
    fileName=_temp + "String_Node_Str" + _username+ "String_Node_Str";
  }
 else {
    fileName=_temp + "String_Node_Str" + _username+ "String_Node_Str"+ "String_Node_Str"+ _corbaSession;
  }
break;
case WINDOWS:
if (_corbaSession == null || _corbaSession.equalsIgnoreCase("String_Node_Str")) {
fileName=_temp + "String_Node_Str";
}
 else {
fileName=_temp + "String_Node_Str" + "String_Node_Str"+ _corbaSession;
}
break;
case MAC:
if (_username == null) {
System.err.println("String_Node_Str");
_username="String_Node_Str";
}
if (_corbaSession == null || _corbaSession.equalsIgnoreCase("String_Node_Str")) {
fileName=_temp + "String_Node_Str" + _username+ "String_Node_Str";
}
 else {
fileName=_temp + "String_Node_Str" + _username+ "String_Node_Str"+ "String_Node_Str"+ _corbaSession;
}
break;
}
if (_omcLogger == null) {
_omcLogger=OMCLogger.getInstance();
}
String loggerInfo="String_Node_Str" + fileName + "String_Node_Str";
_omcLogger.getInfo(loggerInfo);
return fileName;
}
Program: 72865
Project: 72865
Buggy source:
/** 
 * Start the (OpenModelica Compiler)OMC server by starting OMCThread.
 * @throws ConnectException If OPENMODELICAHOME is not set and we could not find binary file in the path.
 */
private synchronized void _startServer() throws ConnectException {
  if (!_fOMCThreadHasBeenScheduled) {
    _fOMCThread.start();
    _fOMCThreadHasBeenScheduled=true;
synchronized (_fOMCThread) {
      try {
        _fOMCThread.wait(10000);
      }
 catch (      InterruptedException e) {
        new Exception(e.getMessage()).printStackTrace();
      }
    }
  }
synchronized (_fOMCThread) {
    _fOMCThread.notify();
  }
}

Fixed version (ground truth):
/** 
 * Start the (OpenModelica Compiler)OMC server by starting OMCThread.
 * @throws ConnectException If OPENMODELICAHOME is not set and we could not find binary file in the path.
 */
private synchronized void _startServer() throws ConnectException {
  if (!_fOMCThreadHasBeenScheduled) {
    _fOMCThread.start();
    _fOMCThreadHasBeenScheduled=true;
synchronized (_fOMCThread) {
      try {
        _fOMCThread.wait(10000);
      }
 catch (      InterruptedException e) {
        new Exception(e.getMessage()).printStackTrace();
      }
    }
  }
}
Program: 72866
Project: 72866
Buggy source:
/** 
 * Add a pure event to the queue of pure events.
 * @param actor Actor to fire.
 * @param time Time the actor should be fired at.
 * @param index Microstep the actor should be fired at.
 * @return The time the actor requested to be refired at.
 * @exception IllegalActionException If firing of the container doesn't succeed.
 */
public Time fireAt(Actor actor,Time time,int index) throws IllegalActionException {
  if (actor == this.getContainer()) {
    fireContainerAt(time);
    return time;
  }
  int newIndex=index;
  if (_currentLogicalTime != null) {
    if (_currentLogicalTime.compareTo(time) == 0 && index <= getIndex()) {
      if (!(actor instanceof CompositeActor) || ((CompositeActor)actor).getDirector().scheduleContainedActors()) {
        newIndex=Math.max(getIndex(),index) + 1;
      }
    }
  }
  if (_isInitializing) {
    _currentSourceTimestamp=time;
  }
  _pureEvents.put(new PtidesEvent(actor,null,time,newIndex,_getDepthOfActor(actor),_zeroTime,_currentSourceTimestamp));
  _currentSourceTimestamp=null;
  Time environmentTime=super.getEnvironmentTime();
  if (environmentTime.compareTo(time) <= 0) {
    fireContainerAt(time,newIndex);
  }
  return time;
}

Fixed version (ground truth):
/** 
 * Add a pure event to the queue of pure events.
 * @param actor Actor to fire.
 * @param time Time the actor should be fired at.
 * @param index Microstep the actor should be fired at.
 * @return The time the actor requested to be refired at.
 * @exception IllegalActionException If firing of the container doesn't succeed.
 */
public Time fireAt(Actor actor,Time time,int index) throws IllegalActionException {
  if (actor == this.getContainer()) {
    fireContainerAt(time);
    return time;
  }
  int newIndex=index;
  if (_currentLogicalTime != null) {
    if (_currentLogicalTime.compareTo(time) == 0 && index <= getIndex()) {
      if (!(actor instanceof CompositeActor) || ((CompositeActor)actor).getDirector().scheduleContainedActors()) {
        newIndex=Math.max(getIndex(),index) + 1;
      }
    }
  }
  if (_isInitializing) {
    _currentSourceTimestamp=time;
  }
  int depth=1;
  if (!(actor instanceof ResourceScheduler)) {
    depth=_getDepthOfActor(actor);
  }
  _pureEvents.put(new PtidesEvent(actor,null,time,newIndex,depth,_zeroTime,_currentSourceTimestamp));
  _currentSourceTimestamp=null;
  Time environmentTime=super.getEnvironmentTime();
  if (environmentTime.compareTo(time) <= 0) {
    fireContainerAt(time,newIndex);
  }
  return time;
}
Program: 72869
Project: 72869
Buggy source:
private int _getNumberOfFutureEventsFrom(Actor actor){
  HashMap<Actor,Integer> sinkActorEventQueueSize=new HashMap();
  int maxEvents=0;
  for (  Object object : actor.outputPortList()) {
    IOPort port=(IOPort)object;
    for (    Object sinkPort : port.sinkPortList()) {
      if (((IOPort)sinkPort).getContainer() == this.getContainer()) {
        for (        Time time : _outputEventDeadlines.keySet()) {
          maxEvents+=_outputEventDeadlines.get(time).size();
        }
      }
 else {
        maxEvents+=_numberOfTokensPerPort.get(sinkPort);
      }
    }
  }
  return maxEvents;
}

Fixed version (ground truth):
private int _getNumberOfFutureEventsFrom(Actor actor){
  HashMap<Actor,Integer> sinkActorEventQueueSize=new HashMap();
  int maxEvents=0;
  for (  Object object : actor.outputPortList()) {
    IOPort port=(IOPort)object;
    for (    Object sinkPort : port.sinkPortList()) {
      if (((IOPort)sinkPort).getContainer() == this.getContainer()) {
        for (        Time time : _outputEventDeadlines.keySet()) {
          maxEvents+=_outputEventDeadlines.get(time).size();
        }
      }
 else {
        if (_numberOfTokensPerPort == null) {
          _numberOfTokensPerPort=new HashMap<IOPort,Integer>();
        }
        Integer numberOfTokens=_numberOfTokensPerPort.get(sinkPort);
        if (numberOfTokens == null) {
          numberOfTokens=0;
        }
        maxEvents+=numberOfTokens;
      }
    }
  }
  return maxEvents;
}
Program: 72870
Project: 72870
Buggy source:
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an attribute with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  PtidesDirector newObject=(PtidesDirector)super.clone(workspace);
  try {
    newObject._clockSynchronizationErrorBound=new Time(newObject,0.0);
  }
 catch (  IllegalActionException e) {
  }
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is an attribute with no container.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException Not thrown in this base class
 * @return The new Attribute.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  PtidesDirector newObject=(PtidesDirector)super.clone(workspace);
  try {
    newObject._clockSynchronizationErrorBound=new Time(newObject,0.0);
    newObject._numberOfTokensPerPort=new HashMap<IOPort,Integer>();
  }
 catch (  IllegalActionException e) {
  }
  return newObject;
}
Program: 72871
Project: 72871
Buggy source:
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == observationProbabilities) {
    int nStates=((MatrixToken)observationProbabilities.getToken()).getRowCount();
    int nCat=((MatrixToken)observationProbabilities.getToken()).getColumnCount();
    for (int i=0; i < nStates; i++) {
      for (int j=0; j < nCat; j++) {
        _B0[i][j]=((DoubleToken)((MatrixToken)observationProbabilities.getToken()).getElementAsToken(i,j)).doubleValue();
      }
    }
  }
 else   if (attribute == nCategories) {
    int cat=((IntToken)nCategories.getToken()).intValue();
    if (cat <= 0) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
 else {
      _nCategories=cat;
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == observationProbabilities) {
    int nCat=((MatrixToken)observationProbabilities.getToken()).getColumnCount();
    _B0=new double[_nStates][nCat];
    for (int i=0; i < _nStates; i++) {
      for (int j=0; j < nCat; j++) {
        _B0[i][j]=((DoubleToken)((MatrixToken)observationProbabilities.getToken()).getElementAsToken(i,j)).doubleValue();
      }
    }
  }
 else   if (attribute == nCategories) {
    int cat=((IntToken)nCategories.getToken()).intValue();
    if (cat <= 0) {
      throw new IllegalActionException(this,"String_Node_Str");
    }
 else {
      _nCategories=cat;
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 72872
Project: 72872
Buggy source:
public void fire() throws IllegalActionException {
  super.fire();
  if ((_nStates != _transitionMatrix.length) || (_nStates != _priors.length) || (_nCategories != _B0[0].length)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  HashMap newEstimates=new HashMap();
  _transitionMatrix=_A0;
  _B=_B0;
  double[][] A_new=new double[_nStates][_nStates];
  double[][] B_new=new double[_nStates][_nCategories];
  for (int iterations=0; iterations < _nIterations; iterations++) {
    newEstimates=HMMAlphaBetaRecursion(_observations,_transitionMatrix,_priors,_nCategories);
    B_new=(double[][])newEstimates.get("String_Node_Str");
    A_new=(double[][])newEstimates.get("String_Node_Str");
    _transitionMatrix=A_new;
    _B=B_new;
    double likelihood=(Double)(newEstimates.get("String_Node_Str"));
    if ((likelihood - _likelihood) < _likelihoodThreshold || (likelihood - _likelihood) < 0.0) {
      break;
    }
 else {
      _likelihood=likelihood;
    }
  }
  double[] pi_new=(double[])newEstimates.get("String_Node_Str");
  Token[] pTokens=new Token[_nStates];
  for (int i=0; i < _nStates; i++) {
    pTokens[i]=new DoubleToken(pi_new[i]);
  }
  transitionMatrix.send(0,new DoubleMatrixToken(A_new));
  emissionEstimates.send(0,new DoubleMatrixToken(B_new));
  priorEstimates.send(0,new ArrayToken(pTokens));
}

Fixed version (ground truth):
public void fire() throws IllegalActionException {
  super.fire();
  if ((_nStates != _transitionMatrix.length) || (_nStates != _priors.length) || (_nCategories != _B0[0].length)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  boolean converged=_EMParameterEstimation();
  Token[] pTokens=new Token[_nStates];
  for (int i=0; i < _nStates; i++) {
    pTokens[i]=new DoubleToken(prior_new[i]);
  }
  transitionMatrix.send(0,new DoubleMatrixToken(A_new));
  emissionEstimates.send(0,new DoubleMatrixToken(B_new));
  priorEstimates.send(0,new ArrayToken(pTokens));
}
Program: 72873
Project: 72873
Buggy source:
/** 
 * Construct an actor in the specified container with the specified name.
 * @param container The container.
 * @param name The name of this adder within the container.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the name coincides withan actor already in the container.
 */
public AddSubtract(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  plus=new TypedIOPort(this,"String_Node_Str",true,false);
  plus.setMultiport(true);
  plus.setAutomaticTypeConversion(true);
  minus=new TypedIOPort(this,"String_Node_Str",true,false);
  minus.setMultiport(true);
  minus.setAutomaticTypeConversion(true);
  output=new TypedIOPort(this,"String_Node_Str",false,true);
  output.setTypeAtLeast(plus);
  output.setTypeAtLeast(minus);
  plus.setTypeSameAs(minus);
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct an actor in the specified container with the specified name.
 * @param container The container.
 * @param name The name of this adder within the container.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the name coincides withan actor already in the container.
 */
public AddSubtract(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  plus=new TypedIOPort(this,"String_Node_Str",true,false);
  plus.setMultiport(true);
  plus.setAutomaticTypeConversion(false);
  minus=new TypedIOPort(this,"String_Node_Str",true,false);
  minus.setMultiport(true);
  minus.setAutomaticTypeConversion(false);
  output=new TypedIOPort(this,"String_Node_Str",false,true);
  output.setTypeAtLeast(plus);
  output.setTypeAtLeast(minus);
  plus.setTypeSameAs(minus);
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 72875
Project: 72875
Buggy source:
private void _initialize(String[] labels,Token[] values) throws IllegalActionException {
  if (labels == null || values == null || labels.length != values.length) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  for (int i=0; i < labels.length; i++) {
    if (labels[i] == null || values[i] == null) {
      throw new IllegalActionException("String_Node_Str" + i + "String_Node_Str");
    }
    labels[i]=labels[i];
    if (!_fields.containsKey(labels[i])) {
      _fields.put(labels[i],values[i]);
    }
 else {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + labels[i]);
    }
  }
}

Fixed version (ground truth):
private void _initialize(String[] labels,Token[] values) throws IllegalActionException {
  if (labels == null || values == null || labels.length != values.length) {
    System.out.println(labels);
    System.out.println(values);
    System.out.println(labels.length);
    System.out.println(values.length);
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  for (int i=0; i < labels.length; i++) {
    if (labels[i] == null || values[i] == null) {
      throw new IllegalActionException("String_Node_Str" + i + "String_Node_Str");
    }
    labels[i]=labels[i];
    if (!_fields.containsKey(labels[i])) {
      _fields.put(labels[i],values[i]);
    }
 else {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + labels[i]);
    }
  }
}
Program: 72876
Project: 72876
Buggy source:
/** 
 * Invoke the solver directly, with a choice as to whether or not this solver should display its resolved concepts.
 * @param displayProperties  True if the solver should display itsproperties; false otherwise (for example, if it is called from another solver)
 * @return True if the invocation succeeds; otherwise false which means anerror has occurred during the process.
 */
public boolean invokeSolver(boolean displayProperties){
  boolean success=false;
  try {
    initialize();
    resolveConcepts();
    checkErrors();
    if (displayProperties) {
      displayConcepts();
    }
  }
 catch (  KernelException e) {
    reset();
    throw new InternalErrorException(e);
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Invoke the solver directly, with a choice as to whether or not this solver should display its resolved concepts.
 * @param displayProperties  True if the solver should display itsproperties; false otherwise (for example, if it is called from another solver)
 * @throws IllegalActionException If there is no ontology.
 */
public void invokeSolver(boolean displayProperties) throws IllegalActionException {
  Ontology ontology=getOntology();
  if (ontology == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  initialize();
  resolveConcepts();
  checkErrors();
  if (displayProperties) {
    displayConcepts();
  }
}