nus-yam/ex-repair huggingface dataset:
Program: 75417
Project: 75417
Buggy source:
public static void eliminateCastsAndInstanceOf(Body body,String phaseName,Set unsafeLocalSet,boolean debug){
  TokenTypeAnalysis tokenTypes=new TokenTypeAnalysis(body.getMethod(),new CompleteUnitGraph(body));
  for (Iterator units=body.getUnits().iterator(); units.hasNext(); ) {
    Unit unit=(Unit)units.next();
    for (Iterator boxes=unit.getUseBoxes().iterator(); boxes.hasNext(); ) {
      ValueBox box=(ValueBox)boxes.next();
      Value value=box.getValue();
      if (value instanceof InstanceOfExpr) {
        InstanceOfExpr expr=(InstanceOfExpr)value;
        Type checkType=expr.getCheckType();
        Value op=expr.getOp();
        if (!PtolemyUtilities.isTokenType(op.getType())) {
          continue;
        }
        ptolemy.data.type.Type type=tokenTypes.getTypeOfBefore((Local)op,unit);
        if (!type.isInstantiable() || type.equals(BaseType.GENERAL)) {
          continue;
        }
        Type opType=PtolemyUtilities.getSootTypeForTokenType(type);
        if (debug)         System.out.println("String_Node_Str" + expr);
        CastAndInstanceofEliminator.replaceInstanceofCheck(box,Scene.v().getActiveHierarchy(),checkType,opType,debug);
      }
    }
  }
}

Fixed version (ground truth):
public static void eliminateCastsAndInstanceOf(Body body,String phaseName,Set unsafeLocalSet,boolean debug){
  TokenTypeAnalysis tokenTypes=new TokenTypeAnalysis(body.getMethod(),new CompleteUnitGraph(body));
  for (Iterator units=body.getUnits().iterator(); units.hasNext(); ) {
    Unit unit=(Unit)units.next();
    for (Iterator boxes=unit.getUseBoxes().iterator(); boxes.hasNext(); ) {
      ValueBox box=(ValueBox)boxes.next();
      Value value=box.getValue();
      if (value instanceof InstanceOfExpr) {
        InstanceOfExpr expr=(InstanceOfExpr)value;
        Type checkType=expr.getCheckType();
        Value op=expr.getOp();
        if (!PtolemyUtilities.isTokenType(op.getType())) {
          continue;
        }
        ptolemy.data.type.Type type=tokenTypes.getTypeOfBefore((Local)op,unit);
        if (type.equals(BaseType.UNKNOWN) || type.equals(BaseType.GENERAL)) {
          System.out.println("String_Node_Str" + type);
          continue;
        }
        Type opType=PtolemyUtilities.getSootTypeForTokenType(type);
        if (debug)         System.out.println("String_Node_Str" + expr);
        CastAndInstanceofEliminator.replaceInstanceofCheck(box,Scene.v().getActiveHierarchy(),checkType,opType,debug);
      }
    }
  }
}
Program: 75420
Project: 75420
Buggy source:
private void _getPortFields(SootClass theClass,Entity container,Entity object){
  for (Iterator ports=object.portList().iterator(); ports.hasNext(); ) {
    Port port=(Port)ports.next();
    if (port instanceof ParameterPort) {
      continue;
    }
    String fieldName=ModelTransformer.getFieldNameForPort(port,container);
    SootField field;
    if (!theClass.declaresFieldByName(fieldName)) {
      throw new RuntimeException("String_Node_Str" + theClass + "String_Node_Str"+ fieldName+ "String_Node_Str"+ port.getFullName());
    }
    field=theClass.getFieldByName(fieldName);
    Type type=field.getType();
    if (!(type instanceof RefType)) {
      System.out.println("String_Node_Str" + theClass + "String_Node_Str"+ port.getFullName()+ "String_Node_Str"+ type);
      continue;
    }
 else {
      SootClass fieldClass=((RefType)type).getSootClass();
      if (!SootUtilities.derivesFrom(fieldClass,PtolemyUtilities.componentPortClass)) {
        System.out.println("String_Node_Str" + theClass + "String_Node_Str"+ port.getFullName()+ "String_Node_Str"+ fieldClass.getName());
        continue;
      }
    }
    field.setModifiers((field.getModifiers() & Modifier.STATIC) | Modifier.FINAL | Modifier.PUBLIC);
    field.addTag(new ValueTag(port));
    _portToFieldMap.put(port,field);
  }
}

