nus-yam/ex-repair huggingface dataset:
Program: 73984
Project: 73984
Buggy source:
/** 
 * Initialize the actors and request a refiring at the current time of the executive director. This overrides the base class to throw an exception if there is no executive director.
 * @exception IllegalActionException If the superclass throwsit or if there is no executive director.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _currentlyExecutingStack=new Stack<DoubleTimedEvent>();
  _realTimeInputEventQueue=new PriorityQueue<RealTimeEvent>();
  _realTimeOutputEventQueue=new PriorityQueue<RealTimeEvent>();
  _lastConsumedTag=new HashMap<NamedObj,Tag>();
  _physicalTimeExecutionStarted=null;
  NamedObj container=getContainer();
  if (!(container instanceof Actor)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Director executiveDirector=((Actor)container).getExecutiveDirector();
  if (executiveDirector == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  executiveDirector.fireAtCurrentTime((Actor)container);
  _setIcon(_getIdleIcon(),true);
}

Fixed version (ground truth):
/** 
 * Initialize the actors and request a refiring at the current time of the executive director. This overrides the base class to throw an exception if there is no executive director.
 * @exception IllegalActionException If the superclass throwsit or if there is no executive director.
 */
public void initialize() throws IllegalActionException {
  _currentlyExecutingStack=new Stack<DoubleTimedEvent>();
  _realTimeInputEventQueue=new PriorityQueue<RealTimeEvent>();
  _realTimeOutputEventQueue=new PriorityQueue<RealTimeEvent>();
  _lastConsumedTag=new HashMap<NamedObj,Tag>();
  _physicalTimeExecutionStarted=null;
  _lastAbsoluteDeadline=null;
  _lastDependency=null;
  _lastExecutingActor=null;
  _lastSourcePort=null;
  _lastTimestamp=null;
  super.initialize();
  NamedObj container=getContainer();
  if (!(container instanceof Actor)) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  Director executiveDirector=((Actor)container).getExecutiveDirector();
  if (executiveDirector == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  executiveDirector.fireAtCurrentTime((Actor)container);
  _setIcon(_getIdleIcon(),true);
}
Program: 73986
Project: 73986
Buggy source:
/** 
 * Return a collection of ports that are finite equivalent ports of the input port. <p> A finite equivalence class is defined as follows. If input ports X and Y each have a dependency not equal to the default depenency's oPlusIdentity() on any common port or on two equivalent ports or on the state of the associated actor, then they are in a finite equivalence class. The returned Collection has no duplicate entries. If the port is not an input port, an exception is thrown.
 * @param input The input port.
 * @return Collection of finite equivalent ports.
 * @exception IllegalActionException
 */
protected static Collection<IOPort> _finiteEquivalentPorts(IOPort input) throws IllegalActionException {
  Collection<IOPort> result=new HashSet<IOPort>();
  Collection<IOPort> outputs=_finiteDependentPorts(input);
  for (  IOPort output : outputs) {
    result.addAll(_finiteDependentPorts(output));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Return a collection of ports that are finite equivalent ports of the input port. <p> A finite equivalence class is defined as follows. If input ports X and Y each have a dependency not equal to the default depenency's oPlusIdentity() on any common port or on two equivalent ports or on the state of the associated actor, then they are in a finite equivalence class. The returned Collection has no duplicate entries. If the port is not an input port, an exception is thrown.
 * @param input The input port.
 * @return Collection of finite equivalent ports.
 * @exception IllegalActionException
 */
protected static Collection<IOPort> _finiteEquivalentPorts(IOPort input) throws IllegalActionException {
  Collection<IOPort> result=new HashSet<IOPort>();
  result.add(input);
  Collection<IOPort> outputs=_finiteDependentPorts(input);
  for (  IOPort output : outputs) {
    result.addAll(_finiteDependentPorts(output));
  }
  return result;
}
Program: 73989
Project: 73989
Buggy source:
private void _addChoices() throws IllegalActionException {
  List<Class> solvers=getListOfSolverClass("String_Node_Str");
  if (solvers.size() > 0) {
    property.setExpression(solvers.get(0).getSimpleName());
  }
  for (  Class solver : solvers) {
    property.addChoice(solver.getSimpleName());
  }
  property.addChoice("String_Node_Str");
  PropertySolver._addActions(action);
}

Fixed version (ground truth):
private void _addChoices() throws IllegalActionException {
  _solvers.addAll(getListOfSolverClass("String_Node_Str"));
  if (_solvers.size() > 0) {
    property.setExpression(_solvers.get(0).getSimpleName());
  }
  for (  Class solver : _solvers) {
    property.addChoice(solver.getSimpleName());
  }
  property.addChoice("String_Node_Str");
  PropertySolver._addActions(action);
}
Program: 73990
Project: 73990
Buggy source:
protected void _regressionTest(NamedObj namedObj,Property property) throws PropertyResolutionException {
  Property previousProperty=getPreviousProperty(namedObj);
  if (previousProperty != null) {
    try {
      PropertyAttribute attribute=_getPropertyAttribute(namedObj);
      _updatePropertyAttribute(attribute,previousProperty);
    }
 catch (    IllegalActionException ex) {
      throw new PropertyResolutionException(this,ex);
    }
  }
  if ((previousProperty == null && property != null) || (previousProperty != null && !previousProperty.equals(property))) {
    addErrors(_eol + "String_Node_Str" + getUseCaseName()+ "String_Node_Str"+ namedObj.getFullName()+ "String_Node_Str"+ _eol+ "String_Node_Str"+ previousProperty+ "String_Node_Str"+ property+ "String_Node_Str");
  }
}

Fixed version (ground truth):
protected void _regressionTest(NamedObj namedObj,Property property) throws PropertyResolutionException {
  Property previousProperty=getPreviousProperty(namedObj);
  if (previousProperty != null) {
    try {
      PropertyAttribute attribute=_getPropertyAttribute(namedObj);
      _updatePropertyAttribute(attribute,previousProperty);
    }
 catch (    IllegalActionException ex) {
      throw new PropertyResolutionException(this,ex);
    }
  }
  if ((previousProperty == null && property != null) || (previousProperty != null && !previousProperty.toString().equals(property.toString()))) {
    addErrors(_eol + "String_Node_Str" + getUseCaseName()+ "String_Node_Str"+ namedObj.getFullName()+ "String_Node_Str"+ _eol+ "String_Node_Str"+ previousProperty+ "String_Node_Str"+ property+ "String_Node_Str");
  }
}
Program: 73994
Project: 73994
Buggy source:
/** 
 * Read and display the input, then wait for user input and produce the user data on the output. If the user input is "quit" or "exit", then set a flag that causes postfire() to return false.
 * @exception IllegalActionException If producing the outputcauses an exception.
 */
public void fire() throws IllegalActionException {
  super.fire();
  prompt.update();
  shell.mainPrompt=((StringToken)prompt.getToken()).stringValue();
  if ((input.numberOfSources() > 0) && input.hasToken(0)) {
    String value=((StringToken)input.get(0)).stringValue();
    if (_firstTime) {
      _firstTime=false;
      shell.initialize(value);
    }
 else {
      shell.returnResult(value);
    }
  }
  shell.setEditable(true);
  String userCommand=getOutput();
  if (userCommand.trim().equalsIgnoreCase("String_Node_Str") || userCommand.trim().equalsIgnoreCase("String_Node_Str")) {
    _returnFalseInPostfire=true;
  }
  output.broadcast(new StringToken(userCommand));
}

Fixed version (ground truth):
/** 
 * Read and display the input, then wait for user input and produce the user data on the output. If the user input is "quit" or "exit", then set a flag that causes postfire() to return false.
 * @exception IllegalActionException If producing the outputcauses an exception.
 */
public void fire() throws IllegalActionException {
  super.fire();
  if (shell == null) {
    return;
  }
  prompt.update();
  shell.mainPrompt=((StringToken)prompt.getToken()).stringValue();
  String value="String_Node_Str";
  if ((input.numberOfSources() > 0) && input.hasToken(0)) {
    value=((StringToken)input.get(0)).stringValue();
  }
  if (_firstTime) {
    _firstTime=false;
    shell.initialize(value);
  }
 else {
    shell.returnResult(value);
  }
  Runnable doSetEditable=new Runnable(){
    public void run(){
      shell.setEditable(true);
    }
  }
;
  SwingUtilities.invokeLater(doSetEditable);
  String userCommand=getOutput();
  if (userCommand.trim().equalsIgnoreCase("String_Node_Str") || userCommand.trim().equalsIgnoreCase("String_Node_Str")) {
    _returnFalseInPostfire=true;
  }
  output.broadcast(new StringToken(userCommand));
}
Program: 73995
Project: 73995
Buggy source:
/** 
 * Generate fire code. The method generates code that loops through each input [multi-ports] and combines (add or subtract) them.
 * @return The generated code.
 * @exception IllegalActionException If the code stream encounters anerror in processing the specified code block(s).
 */
@Override protected String _generateFireCode() throws IllegalActionException {
  super._generateFireCode();
  ptolemy.actor.lib.AddSubtract actor=(ptolemy.actor.lib.AddSubtract)getComponent();
  String outputType=getCodeGenerator().codeGenType(actor.output.getType());
  String plusType=getCodeGenerator().codeGenType(actor.plus.getType());
  String minusType=getCodeGenerator().codeGenType(actor.minus.getType());
  boolean minusOnly=!actor.plus.isOutsideConnected();
  ArrayList<String> args=new ArrayList<String>();
  CodeStream codeStream=_templateParser.getCodeStream();
  codeStream.appendCodeBlock("String_Node_Str");
  args.add("String_Node_Str");
  args.add(outputType);
  args.add(plusType);
  for (int i=1; i < actor.plus.getWidth(); i++) {
    args.set(0,Integer.valueOf(i).toString());
    codeStream.appendCodeBlock("String_Node_Str",args);
  }
  for (int i=minusOnly ? 1 : 0; i < actor.minus.getWidth(); i++) {
    args.set(0,Integer.valueOf(i).toString());
    args.set(2,minusType);
    codeStream.appendCodeBlock("String_Node_Str",args);
  }
  if (actor.output.isOutsideConnected() && actor.output.numberOfSinks() > 0) {
    codeStream.appendCodeBlock("String_Node_Str");
  }
  return processCode(codeStream.toString());
}

Fixed version (ground truth):
/** 
 * Generate fire code. The method generates code that loops through each input [multi-ports] and combines (add or subtract) them.
 * @return The generated code.
 * @exception IllegalActionException If the code stream encounters anerror in processing the specified code block(s).
 */
@Override protected String _generateFireCode() throws IllegalActionException {
  super._generateFireCode();
  ptolemy.actor.lib.AddSubtract actor=(ptolemy.actor.lib.AddSubtract)getComponent();
  String outputType=getCodeGenerator().codeGenType(actor.output.getType());
  String plusType=getCodeGenerator().codeGenType(actor.plus.getType());
  String minusType=getCodeGenerator().codeGenType(actor.minus.getType());
  ArrayList<String> args=new ArrayList<String>();
  CodeStream codeStream=_templateParser.getCodeStream();
  codeStream.appendCodeBlock("String_Node_Str");
  args.add("String_Node_Str");
  args.add(outputType);
  args.add(plusType);
  for (int i=0; i < actor.plus.getWidth(); i++) {
    args.set(0,Integer.valueOf(i).toString());
    codeStream.appendCodeBlock("String_Node_Str",args);
  }
  for (int i=0; i < actor.minus.getWidth(); i++) {
    args.set(0,Integer.valueOf(i).toString());
    args.set(2,minusType);
    codeStream.appendCodeBlock("String_Node_Str",args);
  }
  if (actor.output.isOutsideConnected() && actor.output.numberOfSinks() > 0) {
    codeStream.appendCodeBlock("String_Node_Str");
  }
  return processCode(codeStream.toString());
}
Program: 73996
Project: 73996
Buggy source:
/** 
 * Sign a jar file.
 */
private static void _signJarFile(String jarFileName,String signedJarFileName) throws Exception {
  String keystoreFileName=StringUtilities.getProperty("String_Node_Str") + File.separator + "String_Node_Str";
  String storePassword="String_Node_Str";
  String keyPassword="String_Node_Str";
  String alias="String_Node_Str";
  String keystorePropertiesFileName=StringUtilities.getProperty("String_Node_Str") + File.separator + "String_Node_Str";
  Properties properties=new Properties();
  try {
    properties.load(new FileInputStream(keystorePropertiesFileName));
    storePassword=properties.getProperty("String_Node_Str");
    keyPassword=properties.getProperty("String_Node_Str");
    alias=properties.getProperty("String_Node_Str");
  }
 catch (  IOException ex) {
    System.out.println("String_Node_Str" + keystorePropertiesFileName + "String_Node_Str"+ ex);
  }
  System.out.println("String_Node_Str" + jarFileName + "String_Node_Str"+ signedJarFileName+ "String_Node_Str");
  File signedJarFile=new File(signedJarFileName);
  File parent=signedJarFile.getParentFile();
  if (parent != null) {
    if (!parent.mkdirs()) {
      if (!parent.isDirectory()) {
        throw new IOException("String_Node_Str" + signedJarFileName + "String_Node_Str");
      }
    }
  }
  JarSigner.sign(jarFileName,signedJarFileName,keystoreFileName,alias,storePassword.toCharArray(),keyPassword.toCharArray());
}

Fixed version (ground truth):
/** 
 * Sign a jar file.
 */
private static void _signJarFile(String jarFileName,String signedJarFileName) throws Exception {
  String keystoreFileName=StringUtilities.getProperty("String_Node_Str") + File.separator + "String_Node_Str";
  String storePassword="String_Node_Str";
  String keyPassword="String_Node_Str";
  String alias="String_Node_Str";
  String keystorePropertiesFileName=StringUtilities.getProperty("String_Node_Str") + File.separator + "String_Node_Str";
  Properties properties=new Properties();
  try {
    FileInputStream fileInputStream=null;
    try {
      fileInputStream=new FileInputStream(keystorePropertiesFileName);
      properties.load(fileInputStream);
      storePassword=properties.getProperty("String_Node_Str");
      keyPassword=properties.getProperty("String_Node_Str");
      alias=properties.getProperty("String_Node_Str");
    }
  finally {
      if (fileInputStream != null) {
        fileInputStream.close();
      }
    }
  }
 catch (  IOException ex) {
    System.out.println("String_Node_Str" + keystorePropertiesFileName + "String_Node_Str"+ ex);
  }
  System.out.println("String_Node_Str" + jarFileName + "String_Node_Str"+ signedJarFileName+ "String_Node_Str");
  File signedJarFile=new File(signedJarFileName);
  File parent=signedJarFile.getParentFile();
  if (parent != null) {
    if (!parent.mkdirs()) {
      if (!parent.isDirectory()) {
        throw new IOException("String_Node_Str" + signedJarFileName + "String_Node_Str");
      }
    }
  }
  JarSigner.sign(jarFileName,signedJarFileName,keystoreFileName,alias,storePassword.toCharArray(),keyPassword.toCharArray());
}
Program: 73997
Project: 73997
Buggy source:
public Component getComponent() throws Exception {
  ComponentBuilder builder=(ComponentBuilder)typeCombo.getSelectedItem();
  Component instance=builder.getInstance(controlProperties);
  return instance;
}

Fixed version (ground truth):
public Component getComponent(){
  return component;
}
Program: 73998
Project: 73998
Buggy source:
/** 
 * Return true if this is a 32bit JVM.
 * @return true if this is a 32bit JVM.
 */
static boolean _is32Bit(){
  String dataModelProperty=StringUtilities.getProperty("String_Node_Str");
  boolean result=true;
  if (dataModelProperty.indexOf("String_Node_Str") != -1) {
    return false;
  }
 else {
    String javaVmNameProperty=StringUtilities.getProperty("String_Node_Str");
    if (javaVmNameProperty.indexOf("String_Node_Str") != -1) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Return true if this is a 32bit JVM.
 * @return true if this is a 32bit JVM.
 */
static boolean _is32Bit(){
  String dataModelProperty=StringUtilities.getProperty("String_Node_Str");
  if (dataModelProperty.indexOf("String_Node_Str") != -1) {
    return false;
  }
 else {
    String javaVmNameProperty=StringUtilities.getProperty("String_Node_Str");
    if (javaVmNameProperty.indexOf("String_Node_Str") != -1) {
      return false;
    }
  }
  return true;
}
Program: 73999
Project: 73999
Buggy source:
/** 
 * Get the name of the set checkpoint method.
 * @param isAnonymous Whether the current class is an anonymous class.
 * @return The name of the set checkoint method.
 */
private String _getSetCheckpointMethodName(boolean isAnonymous){
  return SET_CHECKPOINT_NAME + (isAnonymous ? "String_Node_Str" : "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Get the name of the set checkpoint method.
 * @param isAnonymous Whether the current class is an anonymous class.
 * @return The name of the set checkpoint method.
 */
private String _getSetCheckpointMethodName(boolean isAnonymous){
  return SET_CHECKPOINT_NAME + (isAnonymous ? "String_Node_Str" : "String_Node_Str");
}
Program: 74003
Project: 74003
Buggy source:
/** 
 * Return the actor associated with this event. This method should take all events of the same tag destined for the same actor from the event queue, and return the actor associated with it. <p> In this baseline implementation, super._getNextActorToFire() is called.
 * @param events list of events that are destined for thesame actor and of the same tag.
 * @return Actor associated with the event.
 * @exception IllegalActionException
 */
protected Actor _getNextActorToFireForTheseEvents(List<PtidesEvent> events) throws IllegalActionException {
  PtidesEvent eventInList=events.get(0);
  PtidesEvent eventInQueue=(PtidesEvent)_eventQueue.get();
  if (!(eventInList.hasTheSameTagAs(eventInQueue) && (eventInQueue.actor() == eventInList.actor()))) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  return super._getNextActorToFire();
}

Fixed version (ground truth):
/** 
 * Return the actor associated with the events. All events should point to the same actor.
 * @param events list of events that are destined for thesame actor and of the same tag.
 * @return Actor associated with the event.
 * @exception IllegalActionException
 */
protected Actor _getNextActorToFireForTheseEvents(List<PtidesEvent> events) throws IllegalActionException {
  PtidesEvent eventInList=events.get(0);
  for (int i=1; i < events.size(); i++) {
    if (events.get(i).actor() != eventInList.actor()) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
    }
  }
  return eventInList.actor();
}
Program: 74005
Project: 74005
Buggy source:
/** 
 * Request a firing of the container of the director at the specified time and throw an exception if the executive director does not agree to do it at the requested time. If there is no executive director (this director is at the top level), then ignore the request. This method is essentially a duplicate of the method in Director, which is not accessible.
 * @param time The requested time.
 * @return The time that the executive director indicates it will fire thisdirector, or an instance of Time with value Double.NEGATIVE_INFINITY if there is no executive director.
 * @exception IllegalActionException If the director does notagree to fire the actor at the specified time, or if there is no director.
 */
private Time _fireContainerAt(Time time) throws IllegalActionException {
  Actor container=(Actor)_director.getContainer();
  if (container != null) {
    Director director=container.getExecutiveDirector();
    if (director != null) {
      Time result=director.fireAt(container,time);
      if (!result.equals(time)) {
        throw new IllegalActionException(_director,_director.getName() + "String_Node_Str" + container.getName()+ "String_Node_Str"+ time+ "String_Node_Str"+ result);
      }
      return result;
    }
  }
  return new Time((Director)_director,Double.NEGATIVE_INFINITY);
}

Fixed version (ground truth):
/** 
 * Request a firing of the container of the director at the specified time and throw an exception if the executive director does not agree to do it at the requested time. If there is no executive director (this director is at the top level), then ignore the request. This method is essentially a duplicate of the method in Director, which is not accessible.
 * @param time The requested time.
 * @return The time that the executive director indicates it will fire thisdirector, or an instance of Time with value Double.NEGATIVE_INFINITY if there is no executive director.
 * @exception IllegalActionException If the director does notagree to fire the actor at the specified time, or if there is no director.
 */
private Time _fireContainerAt(Time time) throws IllegalActionException {
  Actor container=(Actor)_director.getContainer();
  if (container != null) {
    Director director=container.getExecutiveDirector();
    if (director != null) {
      Time result=director.fireAt(container,time);
      if (!result.equals(time)) {
        throw new IllegalActionException(_director,director.getName() + "String_Node_Str" + container.getName()+ "String_Node_Str"+ time+ "String_Node_Str"+ result);
      }
      return result;
    }
  }
  return new Time((Director)_director,Double.NEGATIVE_INFINITY);
}
Program: 74008
Project: 74008
Buggy source:
/** 
 * Transfer inputs from the environment to inside. This also marks the receivers that get data as inputs so that the data will not be overwritten later in the same iteration.
 * @exception IllegalActionException If the transferInputs(Port)method throws it.
 * @return True if at least one token is transferred.
 */
private boolean _transferInputsToInside() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  boolean result=false;
  CompositeActor container=(CompositeActor)getContainer();
  Iterator inports=container.inputPortList().iterator();
  while (inports.hasNext() && !_stopRequested) {
    IOPort port=(IOPort)inports.next();
    result=super.transferInputs(port) || result;
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Transfer inputs from the environment to inside.
 * @exception IllegalActionException If the transferInputs(Port)method throws it.
 * @return True if at least one token is transferred.
 */
private boolean _transferInputsToInside() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  boolean result=false;
  CompositeActor container=(CompositeActor)getContainer();
  Iterator inports=container.inputPortList().iterator();
  while (inports.hasNext() && !_stopRequested) {
    IOPort port=(IOPort)inports.next();
    result=super.transferInputs(port) || result;
  }
  return result;
}
Program: 74009
Project: 74009
Buggy source:
/** 
 * Prefire method when the enclosing director is an instance of this same class.
 * @return True if it is OK to fire.
 */
private boolean _prefireWithEnclosingContinuousDirector() throws IllegalActionException {
  ContinuousDirector enclosingDirector=_enclosingContinuousDirector();
  _currentStepSize=enclosingDirector._currentStepSize;
  _currentTime=enclosingDirector._currentTime;
  if (_debugging) {
    _debug("String_Node_Str" + _currentTime);
  }
  _index=enclosingDirector._index;
  _iterationBeginTime=enclosingDirector._iterationBeginTime;
  _iterationBeginIndex=enclosingDirector._index;
  if (_iterationBeginTime.compareTo(_stopTime) > 0) {
    if (_debugging) {
      _debug("String_Node_Str" + _iterationBeginTime);
    }
    return false;
  }
  _discardBreakpointsBefore(_iterationBeginTime,_index);
  boolean result=super.prefire();
  _resetAllReceivers();
  if (_debugging) {
    _debug("String_Node_Str" + result);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Prefire method when the enclosing director is an instance of this same class.
 * @return True if it is OK to fire.
 */
private boolean _prefireWithEnclosingContinuousDirector() throws IllegalActionException {
  ContinuousDirector enclosingDirector=_enclosingContinuousDirector();
  _currentStepSize=enclosingDirector._currentStepSize;
  _currentTime=enclosingDirector._currentTime;
  if (_debugging) {
    _debug("String_Node_Str" + _currentTime);
  }
  _index=enclosingDirector._index;
  _iterationBeginTime=enclosingDirector._iterationBeginTime;
  _iterationBeginIndex=enclosingDirector._index;
  if (_iterationBeginTime.compareTo(_stopTime) > 0) {
    if (_debugging) {
      _debug("String_Node_Str" + _iterationBeginTime);
    }
    return false;
  }
  _discardBreakpointsBefore(_iterationBeginTime,_index);
  boolean result=super.prefire();
  if (_debugging) {
    _debug("String_Node_Str" + result);
  }
  return result;
}
Program: 74010
Project: 74010
Buggy source:
/** 
 * Initialize model after type resolution. In addition to calling the initialize() method of the super class, this method records the current system time as the "real" starting time of the execution. This starting time is used when the execution is synchronized to real time.
 * @exception IllegalActionException If the super class throws it.
 */
public void initialize() throws IllegalActionException {
  _isInitializing=true;
  super.initialize();
  _currentStepSize=0.0;
  if (_isEmbedded() && (_enclosingContinuousDirector() == null)) {
    _fireContainerAt(_startTime);
    if (!_stopTime.isInfinite()) {
      _fireContainerAt(_stopTime);
    }
  }
  _breakpoints.insert(new SuperdenseTime(_stopTime,0));
  _timeBase=System.currentTimeMillis();
  _commitIsPending=false;
  _postfireReturns=true;
  _isInitializing=false;
}

Fixed version (ground truth):
/** 
 * Initialize model after type resolution. In addition to calling the initialize() method of the super class, this method records the current system time as the "real" starting time of the execution. This starting time is used when the execution is synchronized to real time.
 * @exception IllegalActionException If the super class throws it.
 */
public void initialize() throws IllegalActionException {
  _isInitializing=true;
  super.initialize();
  _currentStepSize=0.0;
  if (_isEmbedded() && (_enclosingContinuousDirector() == null)) {
    _fireContainerAt(_startTime);
    if (!_stopTime.isInfinite()) {
      _fireContainerAt(_stopTime);
    }
  }
  _breakpoints.insert(new SuperdenseTime(_stopTime,0));
  _timeBase=System.currentTimeMillis();
  _commitIsPending=false;
  _postfireReturns=true;
  _isInitializing=false;
  _redoingSolverIteration=false;
}
Program: 74011
Project: 74011
Buggy source:
/** 
 * Prefire method when this director is at the top level.
 * @return True if it is OK to fire.
 */
private boolean _prefireAtTopLevel() throws IllegalActionException {
  if (!_breakpoints.isEmpty()) {
    SuperdenseTime nextBreakpoint=(SuperdenseTime)_breakpoints.first();
    Time breakpointTime=nextBreakpoint.timestamp();
    int comparison=breakpointTime.compareTo(_currentTime);
    if (comparison < 0 || (comparison == 0 && nextBreakpoint.index() < _index)) {
      throw new IllegalActionException(this,"String_Node_Str" + breakpointTime + "String_Node_Str"+ nextBreakpoint.index());
    }
 else     if (comparison == 0 && nextBreakpoint.index() == _index) {
      if (_debugging) {
        _debug("String_Node_Str" + nextBreakpoint + "String_Node_Str");
      }
      _breakpoints.removeFirst();
    }
  }
  boolean result=super.prefire();
  _resetAllReceivers();
  if (_debugging) {
    _debug("String_Node_Str" + result);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Prefire method when this director is at the top level.
 * @return True if it is OK to fire.
 */
private boolean _prefireAtTopLevel() throws IllegalActionException {
  if (!_breakpoints.isEmpty()) {
    SuperdenseTime nextBreakpoint=(SuperdenseTime)_breakpoints.first();
    Time breakpointTime=nextBreakpoint.timestamp();
    int comparison=breakpointTime.compareTo(_currentTime);
    if (comparison < 0 || (comparison == 0 && nextBreakpoint.index() < _index)) {
      throw new IllegalActionException(this,"String_Node_Str" + breakpointTime + "String_Node_Str"+ nextBreakpoint.index());
    }
 else     if (comparison == 0 && nextBreakpoint.index() == _index) {
      if (_debugging) {
        _debug("String_Node_Str" + nextBreakpoint + "String_Node_Str");
      }
      _breakpoints.removeFirst();
    }
  }
  boolean result=super.prefire();
  if (_debugging) {
    _debug("String_Node_Str" + result);
  }
  return result;
}
Program: 74013
Project: 74013
Buggy source:
/** 
 * Generate the preinitialize code for this director. The preinitialize code for the director is generated by appending the preinitialize code for each actor.
 * @return The generated preinitialize code.
 * @exception IllegalActionException If getting the adapter fails,or if generating the preinitialize code for a adapter fails, or if there is a problem getting the buffer size of a port.
 */
public String generatePreinitializeCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(super.generatePreinitializeCode());
  code.append(_createOffsetVariablesIfNeeded());
  _createInputBufferSizeAndOffsetMap();
  _createOutputBufferSizeAndOffsetMap();
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate the preinitialize code for this director. The preinitialize code for the director is generated by appending the preinitialize code for each actor.
 * @return The generated preinitialize code.
 * @exception IllegalActionException If getting the adapter fails,or if generating the preinitialize code for a adapter fails, or if there is a problem getting the buffer size of a port.
 */
public String generatePreinitializeCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(super.generatePreinitializeCode());
  _createInputBufferSizeAndOffsetMap();
  _createOutputBufferSizeAndOffsetMap();
  code.append(_createOffsetVariablesIfNeeded());
  return code.toString();
}
Program: 74014
Project: 74014
Buggy source:
/** 
 * Generate the preinitialize code for this director. The preinitialize code for the director is generated by appending the preinitialize code for each actor.
 * @return The generated preinitialize code.
 * @exception IllegalActionException If getting the adapter fails,or if generating the preinitialize code for a adapter fails, or if there is a problem getting the buffer size of a port.
 */
public String generatePreinitializeCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(super.generatePreinitializeCode());
  _updatePortBufferSize();
  _portNumber=0;
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate the preinitialize code for this director. The preinitialize code for the director is generated by appending the preinitialize code for each actor.
 * @return The generated preinitialize code.
 * @exception IllegalActionException If getting the adapter fails,or if generating the preinitialize code for a adapter fails, or if there is a problem getting the buffer size of a port.
 */
public String generatePreinitializeCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  _updatePortBufferSize();
  code.append(super.generatePreinitializeCode());
  _updatePortBufferSize();
  _portNumber=0;
  return code.toString();
}
Program: 74016
Project: 74016
Buggy source:
/** 
 * Runs the process. 
 */
public void run(){
  if (simPro == null) {
    return;
  }
  InputStream is=simPro.getInputStream();
  InputStreamReader isr=new InputStreamReader(is);
  BufferedReader br=new BufferedReader(isr);
  PrintWriter pwLogFil;
  PrintWriter pwSysOut=new PrintWriter(System.out);
  try {
    pwLogFil=new PrintWriter(new BufferedWriter(new FileWriter(logFil)));
  }
 catch (  java.io.IOException e) {
    e.printStackTrace();
    pwLogFil=new PrintWriter(System.err);
  }
  String line;
  try {
    while ((line=br.readLine()) != null) {
      if (logToSysOut) {
        pwSysOut.println(line);
        pwSysOut.flush();
      }
      pwLogFil.println(line);
      pwLogFil.flush();
    }
  }
 catch (  java.io.IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Runs the process. 
 */
public void run(){
  if (simPro == null) {
    return;
  }
  InputStream is=simPro.getInputStream();
  InputStreamReader isr=new InputStreamReader(is);
  BufferedReader br=null;
  try {
    isr=new InputStreamReader(is);
    br=new BufferedReader(isr);
    PrintWriter pwLogFil;
    PrintWriter pwSysOut=new PrintWriter(System.out);
    try {
      pwLogFil=new PrintWriter(new BufferedWriter(new FileWriter(logFil)));
    }
 catch (    java.io.IOException e) {
      e.printStackTrace();
      pwLogFil=new PrintWriter(System.err);
    }
    String line;
    try {
      while ((line=br.readLine()) != null) {
        if (logToSysOut) {
          pwSysOut.println(line);
          pwSysOut.flush();
        }
        pwLogFil.println(line);
        pwLogFil.flush();
      }
    }
 catch (    java.io.IOException e) {
      e.printStackTrace();
    }
  }
  finally {
    if (isr != null) {
      try {
        isr.close();
      }
 catch (      java.io.IOException e) {
        e.printStackTrace();
      }
    }
    if (br != null) {
      try {
        br.close();
      }
 catch (      java.io.IOException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 74017
Project: 74017
Buggy source:
/** 
 * Sets the simulation log file.
 * @param simLogFil The log file.
 */
public void setSimulationLogFile(File simLogFil){
  logFil=new File(simLogFil.getAbsolutePath());
  logToSysOut=true;
  logFil.delete();
}

Fixed version (ground truth):
/** 
 * Sets the simulation log file.
 * @param simLogFil The log file.
 */
public void setSimulationLogFile(File simLogFil){
  logFil=new File(simLogFil.getAbsolutePath());
  logToSysOut=true;
  if (!logFil.delete()) {
    throw new RuntimeException("String_Node_Str" + logFil.getAbsolutePath() + "String_Node_Str");
  }
}
Program: 74021
Project: 74021
Buggy source:
/** 
 * Execute the SQL update given in the specified string and return the number of affected rows or zero if the update does not return anything. Note that if there is no connection to the database, this will open one. The caller is responsible for calling closeConnection() after this.
 * @param sql The query.
 * @param expectedResult If a non-negative number is given here, thenthe update is not committed unless the result matches.
 * @return The number of rows affected or 0 if the updatedoes not return a value, or -1 if the connection is canceled.
 * @exception IllegalActionException If the query fails or if theresult does not match the value of <i>expectedResult</i>.
 */
public int executeUpdate(String sql,int expectedResult) throws IllegalActionException {
  PreparedStatement statement=null;
  Connection connection=getConnection();
  try {
    if (connection == null) {
      return -1;
    }
    connection.setAutoCommit(false);
    statement=connection.prepareStatement(sql);
    int result=statement.executeUpdate();
    if (expectedResult >= 0 && result != expectedResult) {
      throw new IllegalActionException(this,"String_Node_Str" + result + "String_Node_Str"+ expectedResult);
    }
    connection.commit();
    return result;
  }
 catch (  SQLException e) {
    try {
      connection.rollback();
    }
 catch (    SQLException e1) {
    }
    throw new IllegalActionException(this,e,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Execute the SQL update given in the specified string and return the number of affected rows or zero if the update does not return anything. Note that if there is no connection to the database, this will open one. The caller is responsible for calling closeConnection() after this.
 * @param sql The query.
 * @param expectedResult If a non-negative number is given here, thenthe update is not committed unless the result matches.
 * @return The number of rows affected or 0 if the updatedoes not return a value, or -1 if the connection is canceled.
 * @exception IllegalActionException If the query fails or if theresult does not match the value of <i>expectedResult</i>.
 */
public int executeUpdate(String sql,int expectedResult) throws IllegalActionException {
  PreparedStatement statement=null;
  Connection connection=getConnection();
  try {
    if (connection == null) {
      return -1;
    }
    connection.setAutoCommit(false);
    statement=connection.prepareStatement(sql);
    int result=statement.executeUpdate();
    if (expectedResult >= 0 && result != expectedResult) {
      throw new IllegalActionException(this,"String_Node_Str" + result + "String_Node_Str"+ expectedResult);
    }
    connection.commit();
    return result;
  }
 catch (  SQLException e) {
    try {
      connection.rollback();
    }
 catch (    SQLException e1) {
    }
    throw new IllegalActionException(this,e,"String_Node_Str");
  }
 finally {
    if (statement != null) {
      try {
        statement.close();
      }
 catch (      SQLException e1) {
      }
    }
  }
}
Program: 74023
Project: 74023
Buggy source:
private static void _replaceAndPrintContent(StringBuffer templateCode,String filename) throws IOException {
  String codeString=templateCode.toString();
  for (  String key : replaceMap.keySet()) {
    codeString=codeString.replaceAll(key,replaceMap.get(key));
  }
  FileWriter writer=new FileWriter(new File(filename));
  writer.write(codeString);
  writer.close();
}

Fixed version (ground truth):
private static void _replaceAndPrintContent(StringBuffer templateCode,String filename) throws IOException {
  String codeString=templateCode.toString();
  for (  String key : replaceMap.keySet()) {
    codeString=codeString.replaceAll(key,replaceMap.get(key));
  }
  FileWriter writer=null;
  try {
    writer=new FileWriter(new File(filename));
    writer.write(codeString);
  }
  finally {
    if (writer != null) {
      writer.close();
    }
  }
}
Program: 74026
Project: 74026
Buggy source:
/** 
 * Return the trained constraint filename.
 * @return The trained constraint filename.
 * @exception IllegalActionException If there is a problemgetting the name of the top level or the value of the <i>trainedConstraintDirectory</i> parameter.
 */
private String _getTrainedConstraintFilename() throws IllegalActionException {
  String constraintFilename=_toplevel().getName() + "String_Node_Str" + getUseCaseName();
  String directoryPath=trainedConstraintDirectory.getExpression();
  directoryPath=directoryPath.replace("String_Node_Str","String_Node_Str");
  directoryPath+=directoryPath.endsWith("String_Node_Str") || directoryPath.endsWith("String_Node_Str") ? "String_Node_Str" : "String_Node_Str";
  File constraintFile;
  if (directoryPath.startsWith("String_Node_Str")) {
    URI directory=new File(URIAttribute.getModelURI(this)).getParentFile().toURI();
    constraintFile=FileUtilities.nameToFile(directoryPath.substring(11) + constraintFilename,directory);
  }
 else {
    if (!trainedConstraintDirectory.asFile().exists()) {
      trainedConstraintDirectory.asFile().mkdirs();
    }
    constraintFile=FileUtilities.nameToFile(constraintFilename,trainedConstraintDirectory.asFile().toURI());
  }
  return constraintFile.getAbsolutePath().replace("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Return the trained constraint filename.
 * @return The trained constraint filename.
 * @exception IllegalActionException If there is a problemgetting the name of the top level or the value of the <i>trainedConstraintDirectory</i> parameter.
 */
private String _getTrainedConstraintFilename() throws IllegalActionException {
  String constraintFilename=_toplevel().getName() + "String_Node_Str" + getUseCaseName();
  String directoryPath=trainedConstraintDirectory.getExpression();
  directoryPath=directoryPath.replace("String_Node_Str","String_Node_Str");
  directoryPath+=directoryPath.endsWith("String_Node_Str") || directoryPath.endsWith("String_Node_Str") ? "String_Node_Str" : "String_Node_Str";
  File constraintFile;
  if (directoryPath.startsWith("String_Node_Str")) {
    URI directory=new File(URIAttribute.getModelURI(this)).getParentFile().toURI();
    constraintFile=FileUtilities.nameToFile(directoryPath.substring(11) + constraintFilename,directory);
  }
 else {
    if (!trainedConstraintDirectory.asFile().exists()) {
      if (!trainedConstraintDirectory.asFile().mkdirs()) {
        throw new IllegalActionException(this,"String_Node_Str" + trainedConstraintDirectory.asFile().getAbsolutePath() + "String_Node_Str");
      }
    }
    constraintFile=FileUtilities.nameToFile(constraintFilename,trainedConstraintDirectory.asFile().toURI());
  }
  return constraintFile.getAbsolutePath().replace("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
}
Program: 74027
Project: 74027
Buggy source:
/** 
 * Log the trained constraints in a subdirectory under the specified logDirectory. The contraint file has an unique name consist of the name of toplevel container and this solver. If the constraint file already exists, an overwrite warning message is sent to the user.
 * @param filename
 * @exception PropertyResolutionException Thrown if there is a problemopening, writing, or closing the constraint file.
 */
private void _updateConstraintFile(String filename) throws IllegalActionException {
  if (!super.isResolve() || !isLogMode()) {
    return;
  }
  try {
    File constraintFile=new File(filename);
    if (constraintFile.exists()) {
      if (_analyzer != null && ((Parameter)_analyzer.getAttribute("String_Node_Str")).getExpression().equals("String_Node_Str")) {
        return;
      }
      if (_analyzer == null && !isLogMode()) {
        return;
      }
    }
 else {
      if (!constraintFile.getParentFile().exists()) {
        constraintFile.getParentFile().mkdirs();
      }
      constraintFile.createNewFile();
    }
    Writer writer=null;
    try {
      writer=new FileWriter(filename);
      for (      String constraint : _trainedConstraints) {
        writer.write(constraint + _eol);
      }
    }
  finally {
      writer.close();
    }
  }
 catch (  IOException ex) {
    throw new PropertyResolutionException(this,ex,"String_Node_Str" + filename + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Log the trained constraints in a subdirectory under the specified logDirectory. The contraint file has an unique name consist of the name of toplevel container and this solver. If the constraint file already exists, an overwrite warning message is sent to the user.
 * @param filename
 * @exception PropertyResolutionException Thrown if there is a problemopening, writing, or closing the constraint file.
 */
private void _updateConstraintFile(String filename) throws IllegalActionException {
  if (!super.isResolve() || !isLogMode()) {
    return;
  }
  try {
    File constraintFile=new File(filename);
    if (constraintFile.exists()) {
      if (_analyzer != null && ((Parameter)_analyzer.getAttribute("String_Node_Str")).getExpression().equals("String_Node_Str")) {
        return;
      }
      if (_analyzer == null && !isLogMode()) {
        return;
      }
    }
 else {
      if (!constraintFile.getParentFile().exists()) {
        if (!constraintFile.getParentFile().mkdirs()) {
          throw new IllegalActionException(this,"String_Node_Str" + constraintFile.getParentFile().getAbsolutePath() + "String_Node_Str");
        }
      }
      if (!constraintFile.createNewFile()) {
        throw new IllegalActionException(this,"String_Node_Str" + constraintFile.getAbsolutePath() + "String_Node_Str");
      }
    }
    Writer writer=null;
    try {
      writer=new FileWriter(filename);
      for (      String constraint : _trainedConstraints) {
        writer.write(constraint + _eol);
      }
    }
  finally {
      writer.close();
    }
  }
 catch (  IOException ex) {
    throw new PropertyResolutionException(this,ex,"String_Node_Str" + filename + "String_Node_Str");
  }
}
Program: 74029
Project: 74029
Buggy source:
/** 
 * Generate fire code. Read the <code>fireBlock</code> from UpSample.c, replace macros with their values and return the processed code string.
 * @return The processed code string.
 * @exception IllegalActionException If the code stream encounters anerror in processing the specified code block(s).
 */
@Override protected String _generateFireCode() throws IllegalActionException {
  super._generateFireCode();
  CodeStream codeStream=getStrategy().getTemplateParser().getCodeStream();
  ptolemy.domains.sdf.lib.UpSample actor=(ptolemy.domains.sdf.lib.UpSample)getComponent();
  ArrayList args=new ArrayList();
  Type type=actor.input.getType();
  if (!getCodeGenerator().isPrimitive(type)) {
    if (type == BaseType.GENERAL) {
      args.add("String_Node_Str");
    }
 else {
      args.add(getCodeGenerator().codeGenType(type) + "String_Node_Str");
    }
  }
 else {
    args.add("String_Node_Str");
  }
  codeStream.append(getStrategy().getTemplateParser().generateBlockCode("String_Node_Str",args));
  return codeStream.toString();
}

Fixed version (ground truth):
/** 
 * Generate fire code. Read the <code>fireBlock</code> from UpSample.c, replace macros with their values and return the processed code string.
 * @return The processed code string.
 * @exception IllegalActionException If the code stream encounters anerror in processing the specified code block(s).
 */
@Override protected String _generateFireCode() throws IllegalActionException {
  CodeStream codeStream=getStrategy().getTemplateParser().getCodeStream();
  ptolemy.domains.sdf.lib.UpSample actor=(ptolemy.domains.sdf.lib.UpSample)getComponent();
  ArrayList args=new ArrayList();
  Type type=actor.input.getType();
  if (!getCodeGenerator().isPrimitive(type)) {
    if (type == BaseType.GENERAL) {
      args.add("String_Node_Str");
    }
 else {
      args.add(getCodeGenerator().codeGenType(type) + "String_Node_Str");
    }
  }
 else {
    args.add("String_Node_Str");
  }
  codeStream.appendCodeBlock("String_Node_Str",args);
  return codeStream.toString();
}
Program: 74030
Project: 74030
Buggy source:
/** 
 * Clone the actor into the specified workspace. Set a type constraint that the output type is the same as the that of input.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class hashas an attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  TimeDelay newObject=(TimeDelay)super.clone(workspace);
  newObject.output.setTypeSameAs(newObject.input);
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. Set a type constraint that the output type is the same as the that of input.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class hashas an attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  TimeDelay newObject=(TimeDelay)super.clone(workspace);
  newObject.output.setTypeSameAs(newObject.input);
  newObject._causalityMarker=(CausalityMarker)newObject.getAttribute("String_Node_Str");
  return newObject;
}
Program: 74032
Project: 74032
Buggy source:
public void mouseDragged(MouseEvent event){
  PlotBox.this._zoomBox(event.getX(),event.getY());
}

Fixed version (ground truth):
public void mouseDragged(MouseEvent event){
  if ((event.getModifiers() & event.BUTTON1_MASK) != 0 && ((event.getModifiers() & InputEvent.BUTTON3_MASK) == 0)) {
    PlotBox.this._zoomBox(event.getX(),event.getY());
  }
}
Program: 74033
Project: 74033
Buggy source:
public void mouseReleased(MouseEvent event){
  if (((event.getModifiers() & InputEvent.BUTTON1_MASK) != 0) || (event.getModifiers() == 0)) {
    PlotBox.this._zoom(event.getX(),event.getY());
  }
}

Fixed version (ground truth):
public void mouseReleased(MouseEvent event){
  if (((event.getModifiers() & InputEvent.BUTTON1_MASK) != 0) && ((event.getModifiers() & InputEvent.BUTTON3_MASK) == 0) || (event.getModifiers() == 0)) {
    PlotBox.this._zoom(event.getX(),event.getY());
  }
}