nus-yam/ex-repair huggingface dataset:
Program: 73116
Project: 73116
Buggy source:
@Override public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == action) {
    String string=((StringToken)action.getToken()).stringValue();
    variableName.setExpression(string);
    if (getContainer() instanceof CompositeActor) {
      CompositeActor container=(CompositeActor)getContainer();
      while (!container.getName().equals("String_Node_Str")) {
        if (container == container.toplevel()) {
          throw new IllegalActionException(this,"String_Node_Str");
        }
        container=(CompositeActor)getContainer();
      }
      if (container.getAttribute(string) == null) {
        try {
          Parameter parameter=new Parameter(container,string);
          parameter.setExpression("String_Node_Str");
        }
 catch (        NameDuplicationException e) {
        }
      }
    }
  }
  super.attributeChanged(attribute);
}

Fixed version (ground truth):
/** 
 * Upon choosing an error handling action, set the variableName of this actor and make sure the corresponding parameter is in the container.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == action) {
    String string=((StringToken)action.getToken()).stringValue();
    variableName.setExpression(string);
    if (getContainer() instanceof CompositeActor) {
      CompositeActor container=(CompositeActor)getContainer();
      while (!container.getName().equals("String_Node_Str")) {
        if (container == container.toplevel()) {
          throw new IllegalActionException(this,"String_Node_Str");
        }
        container=(CompositeActor)container.getContainer();
      }
      if (container.getAttribute(string) == null) {
        try {
          Parameter parameter=new Parameter(container,string);
          parameter.setExpression("String_Node_Str");
        }
 catch (        NameDuplicationException e) {
        }
      }
    }
  }
  super.attributeChanged(attribute);
}
Program: 73118
Project: 73118
Buggy source:
/** 
 * Handle a model error.
 * @param context The object in which the error occurred.
 * @param exception An exception that represents the error.
 * @return True if the error has been handled, or false if theerror is not handled.
 * @exception IllegalActionException If the handler handles theerror by throwing an exception.
 */