Fixed version (ground truth):
private void _getPortFields(SootClass theClass,Entity container,Entity object){
  for (Iterator ports=object.portList().iterator(); ports.hasNext(); ) {
    Port port=(Port)ports.next();
    String fieldName=ModelTransformer.getFieldNameForPort(port,container);
    SootField field;
    if (!theClass.declaresFieldByName(fieldName)) {
      throw new RuntimeException("String_Node_Str" + theClass + "String_Node_Str"+ fieldName+ "String_Node_Str"+ port.getFullName());
    }
    field=theClass.getFieldByName(fieldName);
    Type type=field.getType();
    if (!(type instanceof RefType)) {
      System.out.println("String_Node_Str" + theClass + "String_Node_Str"+ port.getFullName()+ "String_Node_Str"+ type);
      continue;
    }
 else {
      SootClass fieldClass=((RefType)type).getSootClass();
      if (!SootUtilities.derivesFrom(fieldClass,PtolemyUtilities.componentPortClass)) {
        System.out.println("String_Node_Str" + theClass + "String_Node_Str"+ port.getFullName()+ "String_Node_Str"+ fieldClass.getName());
        continue;
      }
    }
    field.setModifiers((field.getModifiers() & Modifier.STATIC) | Modifier.FINAL | Modifier.PUBLIC);
    field.addTag(new ValueTag(port));
    _portToFieldMap.put(port,field);
  }
}
Program: 75423
Project: 75423
Buggy source:
private static void _createActorsIn(CompositeActor model,HashSet createdSet,String phaseName,ConstVariableModelAnalysis constAnalysis,Map options){
  for (Iterator i=model.deepEntityList().iterator(); i.hasNext(); ) {
    Entity entity=(Entity)i.next();
    String className=entity.getClass().getName();
    String newClassName=getInstanceClassName(entity,options);
    if (Scene.v().containsClass(newClassName)) {
      continue;
    }
    System.out.println("String_Node_Str" + newClassName);
    System.out.println("String_Node_Str" + entity.getFullName());
    System.out.println("String_Node_Str" + className);
    if (entity instanceof CompositeActor) {
      CompositeActor composite=(CompositeActor)entity;
      _createCompositeActor(composite,newClassName,options);
    }
 else     if (entity instanceof Expression) {
      AtomicActorCreator creator=new ExpressionCreator();
      creator.createAtomicActor((Expression)entity,newClassName,constAnalysis,options);
    }
 else     if (entity instanceof FSMActor) {
      FSMCreator creator=new FSMCreator();
      creator.createAtomicActor((FSMActor)entity,newClassName,constAnalysis,options);
    }
 else {
      GenericAtomicActorCreator creator=new GenericAtomicActorCreator();
      creator.createAtomicActor((AtomicActor)entity,newClassName,constAnalysis,options);
    }
    SootClass entityClass=Scene.v().loadClassAndSupport(newClassName);
    addActorForClass(entityClass,entity);
  }
}

Fixed version (ground truth):
private static void _createActorsIn(CompositeActor model,HashSet createdSet,String phaseName,ConstVariableModelAnalysis constAnalysis,Map options){
  for (Iterator i=model.deepEntityList().iterator(); i.hasNext(); ) {
    Entity entity=(Entity)i.next();
    String className=entity.getClass().getName();
    String newClassName=getInstanceClassName(entity,options);
    if (Scene.v().containsClass(newClassName)) {
      continue;
    }
    System.out.println("String_Node_Str" + newClassName);
    System.out.println("String_Node_Str" + entity.getFullName());
    System.out.println("String_Node_Str" + className);
    if (entity.getClass().getName().equals("String_Node_Str")) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    }
 else     if (entity instanceof CompositeActor) {
      CompositeActor composite=(CompositeActor)entity;
      _createCompositeActor(composite,newClassName,options);
    }
 else     if (entity instanceof Expression) {
      AtomicActorCreator creator=new ExpressionCreator();
      creator.createAtomicActor((Expression)entity,newClassName,constAnalysis,options);
    }
 else     if (entity instanceof FSMActor) {
      FSMCreator creator=new FSMCreator();
      creator.createAtomicActor((FSMActor)entity,newClassName,constAnalysis,options);
    }
 else {
      GenericAtomicActorCreator creator=new GenericAtomicActorCreator();
      creator.createAtomicActor((AtomicActor)entity,newClassName,constAnalysis,options);
    }
    SootClass entityClass=Scene.v().loadClassAndSupport(newClassName);
    addActorForClass(entityClass,entity);
  }
}
Program: 75428
Project: 75428
Buggy source:
/** 
 * Merge the top two undo entries into a single action. If there are fewer than two entries on the stack, do nothing. Note that when two entries are merged, the one on the top of the stack becomes the first one executed and the one below that on the stack becomes the second one executed.
 */
public void mergeTopTwo(){
  if (_undoEntries.size() > 1) {
    UndoAction lastUndo=(UndoAction)_undoEntries.pop();
    UndoAction firstUndo=(UndoAction)_undoEntries.pop();
    UndoAction mergedAction=_mergeActions(lastUndo,firstUndo);
    _undoEntries.push(mergedAction);
    if (_DEBUG) {
      System.out.println("String_Node_Str" + mergedAction.toString());
    }
  }
}

Fixed version (ground truth):
/** 
 * Merge the top two undo entries into a single action, unless we are in either a redo or an undo, in which case the merge happens automatically and need not be explicitly requested by the client. If there are fewer than two entries on the stack, do nothing. Note that when two entries are merged, the one on the top of the stack becomes the first one executed and the one below that on the stack becomes the second one executed.
 */
public void mergeTopTwo(){
  if (_inUndo == 0 && _inRedo == 0) {
    if (_undoEntries.size() > 1) {
      UndoAction lastUndo=(UndoAction)_undoEntries.pop();
      UndoAction firstUndo=(UndoAction)_undoEntries.pop();
      UndoAction mergedAction=_mergeActions(lastUndo,firstUndo);
      _undoEntries.push(mergedAction);
      if (_DEBUG) {
        System.out.println("String_Node_Str" + mergedAction.toString());
      }
    }
  }
}
Program: 75429
Project: 75429
Buggy source:
/** 
 * Push an action to the undo stack, or if we are executing an undo, onto the redo stack.
 * @param action The undo action.
 */
public void push(UndoAction action){
  if (_inUndo > 1) {
    if (_DEBUG) {
      System.out.println("String_Node_Str" + action.toString());
    }
    UndoAction previousRedo=(UndoAction)_redoEntries.pop();
    _redoEntries.push(_mergeActions(previousRedo,action));
    _inUndo++;
  }
 else   if (_inUndo == 1) {
    if (_DEBUG) {
      System.out.println("String_Node_Str" + action.toString());
    }
    _redoEntries.push(action);
    _inUndo++;
  }
 else   if (_inRedo > 1) {
    if (_DEBUG) {
      System.out.println("String_Node_Str" + action.toString());
    }
    UndoAction previousRedo=(UndoAction)_redoEntries.pop();
    _undoEntries.push(_mergeActions(previousRedo,action));
    _inRedo++;
  }
 else   if (_inRedo == 1) {
    if (_DEBUG) {
      System.out.println("String_Node_Str" + action.toString());
    }
    _undoEntries.push(action);
    _inRedo++;
  }
 else {
    if (_DEBUG) {
      System.out.println("String_Node_Str" + action.toString());
    }
    _undoEntries.push(action);
    if (_DEBUG) {
      System.out.println("String_Node_Str");
    }
    _redoEntries.clear();
  }
}

Fixed version (ground truth):
/** 
 * Push an action to the undo stack, or if we are executing an undo, onto the redo stack.
 * @param action The undo action.
 */
public void push(UndoAction action){
  if (_inUndo > 1) {
    UndoAction previousRedo=(UndoAction)_redoEntries.pop();
    UndoAction mergedAction=_mergeActions(action,previousRedo);
    _redoEntries.push(mergedAction);
    if (_DEBUG) {
      System.out.println("String_Node_Str" + mergedAction.toString());
    }
    _inUndo++;
  }
 else   if (_inUndo == 1) {
    if (_DEBUG) {
      System.out.println("String_Node_Str" + action.toString());
    }
    _redoEntries.push(action);
    _inUndo++;
  }
 else   if (_inRedo > 1) {
    UndoAction previousUndo=(UndoAction)_undoEntries.pop();
    UndoAction mergedAction=_mergeActions(action,previousUndo);
    if (_DEBUG) {
      System.out.println("String_Node_Str" + mergedAction.toString());
    }
    _undoEntries.push(mergedAction);
    _inRedo++;
  }
 else   if (_inRedo == 1) {
    if (_DEBUG) {
      System.out.println("String_Node_Str" + action.toString());
    }
    _undoEntries.push(action);
    _inRedo++;
  }
 else {
    if (_DEBUG) {
      System.out.println("String_Node_Str" + action.toString());
    }
    _undoEntries.push(action);
    if (_DEBUG) {
      System.out.println("String_Node_Str");
    }
    _redoEntries.clear();
  }
}
Program: 75431
Project: 75431
Buggy source:
/** 
 * Set the expression associated with the iteration count. The expression will probably be something like "a2::in::tokenConsumptionRate/gcd(a2::in::tokenConsumptionRate, a::out::tokenProductionRate)."
 * @param expression The expression to be associated with the iterationcount.
 */