public boolean handleModelError(NamedObj context,IllegalActionException exception) throws IllegalActionException {
  _chooseErrorTransition(exception);
  if (_lastChosenTransitions.size() > 0) {
    throw exception;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Handle a model error.
 * @param context The object in which the error occurred.
 * @param exception An exception that represents the error.
 * @return True if the error has been handled, or false if theerror is not handled.
 * @exception IllegalActionException If the handler handles theerror by throwing an exception.
 */
public boolean handleModelError(NamedObj context,IllegalActionException exception) throws IllegalActionException {
  _chooseErrorTransition(exception);
  if (_lastChosenTransitions.size() > 0) {
    _modelErrorHandled=exception;
    return true;
  }
  return false;
}
Program: 73119
Project: 73119
Buggy source:
/** 
 * Create receivers and input variables for the input ports of this actor, and validate attributes of this actor, and attributes of the ports of this actor. Set current state to the initial state.
 * @exception IllegalActionException If this actor does not contain aninitial state.
 */
public void preinitialize() throws IllegalActionException {
  if (_initializables != null) {
    for (    Initializable initializable : _initializables) {
      initializable.preinitialize();
    }
  }
  _stopRequested=false;
  _reachedFinalState=false;
  _newIteration=true;
  _tokenListArrays=new Hashtable();
  _inputTokenMap.clear();
  errorMessage.setExpression("String_Node_Str");
  errorClass.setExpression("String_Node_Str");
  errorCause.setToken((Token)null);
  reset();
  if (_currentState != null) {
    List transitionList=_currentState.outgoingPort.linkedRelationList();
    if (_debugging) {
      _debug("String_Node_Str");
    }
    _chooseTransitions(transitionList,true,true);
    if (_lastChosenTransitions.size() == 0) {
      if (_debugging) {
        _debug("String_Node_Str");
      }
      _chooseTransitions(transitionList,false,true);
    }
    _commitLastChosenTransition();
    _transitionsPreviouslyChosenInIteration.clear();
  }
}

Fixed version (ground truth):
/** 
 * Create receivers and input variables for the input ports of this actor, and validate attributes of this actor, and attributes of the ports of this actor. Set current state to the initial state.
 * @exception IllegalActionException If this actor does not contain aninitial state.
 */
public void preinitialize() throws IllegalActionException {
  if (_initializables != null) {
    for (    Initializable initializable : _initializables) {
      initializable.preinitialize();
    }
  }
  _stopRequested=false;
  _reachedFinalState=false;
  _newIteration=true;
  _tokenListArrays=new Hashtable();
  _inputTokenMap.clear();
  errorMessage.setExpression("String_Node_Str");
  errorClass.setExpression("String_Node_Str");
  errorCause.setToken((Token)null);
  _modelErrorHandled=null;
  reset();
  if (_currentState != null) {
    List transitionList=_currentState.outgoingPort.linkedRelationList();
    if (_debugging) {
      _debug("String_Node_Str");
    }
    _chooseTransitions(transitionList,true,true);
    if (_lastChosenTransitions.size() == 0) {
      if (_debugging) {
        _debug("String_Node_Str");
      }
      _chooseTransitions(transitionList,false,true);
    }
    _commitLastChosenTransition();
    _transitionsPreviouslyChosenInIteration.clear();
  }
}
Program: 73126
Project: 73126
Buggy source:
/** 
 * Return the type constraints on all connections starting from the specified source port to all the ports in a group of destination ports.
 * @param source The source port.
 * @return A list of instances of Inequality.
 */
protected List<Inequality> _destinationTypeConstraints(TypedIOPort source){
  Iterator<IOPort> destinationPorts;
  List<Inequality> result=new LinkedList<Inequality>();
  boolean srcUndeclared=source.getTypeTerm().isSettable();
  if (source.isInput() && source.isOutput()) {
    List<IOPort> sinks=source.sinkPortList();
    sinks.addAll(source.insideSinkPortList());
    destinationPorts=sinks.iterator();
  }
 else   if (source.isInput()) {
    destinationPorts=source.insideSinkPortList().iterator();
  }
 else {
    destinationPorts=source.sinkPortList().iterator();
  }
  while (destinationPorts.hasNext()) {
    TypedIOPort destinationPort=(TypedIOPort)destinationPorts.next();
    boolean destUndeclared=destinationPort.getTypeTerm().isSettable();
    if (srcUndeclared || destUndeclared) {
      Inequality ineq=new Inequality(source.getTypeTerm(),destinationPort.getTypeTerm());
      result.add(ineq);
    }
    if (srcUndeclared) {
      if (isBackwardTypeInferenceEnabled()) {
        result.add(new Inequality(new GLBFunction(source),source.getTypeTerm()));
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Return the type constraints on all connections starting from the specified source port to all the ports in a group of destination ports.
 * @param source The source port.
 * @return A list of instances of Inequality.
 */
protected List<Inequality> _destinationTypeConstraints(TypedIOPort source){
  Iterator<IOPort> destinationPorts;
  List<Inequality> result=new LinkedList<Inequality>();
  boolean srcUndeclared=source.getTypeTerm().isSettable();
  if (source.isInput() && source.isOutput()) {
    List<IOPort> sinks=source.sinkPortList();
    sinks.addAll(source.insideSinkPortList());
    destinationPorts=sinks.iterator();
  }
 else   if (source.isInput()) {
    destinationPorts=source.insideSinkPortList().iterator();
  }
 else {
    destinationPorts=source.sinkPortList().iterator();
  }
  while (destinationPorts.hasNext()) {
    TypedIOPort destinationPort=(TypedIOPort)destinationPorts.next();
    boolean destUndeclared=destinationPort.getTypeTerm().isSettable();
    if (srcUndeclared || destUndeclared) {
      Inequality ineq=new Inequality(source.getTypeTerm(),destinationPort.getTypeTerm());
      result.add(ineq);
    }
  }
  if (srcUndeclared) {
    if (isBackwardTypeInferenceEnabled()) {
      result.add(new Inequality(new GLBFunction(source),source.getTypeTerm()));
    }
  }
  return result;
}
Program: 73127
Project: 73127
Buggy source:
public void publish(String nodeId,String value) throws IllegalActionException {
  Node n;
  LeafNode ln;
  try {
    if ((n=_manager.getNode(nodeId)) instanceof LeafNode) {
      ln=(LeafNode)n;
    }
 else {
      throw new IllegalActionException("String_Node_Str");
    }
  }
 catch (  XMPPException e) {
    try {
      ln=_manager.createNode(nodeId);
    }
 catch (    XMPPException e1) {
      throw new IllegalActionException("String_Node_Str" + nodeId + "String_Node_Str");
    }
  }
  ln.publish(new Item(value));
}

Fixed version (ground truth):
public void publish(String nodeId,String value) throws IllegalActionException {
  Node n;
  LeafNode ln;
  try {
    if ((n=_manager.getNode(nodeId)) instanceof LeafNode) {
      ln=(LeafNode)n;
    }
 else {
      throw new IllegalActionException("String_Node_Str");
    }
  }
 catch (  XMPPException e) {
    try {
      ln=_manager.createNode(nodeId);
    }
 catch (    XMPPException e1) {
      throw new IllegalActionException("String_Node_Str" + nodeId + "String_Node_Str");
    }
  }
  SimplePayload payload=new SimplePayload("String_Node_Str","String_Node_Str","String_Node_Str" + value + "String_Node_Str");
  PayloadItem<SimplePayload> item=new PayloadItem<SimplePayload>(null,payload);
  ln.publish(item);
}
Program: 73128
Project: 73128
Buggy source:
@Override public void handlePublishedItems(ItemPublishEvent<Item> items){
  _currentValue=items.getItems().toString();
  System.out.println("String_Node_Str");
  try {
    getDirector().fireAtCurrentTime(this);
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public void handlePublishedItems(ItemPublishEvent<Item> items){
  PayloadItem<SimplePayload> item=(PayloadItem<SimplePayload>)items.getItems().get(0);
  SimplePayload payload=item.getPayload();
  _currentValue=payload.toXML();
  System.out.println("String_Node_Str");
  try {
    getDirector().fireAtCurrentTime(this);
  }
 catch (  IllegalActionException e) {
    e.printStackTrace();
  }
}
Program: 73129
Project: 73129
Buggy source:
/** 
 * Increment the version number by one.
 */
public final synchronized void incrVersion(){
  notifyObservers();
  _version++;
}

Fixed version (ground truth):
/** 
 * Increment the version number by one.
 */
public final synchronized void incrVersion(){
  _version++;
}
Program: 73138
Project: 73138
Buggy source:
/** 
 * Return the current value of this monotonic function.
 * @return A Type.
 * @throws IllegalActionException If the type of the argumentcannot be determined.
 */
public Object getValue() throws IllegalActionException {
  Type type=_typeable.getType();
  return new ArrayType(type);
}

Fixed version (ground truth):
/** 
 * Return the current value of this monotonic function.
 * @return A Type.
 * @throws IllegalActionException If the type of the argumentcannot be determined.
 */
public Object getValue() throws IllegalActionException {
  Type type=_typeable.getType();
  if (_arrayLength > 0) {
    return new ArrayType(type,_arrayLength);
  }
 else {
    return new ArrayType(type);
  }
}
Program: 73139
Project: 73139
Buggy source:
/** 
 * Construct a ArrayElementTypeFunction whose argument is the type of the specified object.  
 * @param typeable A Typeable object.
 */
public ArrayOfTypesFunction(Typeable typeable){
  _typeable=typeable;
}

Fixed version (ground truth):
/** 
 * Construct a ArrayElementTypeFunction whose argument is the type of the specified object.  
 * @param typeable A Typeable object.
 * @param arrayLength The length of the array.
 */
public ArrayOfTypesFunction(Typeable typeable,int arrayLength){
  _typeable=typeable;
  _arrayLength=arrayLength;
}
Program: 73140
Project: 73140
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then creates new ports and parameters.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ArrayToSequence newObject=(ArrayToSequence)(super.clone(workspace));
  try {
    newObject.output.setTypeAtLeast(ArrayType.elementType(newObject.input));
    newObject.input.setTypeAtLeast(new ArrayOfTypesFunction(newObject.output));
  }
 catch (  IllegalActionException e) {
    throw new InternalErrorException(e);
  }
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then creates new ports and parameters.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ArrayToSequence newObject=(ArrayToSequence)(super.clone(workspace));
  try {
    newObject.output.setTypeAtLeast(ArrayType.elementType(newObject.input));
  }
 catch (  IllegalActionException e) {
    throw new InternalErrorException(e);
  }
  return newObject;
}
Program: 73141
Project: 73141
Buggy source:
/** 
 * Construct an actor with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public ArrayToSequence(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output.setTypeAtLeast(ArrayType.elementType(input));
  input.setTypeAtLeast(new ArrayOfTypesFunction(output));
  arrayLength=new Parameter(this,"String_Node_Str");
  arrayLength.setExpression("String_Node_Str");
  enforceArrayLength=new Parameter(this,"String_Node_Str");
  enforceArrayLength.setExpression("String_Node_Str");
  enforceArrayLength.setTypeEquals(BaseType.BOOLEAN);
  output_tokenProductionRate.setExpression("String_Node_Str");
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct an actor with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public ArrayToSequence(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output.setTypeAtLeast(ArrayType.elementType(input));
  arrayLength=new Parameter(this,"String_Node_Str");
  arrayLength.setExpression("String_Node_Str");
  enforceArrayLength=new Parameter(this,"String_Node_Str");
  enforceArrayLength.setExpression("String_Node_Str");
  enforceArrayLength.setTypeEquals(BaseType.BOOLEAN);
  output_tokenProductionRate.setExpression("String_Node_Str");
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
}
Program: 73145
Project: 73145
Buggy source:
/** 
 * Return the actor to fire in this iteration, or null if no actor should be fired. Since _checkForNextEvent() always returns true, this method will keep being called until it returns null.  
 * @exception IllegalActionException If _isSafeToProcess() throws it.
 */
protected Actor _getNextActorToFire() throws IllegalActionException {
  for (  PtidesEvent event : _pureEvents) {
    if (_isSafeToProcess(event)) {
      Time time=scheduleActor(event.actor());
      Boolean finished=actorFinished(event.actor());
      if (time != null && time.getDoubleValue() > 0.0) {
        fireContainerAt(getEnvironmentTime().add(time));
      }
      if (time == null || finished) {
        _currentLogicalTime=event.timeStamp();
        _pureEvents.poll();
        return event.actor();
      }
    }
  }
  for (  Object event : _eventQueue.toArray()) {
    if (_isSafeToProcess((PtidesEvent)event)) {
      Time time=scheduleActor(((PtidesEvent)event).actor());
      Boolean finished=actorFinished(((PtidesEvent)event).actor());
      if (time != null && time.getDoubleValue() > 0.0) {
        fireContainerAt(getEnvironmentTime().add(time));
      }
      if (time == null || finished) {
        _currentLogicalTime=((PtidesEvent)event).timeStamp();
        _removeEventsFromQueue((PtidesEvent)event);
        return ((PtidesEvent)event).actor();
      }
    }
  }
  _currentLogicalTime=null;
  return null;
}

Fixed version (ground truth):
/** 
 * Return the actor to fire in this iteration, or null if no actor should be fired. Since _checkForNextEvent() always returns true, this method will keep being called until it returns null.  
 * @exception IllegalActionException If _isSafeToProcess() throws it.
 */
protected Actor _getNextActorToFire() throws IllegalActionException {
  for (  PtidesEvent event : _pureEvents) {
    if (_isSafeToProcess(event)) {
      Time time=scheduleActor(event.actor());
      Boolean finished=actorFinished(event.actor());
      if (time != null && time.getDoubleValue() > 0.0) {
        fireContainerAt(getEnvironmentTime().add(time));
      }
      if (time == null || finished) {
        _currentLogicalTime=event.timeStamp();
        _pureEvents.remove(event);
        return event.actor();
      }
    }
  }
  for (  Object event : _eventQueue.toArray()) {
    if (_isSafeToProcess((PtidesEvent)event)) {
      Time time=scheduleActor(((PtidesEvent)event).actor());
      Boolean finished=actorFinished(((PtidesEvent)event).actor());
      if (time != null && time.getDoubleValue() > 0.0) {
        fireContainerAt(getEnvironmentTime().add(time));
      }
      if (time == null || finished) {
        _currentLogicalTime=((PtidesEvent)event).timeStamp();
        _removeEventsFromQueue((PtidesEvent)event);
        return ((PtidesEvent)event).actor();
      }
    }
  }
  _currentLogicalTime=null;
  return null;
}
Program: 73148
Project: 73148
Buggy source:
/** 
 * Return the number of iterations. <p>The number of iterations returned depends on the value of the <i>iterations</i> parameter and whether the container of the director is at the top level.  See the   {@link #interations} documentation for details.</p><p>Code that uses SDFDirector should call getIterations() instead of directly referring to the value of the <i>iterations</i> parameter.
 * @return the number of iterations
 * @exception If thrown while getting the value of theiterations parameter.
 */
public int getIterations() throws IllegalActionException {
  int iterationsValue=((IntToken)(iterations.getToken())).intValue();
  if (iterationsValue > 0) {
    return iterationsValue;
  }
  if (!isEmbedded()) {
    if (iterations.equals(_auto)) {
      return 1;
    }
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Return the number of iterations. <p>The number of iterations returned depends on the value of the <i>iterations</i> parameter and whether the container of the director is at the top level.  See the   {@link #interations} documentation for details.</p><p>Code that uses SDFDirector should call getIterations() instead of directly referring to the value of the <i>iterations</i> parameter.
 * @return the number of iterations
 * @exception If thrown while getting the value of theiterations parameter.
 */
public int getIterations() throws IllegalActionException {
  int iterationsValue=((IntToken)(iterations.getToken())).intValue();
  if (iterationsValue > 0) {
    return iterationsValue;
  }
  if (!isEmbedded()) {
    if (iterations.getToken().equals(_auto)) {
      return 1;
    }
  }
  return 0;
}
Program: 73150
Project: 73150
Buggy source:
/** 
 * Initialize all the actors and variables. Perform static analysis on  superdense dependencies between input ports in the topology.
 * @exception IllegalActionException If any of the methods containedin initialize() throw it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _calculateSuperdenseDependenices();
  _calculateDelayOffsets();
  for (  Object entity : ((CompositeActor)getContainer()).entityList()) {
    if (entity instanceof ResourceScheduler) {
      if (_resourceSchedulers == null) {
        _resourceSchedulers=new ArrayList();
      }
      _resourceSchedulers.add((ResourceScheduler)entity);
    }
  }
}

Fixed version (ground truth):
/** 
 * Initialize all the actors and variables. Perform static analysis on  superdense dependencies between input ports in the topology.
 * @exception IllegalActionException If any of the methods containedin initialize() throw it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _calculateSuperdenseDependenices();
  _calculateDelayOffsets();
  _resourceSchedulers=new ArrayList();
  _schedulerForActor=null;
  for (  Object entity : ((CompositeActor)getContainer()).entityList()) {
    if (entity instanceof ResourceScheduler) {
      _resourceSchedulers.add((ResourceScheduler)entity);
    }
  }
}
Program: 73151
Project: 73151
Buggy source:
/** 
 * Construct a JSONToToken actor with the given container and name.
 * @param container
 * @param name
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public JSONToToken(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  input.setTypeEquals(BaseType.STRING);
}

Fixed version (ground truth):
/** 
 * Construct a JSONToToken actor with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public JSONToToken(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  input.setTypeEquals(BaseType.STRING);
}
Program: 73152
Project: 73152
Buggy source:
/** 
 * Construct a TokenToJSON actor with the given container and name.
 * @param container
 * @param name
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public TokenToJSON(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output.setTypeEquals(BaseType.STRING);
}

Fixed version (ground truth):
/** 
 * Construct a TokenToJSON actor with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public TokenToJSON(CompositeEntity container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output.setTypeEquals(BaseType.STRING);
}
Program: 73155
Project: 73155
Buggy source:
/** 
 * Override the base class to wait until the inside thread terminates and then call super.wrapup().
 * @exception IllegalActionException If the wrapup() method ofone of the associated actors throws it.
 */
public void wrapup() throws IllegalActionException {
  Time environmentTime=ThreadedComposite.this.getExecutiveDirector().getModelTime();
  if (ThreadedComposite.this._debugging) {
    ThreadedComposite.this._debug("String_Node_Str","String_Node_Str" + environmentTime);
  }
synchronized (this) {
    _inputFrames.add(new TokenFrame(environmentTime,null,TokenFrame.STOP));
    notifyAll();
  }
  if (_exception != null) {
    throw new IllegalActionException(ThreadedComposite.this,_exception,"String_Node_Str");
  }
  if (_thread != null && _thread.isAlive()) {
    try {
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      _thread.join();
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
    }
 catch (    InterruptedException e) {
    }
  }
  super.wrapup();
}

Fixed version (ground truth):
/** 
 * Override the base class to wait until the inside thread terminates and then call super.wrapup().
 * @exception IllegalActionException If the wrapup() method ofone of the associated actors throws it.
 */
public void wrapup() throws IllegalActionException {
  Time environmentTime=ThreadedComposite.this.getExecutiveDirector().getModelTime();
  if (ThreadedComposite.this._debugging) {
    ThreadedComposite.this._debug("String_Node_Str","String_Node_Str" + environmentTime);
  }
synchronized (this) {
    _inputFrames.add(new TokenFrame(environmentTime,null,TokenFrame.STOP));
    notifyAll();
  }
  if (_exception != null) {
    throw new IllegalActionException(ThreadedComposite.this,_exception,"String_Node_Str");
  }
  if (_thread != null && _thread.isAlive()) {
    try {
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      _thread.join();
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      if (_exception != null) {
        throw new IllegalActionException(ThreadedComposite.this,_exception,"String_Node_Str");
      }
    }
 catch (    InterruptedException e) {
    }
  }
  super.wrapup();
}
Program: 73156
Project: 73156
Buggy source:
private Object _leastElementShared(Set<Object> subset){
  if (subset.size() == 1) {
    Object obj=subset.iterator().next();
    if (containsNodeWeight(obj)) {
      return obj;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 else   if (subset.size() == 2) {
    Iterator<Object> itr=subset.iterator();
    Object o1=itr.next();
    Object o2=itr.next();
    int i1=nodeLabel(o1);
    int i2=nodeLabel(o1);
    int result=_compareNodeId(i1,i2);
    if ((result == LOWER) || (result == SAME)) {
      return o1;
    }
 else     if (result == HIGHER) {
      return o2;
    }
 else {
      return null;
    }
  }
 else {
    int[] ids=new int[subset.size()];
    int i=0;
    for (    Object obj : subset) {
      ids[i]=nodeLabel(obj);
      i++;
    }
    return _leastElementNodeId(ids);
  }
}

Fixed version (ground truth):
private Object _leastElementShared(Set<Object> subset){
  if (subset.size() == 1) {
    Object obj=subset.iterator().next();
    if (containsNodeWeight(obj)) {
      return obj;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
 else   if (subset.size() == 2) {
    Iterator<Object> itr=subset.iterator();
    Object o1=itr.next();
    Object o2=itr.next();
    int i1=nodeLabel(o1);
    int i2=nodeLabel(o2);
    int result=_compareNodeId(i1,i2);
    if ((result == LOWER) || (result == SAME)) {
      return o1;
    }
 else     if (result == HIGHER) {
      return o2;
    }
 else {
      return null;
    }
  }
 else {
    int[] ids=new int[subset.size()];
    int i=0;
    for (    Object obj : subset) {
      ids[i]=nodeLabel(obj);
      i++;
    }
    return _leastElementNodeId(ids);
  }
}
Program: 73157
Project: 73157
Buggy source:
/** 
 * Override the base class to wait until the inside thread terminates and then call super.wrapup().
 * @exception IllegalActionException If the wrapup() method ofone of the associated actors throws it.
 */
public void wrapup() throws IllegalActionException {
  Time environmentTime=ThreadedComposite.this.getExecutiveDirector().getModelTime();
  if (ThreadedComposite.this._debugging) {
    ThreadedComposite.this._debug("String_Node_Str","String_Node_Str" + environmentTime);
  }
  _inputFrames.add(new TokenFrame(environmentTime,null,TokenFrame.STOP));
  if (_exception != null) {
    throw new IllegalActionException(ThreadedComposite.this,_exception,"String_Node_Str");
  }
  if (_thread != null && _thread.isAlive()) {
    try {
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      _thread.join();
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      if (_exception != null) {
        throw new IllegalActionException(ThreadedComposite.this,_exception,"String_Node_Str");
      }
    }
 catch (    InterruptedException e) {
    }
  }
  super.wrapup();
}

Fixed version (ground truth):
/** 
 * Override the base class to wait until the inside thread terminates and then call super.wrapup().
 * @exception IllegalActionException If the wrapup() method ofone of the associated actors throws it.
 */
public void wrapup() throws IllegalActionException {
  Time environmentTime=ThreadedComposite.this.getExecutiveDirector().getModelTime();
  if (ThreadedComposite.this._debugging) {
    ThreadedComposite.this._debug("String_Node_Str","String_Node_Str" + environmentTime);
  }
synchronized (this) {
    _inputFrames.add(new TokenFrame(environmentTime,null,TokenFrame.STOP));
    notifyAll();
  }
  if (_exception != null) {
    throw new IllegalActionException(ThreadedComposite.this,_exception,"String_Node_Str");
  }
  if (_thread != null && _thread.isAlive()) {
    try {
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      _thread.join();
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      if (_exception != null) {
        throw new IllegalActionException(ThreadedComposite.this,_exception,"String_Node_Str");
      }
    }
 catch (    InterruptedException e) {
    }
  }
  super.wrapup();
}
Program: 73159
Project: 73159
Buggy source:
/** 
 * Consume inputs (if any) and post a frame on the queue for the inside thread to consume. A frame will be posted even if there are no inputs if a refiring request has been made for the current time.
 * @return True if the inside thread is still alive.
 */
public boolean postfire() throws IllegalActionException {
  Time environmentTime=ThreadedComposite.this.getExecutiveDirector().getModelTime();
  if (ThreadedComposite.this._debugging) {
    ThreadedComposite.this._debug("String_Node_Str" + environmentTime);
  }
  boolean refireRequested=_fireAtTimes.remove(environmentTime);
  if (refireRequested || !_inputTokens.isEmpty()) {
    if (ThreadedComposite.this._debugging) {
      ThreadedComposite.this._debug("String_Node_Str" + _inputTokens.toString() + "String_Node_Str"+ environmentTime);
    }
    _inputFrames.add(new TokenFrame(environmentTime,_inputTokens,TokenFrame.EVENT));
    if (_delayValue >= 0.0) {
      Time responseTime=environmentTime.add(_delayValue);
      Time response=ThreadedComposite.this.getExecutiveDirector().fireAt(ThreadedComposite.this,responseTime);
      if (!response.equals(responseTime)) {
        throw new IllegalActionException(this,"String_Node_Str" + responseTime + "String_Node_Str"+ response);
      }
synchronized (this) {
        _outputTimes.add(responseTime);
      }
    }
    Thread.yield();
  }
  return _thread.isAlive();
}

Fixed version (ground truth):
/** 
 * Consume inputs (if any) and post a frame on the queue for the inside thread to consume. A frame will be posted even if there are no inputs if a refiring request has been made for the current time.
 * @return True if the inside thread is still alive.
 */
public boolean postfire() throws IllegalActionException {
  Time environmentTime=ThreadedComposite.this.getExecutiveDirector().getModelTime();
  if (ThreadedComposite.this._debugging) {
    ThreadedComposite.this._debug("String_Node_Str" + environmentTime);
  }
  boolean refireRequested=_fireAtTimes.remove(environmentTime);
  if (refireRequested || !_inputTokens.isEmpty()) {
    if (ThreadedComposite.this._debugging) {
      ThreadedComposite.this._debug("String_Node_Str" + _inputTokens.toString() + "String_Node_Str"+ environmentTime);
    }
synchronized (this) {
      _inputFrames.add(new TokenFrame(environmentTime,_inputTokens,TokenFrame.EVENT));
      notifyAll();
      if (_delayValue >= 0.0) {
        Time responseTime=environmentTime.add(_delayValue);
        Time response=ThreadedComposite.this.getExecutiveDirector().fireAt(ThreadedComposite.this,responseTime);
        if (!response.equals(responseTime)) {
          throw new IllegalActionException(this,"String_Node_Str" + responseTime + "String_Node_Str"+ response);
        }
        _outputTimes.add(responseTime);
      }
    }
    Thread.yield();
  }
  return _thread.isAlive();
}
Program: 73160
Project: 73160
Buggy source:
/** 
 * Override the base class to post a "stop frame" on the queue for the inside thread to stop.
 */
public void stop(){
  super.stop();
  Time environmentTime=ThreadedComposite.this.getExecutiveDirector().getModelTime();
  if (ThreadedComposite.this._debugging) {
    ThreadedComposite.this._debug("String_Node_Str" + environmentTime);
  }
  _inputFrames.add(new TokenFrame(environmentTime,null,TokenFrame.STOP));
synchronized (this) {
    notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * Override the base class to post a "stop frame" on the queue for the inside thread to stop.
 */
public void stop(){
  super.stop();
  Time environmentTime=ThreadedComposite.this.getExecutiveDirector().getModelTime();
  if (ThreadedComposite.this._debugging) {
    ThreadedComposite.this._debug("String_Node_Str" + environmentTime);
  }
synchronized (this) {
    _inputFrames.add(new TokenFrame(environmentTime,null,TokenFrame.STOP));
    notifyAll();
  }
}
Program: 73161
Project: 73161
Buggy source:
/** 
 * Clone the director into the specified workspace.
 * @param workspace The workspace for the new object.
 * @return A new director.
 * @exception CloneNotSupportedException If a derived class hashas an attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ThreadedDirector newObject=(ThreadedDirector)super.clone(workspace);
  newObject._exception=null;
  newObject._inputTokens=null;
  newObject._thread=null;
  newObject._outputTimes=new LinkedList<Time>();
  newObject._fireAtTimes=Collections.synchronizedSet(new HashSet<Time>());
  newObject._inputFrames=new LinkedBlockingQueue<TokenFrame>();
  newObject._outputFrames=new LinkedList<TokenFrame>();
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the director into the specified workspace.
 * @param workspace The workspace for the new object.
 * @return A new director.
 * @exception CloneNotSupportedException If a derived class hashas an attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ThreadedDirector newObject=(ThreadedDirector)super.clone(workspace);
  newObject._exception=null;
  newObject._inputTokens=null;
  newObject._thread=null;
  newObject._outputTimes=new LinkedList<Time>();
  newObject._fireAtTimes=Collections.synchronizedSet(new HashSet<Time>());
  newObject._inputFrames=new LinkedList<TokenFrame>();
  newObject._outputFrames=new LinkedList<TokenFrame>();
  return newObject;
}
Program: 73162
Project: 73162
Buggy source:
/** 
 * Start the inside thread.
 * @exception IllegalActionException If the initialize() method ofone of the inside actors throws it.
 */
public void initialize() throws IllegalActionException {
  _fireAtTimes.clear();
  _outputFrames.clear();
  _outputTimes.clear();
  _inputFrames.clear();
  _exception=null;
  super.initialize();
  _realStartTime=-1L;
  _inputFrames.clear();
  _outputFrames.clear();
  _synchronizeToRealTime=((BooleanToken)synchronizeToRealTime.getToken()).booleanValue();
  _thread=new CompositeThread();
  _thread.setPriority(Thread.MAX_PRIORITY);
  _thread.start();
}

Fixed version (ground truth):
/** 
 * Start the inside thread.
 * @exception IllegalActionException If the initialize() method ofone of the inside actors throws it.
 */
public synchronized void initialize() throws IllegalActionException {
  _fireAtTimes.clear();
  _outputFrames.clear();
  _outputTimes.clear();
  _inputFrames.clear();
  _exception=null;
  super.initialize();
  _realStartTime=-1L;
  _inputFrames.clear();
  _outputFrames.clear();
  _synchronizeToRealTime=((BooleanToken)synchronizeToRealTime.getToken()).booleanValue();
  _thread=new CompositeThread();
  _thread.setPriority(Thread.MAX_PRIORITY);
  _thread.start();
}
Program: 73164
Project: 73164
Buggy source:
/** 
 * Construct an instance of the attribute.
 * @param container The container.
 * @param name The name.
 * @throws IllegalActionException If the superclass throws it.
 * @throws NameDuplicationException If the superclass throws it.
 */
public WebServer(CompositeActor container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  port=new Parameter(this,"String_Node_Str");
  port.setTypeEquals(BaseType.INT);
  port.setExpression("String_Node_Str");
  applicationPath=new StringParameter(this,"String_Node_Str");
  applicationPath.setExpression("String_Node_Str");
  resourcePath=new StringParameter(this,"String_Node_Str");
  resourcePath.setExpression("String_Node_Str");
  resourceLocation=new FileParameter(this,"String_Node_Str");
  URI modelURI=URIAttribute.getModelURI(this);
  String path=modelURI.getPath().toString();
  int slash=path.lastIndexOf("String_Node_Str");
  if (slash != -1) {
    path=path.substring(0,slash);
  }
  resourceLocation.setExpression(path);
  temporaryFileLocation=new FileParameter(this,"String_Node_Str");
  temporaryFileLocation.setExpression("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct an instance of the attribute.
 * @param container The container.
 * @param name The name.
 * @throws IllegalActionException If the superclass throws it.
 * @throws NameDuplicationException If the superclass throws it.
 */
public WebServer(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  port=new Parameter(this,"String_Node_Str");
  port.setTypeEquals(BaseType.INT);
  port.setExpression("String_Node_Str");
  applicationPath=new StringParameter(this,"String_Node_Str");
  applicationPath.setExpression("String_Node_Str");
  resourcePath=new StringParameter(this,"String_Node_Str");
  resourcePath.setExpression("String_Node_Str");
  resourceLocation=new FileParameter(this,"String_Node_Str");
  URI modelURI=URIAttribute.getModelURI(this);
  String path;
  if (modelURI != null && modelURI.getPath() != null && !modelURI.getPath().isEmpty()) {
    path=modelURI.getPath().toString();
    int slash=path.lastIndexOf("String_Node_Str");
    if (slash != -1) {
      path=path.substring(0,slash);
    }
  }
 else {
    path="String_Node_Str";
  }
  resourceLocation.setExpression(path);
  temporaryFileLocation=new FileParameter(this,"String_Node_Str");
  temporaryFileLocation.setExpression("String_Node_Str");
}
Program: 73165
Project: 73165
Buggy source:
/** 
 * Clone the object into the specified workspace. This overrides the base class to set the association with iterationCount.
 * @param workspace The workspace for the new object.
 * @return A new NamedObj.
 * @exception CloneNotSupportedException If any of the attributescannot be cloned.
 * @see #exportMoML(Writer,int,String)
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  PtidesPlatform result=(PtidesPlatform)super.clone(workspace);
  try {
    List<PtidesPlatform> platformDirectors=result.attributeList(PtidesPlatformDirector.class);
    PtidesPlatform oldplatformDirector=platformDirectors.get(0);
    String platformDirectorName=oldplatformDirector.getName();
    oldplatformDirector.setContainer(null);
    PtidesPlatformDirector platformDirector=result.new PtidesPlatformDirector(workspace);
    platformDirector.setContainer(result);
    platformDirector.setName(platformDirectorName);
  }
 catch (  Throwable throwable) {
    new CloneNotSupportedException("String_Node_Str" + throwable);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. This overrides the base class to set the association with iterationCount.
 * @param workspace The workspace for the new object.
 * @return A new NamedObj.
 * @exception CloneNotSupportedException If any of the attributescannot be cloned.
 * @see #exportMoML(Writer,int,String)
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  PtidesPlatform result=(PtidesPlatform)super.clone(workspace);
  try {
    List<PtidesPlatformDirector> platformDirectors=result.attributeList(PtidesPlatformDirector.class);
    PtidesPlatformDirector oldplatformDirector=platformDirectors.get(0);
    String platformDirectorName=oldplatformDirector.getName();
    oldplatformDirector.setContainer(null);
    PtidesPlatformDirector platformDirector=result.new PtidesPlatformDirector(workspace);
    platformDirector.setContainer(result);
    platformDirector.setName(platformDirectorName);
  }
 catch (  Throwable throwable) {
    new CloneNotSupportedException("String_Node_Str" + throwable);
  }
  return result;
}
Program: 73166
Project: 73166
Buggy source:
/** 
 * Get the corresponding type in code generation from the given Ptolemy type.
 * @param type The given Ptolemy type.
 * @return The code generation type.
 * @exception IllegalActionException If the given ptolemy cannotbe resolved.
 */
public String codeGenType(Type type){
  String result=type == BaseType.INT ? "String_Node_Str" : type == BaseType.LONG ? "String_Node_Str" : type == BaseType.STRING ? "String_Node_Str" : type == BaseType.DOUBLE ? "String_Node_Str" : type == BaseType.BOOLEAN ? "String_Node_Str" : type == BaseType.UNSIGNED_BYTE ? "String_Node_Str" : type == PointerToken.POINTER ? "String_Node_Str" : type == BaseType.COMPLEX ? "String_Node_Str" : type.equals(BaseType.OBJECT) ? "String_Node_Str" : null;
  if (result == null) {
    if (type instanceof ArrayType) {
      result="String_Node_Str";
    }
 else     if (type instanceof MatrixType) {
      result="String_Node_Str";
    }
  }
  if (result == null || result.length() == 0) {
    if (type == BaseType.UNKNOWN) {
      System.out.println("String_Node_Str" + type + "String_Node_Str");
    }
 else {
      throw new InternalErrorException("String_Node_Str" + type + "String_Node_Str");
    }
  }
  if (result == null) {
    return null;
  }
  return result.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Get the corresponding type in code generation from the given Ptolemy type.
 * @param type The given Ptolemy type.
 * @return The code generation type.
 * @exception IllegalActionException If the given ptolemy cannotbe resolved.
 */
public String codeGenType(Type type){
  String result=type == BaseType.INT ? "String_Node_Str" : type == BaseType.LONG ? "String_Node_Str" : type == BaseType.STRING ? "String_Node_Str" : type == BaseType.DOUBLE ? "String_Node_Str" : type == BaseType.BOOLEAN ? "String_Node_Str" : type == BaseType.UNSIGNED_BYTE ? "String_Node_Str" : type == PointerToken.POINTER ? "String_Node_Str" : type == BaseType.COMPLEX ? "String_Node_Str" : type.equals(BaseType.OBJECT) ? "String_Node_Str" : null;
  if (result == null) {
    if (type instanceof ArrayType) {
      result="String_Node_Str";
    }
 else     if (type instanceof MatrixType) {
      result="String_Node_Str";
    }
  }
  if (result == null || result.length() == 0) {
    System.out.println("String_Node_Str" + type + "String_Node_Str");
  }
  if (result == null) {
    return null;
  }
  return result.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
}
Program: 73167
Project: 73167
Buggy source:
/** 
 * Clone the object into the specified workspace. This overrides the base class to set up the associations in the mirror ports and to set a flag indicating that cloning is complete.
 * @param workspace The workspace for the new object.
 * @return A new NamedObj.
 * @exception CloneNotSupportedException If any of the attributescannot be cloned.
 * @see #exportMoML(Writer,int,String)
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  MirrorComposite result=(MirrorComposite)super.clone(workspace);
  Iterator entities=result.entityList().iterator();
  while (entities.hasNext()) {
    Entity insideEntity=(Entity)entities.next();
    Iterator ports=result.portList().iterator();
    while (ports.hasNext()) {
      MirrorPort port=(MirrorPort)ports.next();
      Port insidePort=insideEntity.getPort(port.getName());
      if (insidePort instanceof MirrorPort) {
        port.setAssociatedPort((MirrorPort)insidePort);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Clone the object into the specified workspace. This overrides the base class to set up the associations in the mirror ports and to set a flag indicating that cloning is complete.
 * @param workspace The workspace for the new object.
 * @return A new NamedObj.
 * @exception CloneNotSupportedException If any of the attributescannot be cloned.
 * @see #exportMoML(Writer,int,String)
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  MirrorComposite result=(MirrorComposite)super.clone(workspace);
  Iterator entities=result.entityList().iterator();
  while (entities.hasNext()) {
    Entity insideEntity=(Entity)entities.next();
    Iterator ports=result.portList().iterator();
    while (ports.hasNext()) {
      IOPort port=(IOPort)ports.next();
      Port insidePort=insideEntity.getPort(port.getName());
      if (insidePort instanceof MirrorPort) {
        ((MirrorPort)port).setAssociatedPort((MirrorPort)insidePort);
      }
 else       if (insidePort instanceof ParameterMirrorPort) {
        ((ParameterMirrorPort)port).setAssociatedPort((ParameterMirrorPort)insidePort);
      }
    }
  }
  return result;
}