public void setIterationCount(String expression){
  try {
    PtParser parser=new PtParser();
    _parseTree=parser.generateParseTree(expression);
  }
 catch (  Exception exception) {
    throw new RuntimeException("String_Node_Str" + expression + "String_Node_Str"+ exception.getMessage());
  }
  _debugMessage("String_Node_Str");
  _debugMessage("String_Node_Str" + "String_Node_Str");
  _debugMessage("String_Node_Str" + expression + "String_Node_Str");
  _debugMessage("String_Node_Str" + _scheduleElement + "String_Node_Str");
  _debugMessage("String_Node_Str");
  _parseTree.displayParseTree("String_Node_Str");
  _debugMessage("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Set the expression associated with the iteration count. The expression will probably be something like "a2::in::tokenConsumptionRate/gcd(a2::in::tokenConsumptionRate, a::out::tokenProductionRate)."
 * @param expression The expression to be associated with the iterationcount.
 */
public void setIterationCount(String expression){
  _expression=expression;
  try {
    PtParser parser=new PtParser();
    _parseTree=parser.generateParseTree(expression);
  }
 catch (  Exception exception) {
    throw new RuntimeException("String_Node_Str" + expression + "String_Node_Str"+ exception.getMessage());
  }
  _debugMessage("String_Node_Str");
  _debugMessage("String_Node_Str" + "String_Node_Str");
  _debugMessage("String_Node_Str" + expression + "String_Node_Str");
  _debugMessage("String_Node_Str" + _scheduleElement + "String_Node_Str");
  _debugMessage("String_Node_Str");
  _parseTree.displayParseTree("String_Node_Str");
  _debugMessage("String_Node_Str");
}
Program: 75433
Project: 75433
Buggy source:
/** 
 * Return a string representation of this symbolic schedule.
 * @return The string representation.
 */
public String toString(){
  Schedule schedule=(Schedule)_scheduleElement;
  String result="String_Node_Str";
  result+=schedule.toString();
  result+="String_Node_Str";
  result+="String_Node_Str" + _parseTree().toString() + "String_Node_Str";
  return result;
}

Fixed version (ground truth):
/** 
 * Return a string representation of this symbolic schedule.
 * @return The string representation.
 */
public String toString(){
  Schedule schedule=(Schedule)_scheduleElement;
  String result="String_Node_Str";
  result+=schedule.toString();
  result+="String_Node_Str";
  result+="String_Node_Str" + expression() + "String_Node_Str";
  return result;
}
Program: 75435
Project: 75435
Buggy source:
private void _setupActor() throws Exception {
}

Fixed version (ground truth):
private void _setupActor(Actor actor) throws Exception {
}
Program: 75436
Project: 75436
Buggy source:
private void _refreshParameters() throws IllegalActionException, NameDuplicationException {
  Set parNames=new HashSet();
  for (int i=0; i < _actor.getParameters().length; i++) {
    String name=_actor.getParameters()[i].getName();
    if (this.getAttribute(name,ptolemy.data.expr.Parameter.class) == null)     new Parameter(this,name);
    parNames.add(name);
  }
  List parameters=this.attributeList(ptolemy.data.expr.Parameter.class);
  for (Iterator i=parameters.iterator(); i.hasNext(); ) {
    Parameter a=(Parameter)i.next();
    if (!parNames.contains(a.getName()))     a.setContainer(null);
  }
}

Fixed version (ground truth):
private void _refreshParameters() throws IllegalActionException, NameDuplicationException {
  Set parNames=new HashSet();
  if (_actor.getParameters() != null) {
    for (int i=0; i < _actor.getParameters().length; i++) {
      String name=_actor.getParameters()[i].getName();
      if (this.getAttribute(name,ptolemy.data.expr.Parameter.class) == null)       new Parameter(this,name);
      parNames.add(name);
    }
  }
  List parameters=this.attributeList(ptolemy.data.expr.Parameter.class);
  for (Iterator i=parameters.iterator(); i.hasNext(); ) {
    Parameter a=(Parameter)i.next();
    if (!parNames.contains(a.getName()))     a.setContainer(null);
  }
}
Program: 75437
Project: 75437
Buggy source:
/** 
 * The only attribute whose modifications are handled is the <tt>calCode</tt> attribute, which contains the source code of the CAL actor. <p> Whenever the source is changed, the text is parsed, transformed, and translated into an internal data structure used for interpretation.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If an error occurs parsing ortransforming the CAL source code.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == calCode) {
    String s=calCode.getExpression();
    try {
      _actor=_stringToActor(s);
      if (_actor != null) {
        _setupActor();
      }
    }
 catch (    Throwable ex) {
      throw new IllegalActionException(this,ex,"String_Node_Str");
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * The only attribute whose modifications are handled is the <tt>calCode</tt> attribute, which contains the source code of the CAL actor. <p> Whenever the source is changed, the text is parsed, transformed, and translated into an internal data structure used for interpretation.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If an error occurs parsing ortransforming the CAL source code.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == calCode) {
    String s=calCode.getExpression();
    try {
      Actor actor=_stringToActor(s);
      if (actor != null) {
        _setupActor(actor);
      }
    }
 catch (    Throwable ex) {
      throw new IllegalActionException(this,ex,"String_Node_Str");
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 75438
Project: 75438
Buggy source:
/** 
 * Create a new editable combo box entry in the given query associated with the attribute containing this style.  The name of the entry is the name of the attribute.  Attach the attribute to the created entry.
 * @param query The query into which to add the entry.
 * @exception IllegalActionException If the containing attributehas a value that cannot be edited using this style.
 */
public void addEntry(PtolemyQuery query) throws IllegalActionException {
  super.addEntry(query);
}

Fixed version (ground truth):
/** 
 * Create a new editable combo box entry in the given query associated with the attribute containing this style.  The name of the entry is the name of the attribute.  Attach the attribute to the created entry.
 * @param query The query into which to add the entry.
 * @exception IllegalActionException If the containing attributehas a value that cannot be edited using this style.
 */
public void addEntry(PtolemyQuery query) throws IllegalActionException {
  super.addEntry(query);
  _isEditable=true;
}
Program: 75439
Project: 75439
Buggy source:
/** 
 * Construct an attribute with the specified container and name.
 * @param container The container.
 * @param name The name of the attribute.
 * @exception IllegalActionException If the attribute is not of anacceptable attribute for the container, or if the container is not an instance of Settable.
 * @exception NameDuplicationException If the name coincides withan attribute already in the container.
 */
public EditableChoiceStyle(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
}

Fixed version (ground truth):
/** 
 * Construct an attribute with the specified container and name.
 * @param container The container.
 * @param name The name of the attribute.
 * @exception IllegalActionException If the attribute is not of anacceptable attribute for the container, or if the container is not an instance of Settable.
 * @exception NameDuplicationException If the name coincides withan attribute already in the container.
 */
public EditableChoiceStyle(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  _isEditable=true;
}
Program: 75440
Project: 75440
Buggy source:
/** 
 * An attempt is made to acquire the file name.  If it is  successful, create the RenderedOp to be fired.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the URL is null.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == fileOrURL) {
    URL url=fileOrURL.asURL();
    if (url == null) {
      throw new IllegalActionException("String_Node_Str");
    }
 else {
      _fileRoot=url.getFile();
      try {
        _stream=new FileSeekableStream(_fileRoot);
      }
 catch (      IOException error) {
        throw new IllegalActionException("String_Node_Str");
      }
      _outputtedImage=JAI.create("String_Node_Str",_stream);
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * An attempt is made to acquire the file name.  If it null, throw an exception.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the URL is null.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == fileOrURL) {
    URL url=fileOrURL.asURL();
    if (url == null) {
      throw new IllegalActionException("String_Node_Str");
    }
 else {
      _fileRoot=url.getFile();
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 75441
Project: 75441
Buggy source:
/** 
 * Output a JAIImageToken containing the image.
 * @exception IllegalActionException If a contained method throws it,or if the attempt to load the file has failed.
 */
public void fire() throws IllegalActionException {
  super.fire();
  output.send(0,new JAIImageToken(_outputtedImage));
}

Fixed version (ground truth):
/** 
 * Output a JAIImageToken containing the image.
 * @exception IllegalActionException If a contained method throws it,or if the attempt to load the file has failed.
 */
public void fire() throws IllegalActionException {
  super.fire();
  try {
    _stream=new FileSeekableStream(_fileRoot);
  }
 catch (  IOException error) {
    throw new IllegalActionException("String_Node_Str");
  }
  _outputtedImage=JAI.create("String_Node_Str",_stream);
  PlanarImage dummy=_outputtedImage.getRendering();
  try {
    _stream.close();
  }
 catch (  IOException error) {
    throw new IllegalActionException("String_Node_Str");
  }
  output.send(0,new JAIImageToken(_outputtedImage));
}
Program: 75442
Project: 75442
Buggy source:
/** 
 * Sets token production for initialize to one and resolves scheduling.
 * @exception IllegalActionException if thrown by base class.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  keyOut.setTokenInitProduction(1);
  parameters.setTokenInitProduction(1);
  getDirector().invalidateResolvedTypes();
}

Fixed version (ground truth):
/** 
 * Sets token production for initialize to one and resolves scheduling.
 * @exception IllegalActionException If thrown by base class.
 */
public void preinitialize() throws IllegalActionException {
  super.preinitialize();
  keyOut.setTokenInitProduction(1);
  parameters.setTokenInitProduction(1);
  getDirector().invalidateResolvedTypes();
}
Program: 75443
Project: 75443
Buggy source:
/** 
 * If there is a token on the <i>input</i> port, this method takes the data from the <i>input</i> and encrypts the data based on the <i>algorithm</i>, <i>provider</i>, <i>mode</i> and <i>padding</i> using the created secret key.  This is then sent on the <i>output</i>.  The public key is also sent out on the <i>keyOut</i> port.  All parameters should be the same as the corresponding decryption actor.  The call for encryption is done in the base class.
 * @exception IllegalActionException if thrown by base class.
 */
public void fire() throws IllegalActionException {
  keyOut.send(0,_unsignedByteArrayToArrayToken(_keyToBytes(_secretKey)));
  if (_algParams != null) {
    try {
      parameters.send(0,_unsignedByteArrayToArrayToken(_algParams.getEncoded()));
    }
 catch (    Exception ex) {
      throw new IllegalActionException(this,ex,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * If there is a token on the <i>input</i> port, this method takes the data from the <i>input</i> and encrypts the data based on the <i>algorithm</i>, <i>provider</i>, <i>mode</i> and <i>padding</i> using the created secret key.  This is then sent on the <i>output</i>.  The public key is also sent out on the <i>keyOut</i> port.  All parameters should be the same as the corresponding decryption actor.  The call for encryption is done in the base class.
 * @exception IllegalActionException If thrown by base class.
 */
public void fire() throws IllegalActionException {
}
Program: 75444
Project: 75444
Buggy source:
/** 
 * Get an instance of the cipher and outputs the key required for decryption.
 * @exception IllegalActionException If thrown by base class orif the algorithn is not found, or if the padding scheme is illegal, or if the specified provider does not exist.
 */
public void initialize() throws IllegalActionException {
  try {
    super.initialize();
    _secretKey=(SecretKey)_createSymmetricKey();
    _cipher.init(Cipher.ENCRYPT_MODE,_secretKey);
    _algParams=_cipher.getParameters();
    FIRST_RUN=true;
  }
 catch (  Exception ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Get an instance of the cipher and outputs the key required for decryption.
 * @exception IllegalActionException If thrown by base class orif the algorithn is not found, or if the padding scheme is illegal, or if the specified provider does not exist.
 */
public void initialize() throws IllegalActionException {
  try {
    super.initialize();
    _secretKey=(SecretKey)_createSymmetricKey();
    _cipher.init(Cipher.ENCRYPT_MODE,_secretKey);
    _algorithmParameters=_cipher.getParameters();
    FIRST_RUN=true;
  }
 catch (  Exception ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str");
  }
}
Program: 75445
Project: 75445
Buggy source:
/** 
 * Encrypt the data with the specified key.  Receives the data to be encrypted as a byte array and returns a byte array.  Also creates and sends an initialization vector if necessary.
 * @param dataBytes the data to be encrypted.
 * @return byte[] the encrypted data.
 * @exception IllegalActionException if exception below it thrown.
 * @exception IOException if error occurs in ByteArrayOutputStream.
 * @exception InvalideKeyException if key is invalid.
 * @exception BadPaddingException if padding is bad.
 * @exception IllegalBockSizeException if illegal block size.
 */
protected byte[] _process(byte[] dataBytes) throws IllegalActionException {
  _byteArrayOutputStream.reset();
  try {
    _byteArrayOutputStream.write(_cipher.doFinal(dataBytes));
  }
 catch (  Exception ex) {
    throw new IllegalActionException(this,ex,"String_Node_Str" + dataBytes.length + "String_Node_Str");
  }
  return _byteArrayOutputStream.toByteArray();
}

Fixed version (ground truth):
/** 
 * Encrypt the data with the specified key.  Receives the data to be encrypted as a byte array and returns a byte array.  Also creates and sends an initialization vector if necessary.
 * @param dataBytes the data to be encrypted.
 * @return byte[] the encrypted data.
 * @exception IllegalActionException If error occurs inByteArrayOutputStream, if the key is invalid, if the padding is bad or if the block size is illegal.
 */
protected byte[] _process(byte[] dataBytes) throws IllegalActionException {
}
Program: 75449
Project: 75449
Buggy source:
/** 
 * Resolve the IODependence describing the relation between the inputs and outputs of an actor. If the cached version is valid, use the cached one. Otherwise, recaculate a new  one. Cache and synchronize the new version with the workspace. 
 * @exception IllegalActionException If the name has a period in it, orthe attribute is not compatible with the specified container.
 * @exception NameDuplicationException If the container already containsan entity with the specified name.
 */
public void inferDependence() throws IllegalActionException, NameDuplicationException {
  if (_dgValid != workspace().getVersion()) {
    _dg=_constructDirectedGraph();
    _dgValid=workspace().getVersion();
  }
}

Fixed version (ground truth):
/** 
 * Resolve the IODependence describing the relation between the inputs and outputs of an actor. If the cached version is valid, use the cached one. Otherwise, recaculate a new  one. Cache and synchronize the new version with the workspace. 
 * @exception IllegalActionException If the name has a period in it, orthe attribute is not compatible with the specified container.
 * @exception NameDuplicationException If the container already containsan entity with the specified name.
 */
public void inferDependence() throws IllegalActionException, NameDuplicationException {
  if (_dgValid != workspace().getVersion()) {
    _dg=_constructDirectedGraph();
    if (_debugging) {
      _debug(getContainer().getName() + "String_Node_Str" + "String_Node_Str");
      _debug(_dg.toString());
    }
    _dgValid=workspace().getVersion();
  }
}
Program: 75450
Project: 75450
Buggy source:
/** 
 * React to notification of a change in controller status. event The event.
 */
public synchronized void controllerUpdate(ControllerEvent event){
  notifyAll();
}

Fixed version (ground truth):
/** 
 * React to notification of a change in controller status.
 * @param event The event.
 */
public synchronized void controllerUpdate(ControllerEvent event){
  notifyAll();
}
Program: 75451
Project: 75451
Buggy source:
public boolean postfire() throws IllegalActionException {
  ObjectToken objectToken=(ObjectToken)input.get(0);
  DataSource input=(DataSource)objectToken.getValue();
  if (_player != null) {
    _player.removeControllerListener(this);
  }
  try {
    _player=Manager.createRealizedPlayer(input);
    _player.addControllerListener(this);
    _player.prefetch();
  }
 catch (  IOException ex) {
    throw new IllegalActionException(this,"String_Node_Str" + ex.toString());
  }
catch (  MediaException ex) {
    throw new IllegalActionException(this,"String_Node_Str" + ex.toString());
  }
  _player.setMediaTime(_startTime);
  _frame=new JFrame();
  _container=_frame.getContentPane();
  _container.setLayout(new GridLayout(2,1));
  Component controlPanel=_player.getControlPanelComponent();
  Component videoPanel=_player.getVisualComponent();
  _container.add(videoPanel);
  _container.add(controlPanel);
  _frame.show();
  _player.start();
  return super.postfire();
}

Fixed version (ground truth):
/** 
 * Accept an ObjectToken containing a DataSource, and set it up for playing.
 * @exception IllegalActionException If there is no director,if the file cannot be opened, or if the Java Media Framework throws an exception.
 * @return super.postfire()
 */
public boolean postfire() throws IllegalActionException {
  ObjectToken objectToken=(ObjectToken)input.get(0);
  DataSource input=(DataSource)objectToken.getValue();
  if (_player != null) {
    _player.removeControllerListener(this);
  }
  try {
    _player=Manager.createRealizedPlayer(input);
    _player.addControllerListener(this);
    _player.prefetch();
  }
 catch (  IOException ex) {
    throw new IllegalActionException(this,"String_Node_Str" + ex.toString());
  }
catch (  MediaException ex) {
    throw new IllegalActionException(this,"String_Node_Str" + ex.toString());
  }
  _player.setMediaTime(_startTime);
  _frame=new JFrame();
  _container=_frame.getContentPane();
  _container.setLayout(new BorderLayout());
  Component controlPanel=_player.getControlPanelComponent();
  Component videoPanel=_player.getVisualComponent();
  _container.add(videoPanel,BorderLayout.CENTER);
  _container.add(controlPanel,BorderLayout.SOUTH);
  _container.validate();
  _frame.pack();
  _frame.show();
  _player.start();
  return super.postfire();
}
Program: 75452
Project: 75452
Buggy source:
/** 
 * React to notification of a change in controller status. event The event.
 */
public synchronized void controllerUpdate(ControllerEvent event){
  notifyAll();
}

Fixed version (ground truth):
/** 
 * React to notification of a change in controller status.
 * @param event The event.
 */
public synchronized void controllerUpdate(ControllerEvent event){
  notifyAll();
}
Program: 75453
Project: 75453
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 VideoPlayer(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  input=new TypedIOPort(this,"String_Node_Str",true,false);
  input.setTypeEquals(BaseType.OBJECT);
}

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 VideoPlayer(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  input.setTypeEquals(BaseType.OBJECT);
}
Program: 75455
Project: 75455
Buggy source:
/** 
 * Return the list of identifiers within the scope.
 * @return The list of variable names within the scope.
 */
public Set identifierSet(){
  return getAllScopedVariableNames(Variable.this,_reference);
}

Fixed version (ground truth):
/** 
 * Return the list of identifiers within the scope.
 * @return The list of variable names within the scope.
 */
public Set identifierSet(){
  NamedObj reference=_reference;
  if (_reference == null) {
    reference=(NamedObj)Variable.this.getContainer();
  }
  return getAllScopedVariableNames(Variable.this,reference);
}
Program: 75456
Project: 75456
Buggy source:
/** 
 * Look up and return the type of the attribute with the specified name in the scope. Return null if such an attribute does not exist.
 * @return The attribute with the specified name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public ptolemy.data.type.Type getType(String name) throws IllegalActionException {
  Variable result=getScopedVariable(Variable.this,_reference,name);
  if (result != null) {
    return result.getType();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Look up and return the type of the attribute with the specified name in the scope. Return null if such an attribute does not exist.
 * @return The attribute with the specified name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public ptolemy.data.type.Type getType(String name) throws IllegalActionException {
  NamedObj reference=_reference;
  if (_reference == null) {
    reference=(NamedObj)Variable.this.getContainer();
  }
  Variable result=getScopedVariable(Variable.this,reference,name);
  if (result != null) {
    return result.getType();
  }
 else {
    return null;
  }
}
Program: 75457
Project: 75457
Buggy source:
/** 
 * Construct a scope consisting of the variables of the specified container its containers and their scope-extending attributes. If the argument is null, then use the container of the enclosing instance of Variable as the reference for the scope.
 */
public VariableScope(NamedObj reference){
  _reference=reference;
  if (_reference == null) {
    _reference=(NamedObj)Variable.this.getContainer();
  }
}

Fixed version (ground truth):
/** 
 * Construct a scope consisting of the variables of the specified container its containers and their scope-extending attributes. If the argument is null, then use the container of the enclosing instance of Variable as the reference for the scope.
 */
public VariableScope(NamedObj reference){
  _reference=reference;
}
Program: 75458
Project: 75458
Buggy source:
/** 
 * Look up and return the attribute with the specified name in the scope. Return null if such an attribute does not exist.
 * @return The attribute with the specified name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public ptolemy.data.Token get(String name) throws IllegalActionException {
  if (_variablesDependentOn == null) {
    _variablesDependentOn=new HashMap();
  }
 else {
    if (_variablesDependentOnVersion == workspace().getVersion()) {
      Variable result=(Variable)_variablesDependentOn.get(name);
      if (result != null) {
        return result.getToken();
      }
    }
 else {
      _variablesDependentOn.clear();
    }
  }
  _variablesDependentOnVersion=workspace().getVersion();
  Variable result=getScopedVariable(Variable.this,_reference,name);
  if (result != null) {
    if (!_variablesDependentOn.containsValue(result)) {
      result.addValueListener(Variable.this);
      _variablesDependentOn.put(name,result);
    }
    return result.getToken();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Look up and return the attribute with the specified name in the scope. Return null if such an attribute does not exist.
 * @return The attribute with the specified name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public ptolemy.data.Token get(String name) throws IllegalActionException {
  if (_variablesDependentOn == null) {
    _variablesDependentOn=new HashMap();
  }
 else {
    if (_variablesDependentOnVersion == workspace().getVersion()) {
      Variable result=(Variable)_variablesDependentOn.get(name);
      if (result != null) {
        return result.getToken();
      }
    }
 else {
      _variablesDependentOn.clear();
    }
  }
  _variablesDependentOnVersion=workspace().getVersion();
  NamedObj reference=_reference;
  if (_reference == null) {
    reference=(NamedObj)Variable.this.getContainer();
  }
  Variable result=getScopedVariable(Variable.this,reference,name);
  if (result != null) {
    if (!_variablesDependentOn.containsValue(result)) {
      result.addValueListener(Variable.this);
      _variablesDependentOn.put(name,result);
    }
    return result.getToken();
  }
 else {
    return null;
  }
}
Program: 75462
Project: 75462
Buggy source:
/** 
 * Consume one input token, if there is one, and produce one output token.  If there is no input, the produce no output.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  if (input.hasToken(0)) {
    System.arraycopy(_backward,0,_backwardCache,0,_order + 1);
    System.arraycopy(_forward,0,_forwardCache,0,_order + 1);
    DoubleToken in=(DoubleToken)input.get(0);
    _forwardCache[0]=in.doubleValue();
    _doFilter();
    _backwardCache[0]=_forwardCache[0];
    output.broadcast(new DoubleToken(_forwardCache[_order]));
  }
}

Fixed version (ground truth):
/** 
 * Consume one input token, if there is one, and produce one output token.  If there is no input, the produce no output.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  if (input.hasToken(0)) {
    DoubleToken in=(DoubleToken)input.get(0);
    _forwardCache[0]=in.doubleValue();
    _doFilter();
    _backwardCache[0]=_forwardCache[0];
    output.broadcast(new DoubleToken(_forwardCache[_order]));
  }
}
Program: 75463
Project: 75463
Buggy source:
/** 
 * Consume one input token, if there is one, and produce one output token.  If there is no input, then produce no output.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  if (input.hasToken(0)) {
    System.arraycopy(_backward,0,_backwardCache,0,_backward.length);
    System.arraycopy(_forward,0,_forwardCache,0,_forward.length);
    DoubleToken inputValue=(DoubleToken)input.get(0);
    double k;
    int M=_backward.length - 1;
    _forwardCache[0]=inputValue.doubleValue();
    for (int i=1; i <= M; i++) {
      k=_reflectionCoefs[M - i];
      _forwardCache[i]=k * _backwardCache[i] + _forwardCache[i - 1];
    }
    output.broadcast(new DoubleToken(_forwardCache[M]));
    for (int i=1; i < M; i++) {
      k=-_reflectionCoefs[M - 1 - i];
      _backwardCache[i]=_backwardCache[i + 1] + k * _forwardCache[i + 1];
    }
    _backwardCache[M]=_forwardCache[M];
  }
}

Fixed version (ground truth):
/** 
 * Consume one input token, if there is one, and produce one output token.  If there is no input, then produce no output.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  if (input.hasToken(0)) {
    DoubleToken inputValue=(DoubleToken)input.get(0);
    double k;
    int M=_backward.length - 1;
    _forwardCache[0]=inputValue.doubleValue();
    for (int i=1; i <= M; i++) {
      k=_reflectionCoefs[M - i];
      _forwardCache[i]=k * _backwardCache[i] + _forwardCache[i - 1];
    }
    output.broadcast(new DoubleToken(_forwardCache[M]));
    for (int i=1; i < M; i++) {
      k=-_reflectionCoefs[M - 1 - i];
      _backwardCache[i]=_backwardCache[i + 1] + k * _forwardCache[i + 1];
    }
    _backwardCache[M]=_forwardCache[M];
  }
}
Program: 75467
Project: 75467
Buggy source:
/** 
 * Create a new instance of Transition with the specified name in this actor, and return it. This method is write-synchronized on the workspace.
 * @param name The name of the new transition.
 * @return A transition with the given name.
 * @exception IllegalActionException If the name argument is null.
 * @exception NameDuplicationException If name collides with thatof a transition already in this actor.
 */
public ComponentRelation newRelation(String name) throws IllegalActionException, NameDuplicationException {
  try {
    workspace().getWriteAccess();
    Transition tr=new Transition(this,name);
    return tr;
  }
  finally {
    workspace().doneWriting();
  }
}

Fixed version (ground truth):
/** 
 * Create a new instance of Transition with the specified name in this actor, and return it. This method is write-synchronized on the workspace.
 * @param name The name of the new transition.
 * @return A transition with the given name.
 * @exception IllegalActionException If the name argument is null.
 * @exception NameDuplicationException If name collides with thatof a transition already in this actor.
 */
public ComponentRelation newRelation(String name) throws IllegalActionException, NameDuplicationException {
  try {
    workspace().getWriteAccess();
    Director director=getDirector();
    Transition tr=new Transition(this,name);
    if (director instanceof HDFFSMDirector) {
      (tr.preemptive).setVisibility(Settable.NONE);
    }
    return tr;
  }
  finally {
    workspace().doneWriting();
  }
}
Program: 75468
Project: 75468
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. Throw an exception if this actor does not contain a state with name specified by the <i>initialStateName</i> attribute.
 * @exception IllegalActionException If this actor does not contain astate with name specified by the <i>initialStateName</i> attribute.
 */
public void preinitialize() throws IllegalActionException {
  _stopRequested=false;
  _reachedFinalState=false;
  _createReceivers();
}

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. Throw an exception if this actor does not contain a state with name specified by the <i>initialStateName</i> attribute.
 * @exception IllegalActionException If this actor does not contain astate with name specified by the <i>initialStateName</i> attribute.
 */
public void preinitialize() throws IllegalActionException {
  _stopRequested=false;
  _reachedFinalState=false;
  _createReceivers();
  _hdfArrays=new Hashtable();
}
Program: 75469
Project: 75469
Buggy source:
/** 
 * Initialize the actors associated with this director, set the size of the schedule cache, and then compute the schedule. The schedule is computed during initialization so that hierarchical opaque composite actors can be scheduled properly (since the act of computing the schedule sets the rate parameters of the external ports). The order in which the actors are initialized is arbitrary.
 * @exception IllegalActionException If the initialize() method ofone of the associated actors throws it, or if there is no scheduler, or if the cache size parameter is not set to a valid value.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  SDFScheduler scheduler=(SDFScheduler)getScheduler();
  int cacheSize=((IntToken)(scheduleCacheSize.getToken())).intValue();
}

Fixed version (ground truth):
/** 
 * Initialize the actors associated with this director, set the size of the schedule cache, and then compute the schedule. The schedule is computed during initialization so that hierarchical opaque composite actors can be scheduled properly (since the act of computing the schedule sets the rate parameters of the external ports). The order in which the actors are initialized is arbitrary.
 * @exception IllegalActionException If the initialize() method ofone of the associated actors throws it, or if there is no scheduler, or if the cache size parameter is not set to a valid value.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  SDFScheduler scheduler=(SDFScheduler)getScheduler();
  getSchedule();
  int cacheSize=((IntToken)(scheduleCacheSize.getToken())).intValue();
}