nus-yam/ex-repair huggingface dataset:
Program: 76110
Project: 76110
Buggy source:
private double[][] _byteArrayToDoubleArray(byte[] byteArray,int bytesPerSample,int channels){
  int lengthInSamples=byteArray.length / (bytesPerSample * channels);
  double[][] doubleArray=new double[channels][lengthInSamples];
  double maxSampleReciprocal;
  if (bytesPerSample == 2) {
    maxSampleReciprocal=3.0517578125e-5;
  }
 else   if (bytesPerSample == 1) {
    maxSampleReciprocal=7.8125e-3;
  }
 else   if (bytesPerSample == 3) {
    maxSampleReciprocal=1.1920928955e07;
  }
 else   if (bytesPerSample == 4) {
    maxSampleReciprocal=4.655661287308e-10;
  }
 else {
    maxSampleReciprocal=0;
  }
  byte[] b=new byte[bytesPerSample];
  for (int currSamp=0; currSamp < lengthInSamples; currSamp++) {
    for (int currChannel=0; currChannel < channels; currChannel++) {
      for (int i=0; i < bytesPerSample; i+=1) {
        b[i]=byteArray[currSamp * bytesPerSample * channels + bytesPerSample * currChannel + i];
      }
      int result=(b[0] >> 7);
      for (int i=0; i < bytesPerSample; i+=1)       result=(result << 8) + (b[i] & 0xff);
      doubleArray[currChannel][currSamp]=((double)result * maxSampleReciprocal);
    }
  }
  return doubleArray;
}

Fixed version (ground truth):
private double[][] _byteArrayToDoubleArray(byte[] byteArray,int bytesPerSample,int channels){
  int lengthInSamples=byteArray.length / (bytesPerSample * channels);
  if ((channels != _doubleArray.length) || (lengthInSamples != _doubleArray[0].length)) {
    _doubleArray=new double[channels][lengthInSamples];
  }
  double maxSampleReciprocal;
  if (bytesPerSample == 2) {
    maxSampleReciprocal=3.0517578125e-5;
  }
 else   if (bytesPerSample == 1) {
    maxSampleReciprocal=7.8125e-3;
  }
 else   if (bytesPerSample == 3) {
    maxSampleReciprocal=1.1920928955e07;
  }
 else   if (bytesPerSample == 4) {
    maxSampleReciprocal=4.655661287308e-10;
  }
 else {
    maxSampleReciprocal=0;
  }
  if (bytesPerSample != _b.length) {
    _b=new byte[bytesPerSample];
  }
  for (int currSamp=0; currSamp < lengthInSamples; currSamp++) {
    for (int currChannel=0; currChannel < channels; currChannel++) {
      for (int i=0; i < bytesPerSample; i+=1) {
        _b[i]=byteArray[currSamp * bytesPerSample * channels + bytesPerSample * currChannel + i];
      }
      int result=(_b[0] >> 7);
      for (int i=0; i < bytesPerSample; i+=1)       result=(result << 8) + (_b[i] & 0xff);
      _doubleArray[currChannel][currSamp]=((double)result * maxSampleReciprocal);
    }
  }
  return _doubleArray;
}
Program: 76111
Project: 76111
Buggy source:
private int[][] _byteArrayToIntArray(byte[] byteArray,int bytesPerSample,int channels){
  int lengthInSamples=byteArray.length / (bytesPerSample * channels);
  int[][] intArray=new int[channels][lengthInSamples];
  byte[] b=new byte[bytesPerSample];
  for (int currSamp=0; currSamp < lengthInSamples; currSamp++) {
    for (int currChannel=0; currChannel < channels; currChannel++) {
      for (int i=0; i < bytesPerSample; i+=1) {
        b[i]=byteArray[currSamp * bytesPerSample * channels + bytesPerSample * currChannel + i];
      }
      int result=(b[0] >> 7);
      for (int i=0; i < bytesPerSample; i+=1)       result=(result << 8) + (b[i] & 0xff);
      intArray[currChannel][currSamp]=result;
    }
  }
  return intArray;
}

Fixed version (ground truth):
private int[][] _byteArrayToIntArray(byte[] byteArray,int bytesPerSample,int channels){
  int lengthInSamples=byteArray.length / (bytesPerSample * channels);
  if ((channels != _doubleArray.length) || (lengthInSamples != _doubleArray[0].length)) {
    _intArray=new int[channels][lengthInSamples];
  }
  if (bytesPerSample != _b.length) {
    _b=new byte[bytesPerSample];
  }
  for (int currSamp=0; currSamp < lengthInSamples; currSamp++) {
    for (int currChannel=0; currChannel < channels; currChannel++) {
      for (int i=0; i < bytesPerSample; i+=1) {
        _b[i]=byteArray[currSamp * bytesPerSample * channels + bytesPerSample * currChannel + i];
      }
      int result=(_b[0] >> 7);
      for (int i=0; i < bytesPerSample; i+=1)       result=(result << 8) + (_b[i] & 0xff);
      _intArray[currChannel][currSamp]=result;
    }
  }
  return _intArray;
}
Program: 76112
Project: 76112
Buggy source:
/** 
 * Set the vector length. The vector length of an acotor is defined as the number of tokens that are consumed and/or produced when the actor is fired. If a vectorizable actor is used in a domain that supports vectorized actors, then the director may invoke this method to set the vector length. This method is not guaranteed to be invoked, so a  vectorizable actor should use a default vector length of 1. An exception will occur if the requested vector length is less than 1.
 * @param vectorLength The requested vector length to use forthe actor.
 * @exception IllegalActionException If the requested vector lengthis invalid or cannot be set.
 */
public void setVectorLength(int vectorLength) throws IllegalActionException ;

Fixed version (ground truth):
/** 
 * Set the vector length. The vector length of an actor is defined as the number of tokens that are consumed and/or produced when the actor is fired. If a vectorizable actor is used in a domain that supports vectorized actors, then the director may invoke this method to set the vector length. This method is not guaranteed to be invoked, so a  vectorizable actor should use a default vector length of 1. An exception will occur if the requested vector length is less than 1.
 * @param vectorLength The requested vector length to use forthe actor.
 * @exception IllegalActionException If the requested vector lengthis invalid or cannot be set.
 */
public void setVectorLength(int vectorLength) throws IllegalActionException ;
Program: 76113
Project: 76113
Buggy source:
/** 
 * Return the value of this token as a string that can be parsed by the expression language to recover a token with the same value. The exact form of the number depends on its value, and may be either decimal or exponential.  In general, exponential is used for numbers whose magnitudes are very large or very small, except for zero which is always represented as 0.0.  The behavior is roughly the same as Double.toString(), except that we limit the precision to seven fractional digits.  If you really must have better precision,  then use <code>Double.toString(token.doubleValue())</code>.
 * @return A String representing the double value of this token.
 */
public String toString(){
  double mag=Math.abs(_value);
  if (mag == 0.0 || (mag < 1000000 && mag > .001))   return _regularFormat.format(_value);
 else   return _exponentialFormat.format(_value);
}

Fixed version (ground truth):
/** 
 * Return the value of this token as a string that can be parsed by the expression language to recover a token with the same value. The exact form of the number depends on its value, and may be either decimal or exponential.  In general, exponential is used for numbers whose magnitudes are very large or very small, except for zero which is always represented as 0.0.  The behavior is roughly the same as Double.toString(), except that we limit the precision to seven fractional digits.  If you really must have better precision,  then use <code>Double.toString(token.doubleValue())</code>.
 * @return A String representing the double value of this token.
 */
public String toString(){
  double mag=Math.abs(_value);
  if (mag == 0.0 || (mag < 1000000 && mag > .001)) {
    if (_regularFormat == null) {
      _regularFormat=new DecimalFormat("String_Node_Str");
    }
    return _regularFormat.format(_value);
  }
 else {
    if (_exponentialFormat == null) {
      _exponentialFormat=new DecimalFormat("String_Node_Str");
    }
    return _exponentialFormat.format(_value);
  }
}
Program: 76115
Project: 76115
Buggy source:
public Object visitAllocateAnonymousClassNode(AllocateAnonymousClassNode node,LinkedList args){
}

Fixed version (ground truth):
public Object visitAllocateAnonymousClassNode(AllocateAnonymousClassNode node,LinkedList args){
  LinkedList retList=new LinkedList();
  TreeNode enclosingInstance=node.getEnclosingInstance();
  int enclosingID=enclosingInstance.classID();
  if ((enclosingID != ABSENTTREENODE_ID) && (enclosingID != THISNODE_ID)) {
    LinkedList enclosingStringList=(LinkedList)node.childReturnValueAt(node.CHILD_INDEX_ENCLOSINGINSTANCE);
    retList.addLast(_parenExpr(enclosingInstance,enclosingStringList));
    retList.addLast("String_Node_Str");
  }
  retList.addLast("String_Node_Str");
  retList.addLast(node.childReturnValueAt(node.CHILD_INDEX_SUPERTYPE));
  retList.addLast("String_Node_Str");
  retList.addLast(_commaList((List)node.childReturnValueAt(node.CHILD_INDEX_SUPERARGS)));
  retList.addLast("String_Node_Str");
  retList.addLast(node.childReturnValueAt(node.CHILD_INDEX_MEMBERS));
  retList.addLast("String_Node_Str");
  return retList;
}
Program: 76116
Project: 76116
Buggy source:
/** 
 * Update the parameter if it has been changed. The new parameter will be used only after this method is called.
 * @exception IllegalActionException If the sampling rate set isless than or equal to 0.
 */
public void attributeChanged(Attribute att) throws IllegalActionException {
  double p=((DoubleToken)samplePeriod.getToken()).doubleValue();
  if (p <= 0) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  _samplePeriod=p;
}

Fixed version (ground truth):
/** 
 * Update the parameter if it has been changed. The new parameter will be used only after this method is called.
 * @exception IllegalActionException If the sampling rate set isless than or equal to 0.
 */
public void attributeChanged(Attribute att) throws IllegalActionException {
  double p=((DoubleToken)samplePeriod.getToken()).doubleValue();
  if (p <= 0) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
 else {
    _samplePeriod=p;
  }
}
Program: 76117
Project: 76117
Buggy source:
/** 
 * Emit the current event, which has the token of the latest input token.
 */
public void emitCurrentEvents(){
  if (_hasCurrentEvent) {
    try {
      for (int i=0; i < Math.min(input.getWidth(),output.getWidth()); i++) {
        if (input.hasToken(i)) {
          output.send(i,input.get(i));
        }
      }
      _hasCurrentEvent=false;
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Emit the current event, which has the token of the latest input token.
 */
public void emitCurrentEvents(){
  if (_hasCurrentEvent) {
    try {
      for (int i=0; i < Math.min(input.getWidth(),output.getWidth()); i++) {
        if (input.hasToken(i)) {
          output.send(i,input.get(i));
        }
      }
      _hasCurrentEvent=false;
      _nextSamplingTime+=_samplePeriod;
      getDirector().fireAt(this,_nextSamplingTime);
    }
 catch (    IllegalActionException e) {
      throw new InternalErrorException("String_Node_Str");
    }
  }
}
Program: 76118
Project: 76118
Buggy source:
/** 
 * Request the first sampling time as a director refire.
 * @exception IllegalActionException If thrown by the supper class.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  if (input.hasToken(0)) {
    input.get(0);
  }
  _hasCurrentEvent=false;
  CTDirector dir=(CTDirector)getDirector();
  _nextSamplingTime=dir.getCurrentTime() + _samplePeriod;
  dir.fireAt(this,_nextSamplingTime);
  if (_debugging)   _debug(getFullName() + "String_Node_Str" + _nextSamplingTime);
}

Fixed version (ground truth):
/** 
 * Request the first sampling time as a director refire.
 * @exception IllegalActionException If thrown by the supper class.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  if (input.hasToken(0)) {
    input.get(0);
  }
  _hasCurrentEvent=false;
  CTDirector dir=(CTDirector)getDirector();
  _nextSamplingTime=dir.getCurrentTime();
  dir.fireAt(this,dir.getCurrentTime());
  if (_debugging)   _debug(getFullName() + "String_Node_Str" + _nextSamplingTime);
}
Program: 76119
Project: 76119
Buggy source:
/** 
 * Return true if the mode controller wishes to be scheduled for another iteration. Postfire the refinement of the current state of the mode controller and take out event outputs that the refinement generates. Examine the outgoing transitions of the current state. Throw an exception if there is more than one transition enabled. If there is exactly one transition enabled then it is chosen and the choice actions contained by the transition are executed. Execute the commit actions contained by the last chosen transition of the mode controller and set its current state to the destination state of the transition.
 * @return True if the mode controller wishes to be scheduled foranother iteration.
 * @exception IllegalActionException If thrown by any action, orthere is no controller, or there is more than one transition enabled.
 */
public boolean postfire() throws IllegalActionException {
  FSMActor ctrl=getController();
  Actor ref=ctrl.currentState().getRefinement();
  if (ref != null) {
    ref.postfire();
    Iterator outports=ref.outputPortList().iterator();
    while (outports.hasNext()) {
      IOPort p=(IOPort)outports.next();
      transferOutputs(p);
    }
    ctrl._setInputsFromRefinement();
  }
  State st=ctrl.currentState();
  Transition tr=ctrl._chooseTransition(st.outgoingPort.linkedRelationList());
  if (_debugging && tr != null) {
    _debug(tr.getFullName(),"String_Node_Str");
  }
  CompositeActor hs=(CompositeActor)getContainer();
  CTDirector dir=(CTDirector)hs.getExecutiveDirector();
  return super.postfire();
}

Fixed version (ground truth):
/** 
 * Return true if the mode controller wishes to be scheduled for another iteration. Postfire the refinement of the current state of the mode controller and take out event outputs that the refinement generates. Examine the outgoing transitions of the current state. Throw an exception if there is more than one transition enabled. If there is exactly one transition enabled then it is chosen and the choice actions contained by the transition are executed. Execute the commit actions contained by the last chosen transition of the mode controller and set its current state to the destination state of the transition.
 * @return True if the mode controller wishes to be scheduled foranother iteration.
 * @exception IllegalActionException If thrown by any action, orthere is no controller, or there is more than one transition enabled.
 */
public boolean postfire() throws IllegalActionException {
  FSMActor ctrl=getController();
  Actor ref=ctrl.currentState().getRefinement();
  if (ref != null) {
    ref.postfire();
    Iterator outports=ref.outputPortList().iterator();
    while (outports.hasNext()) {
      IOPort p=(IOPort)outports.next();
      transferOutputs(p);
    }
    ctrl._setInputsFromRefinement();
  }
  State st=ctrl.currentState();
  Transition tr=ctrl._chooseTransition(st.outgoingPort.linkedRelationList());
  if (_debugging && tr != null) {
    _debug(tr.getFullName(),"String_Node_Str");
  }
  return super.postfire();
}
Program: 76121
Project: 76121
Buggy source:
public void executionFinished(Manager manager){
  _controller.rerender();
}

Fixed version (ground truth):
public void executionFinished(Manager manager){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      _controller.rerender();
    }
  }
);
}
Program: 76122
Project: 76122
Buggy source:
public Object visitMethodDeclNode(MethodDeclNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  subCtx.encLoop=null;
  subCtx.breakTarget=null;
  Environ env=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  subCtx.environ=env;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setParams(TNLManip.traverseList(this,node,childArgs,node.getParams()));
  TreeNode body=node.getBody();
  if (body != AbsentTreeNode.instance) {
    node.setBody((BlockNode)body.accept(this,childArgs));
  }
  return node;
}

Fixed version (ground truth):
public Object visitMethodDeclNode(MethodDeclNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  subCtx.encLoop=null;
  subCtx.breakTarget=null;
  Environ newEnv1=new Environ(ctx.environ);
  subCtx.environ=newEnv1;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setParams(TNLManip.traverseList(this,node,childArgs,node.getParams()));
  TreeNode body=node.getBody();
  subCtx.environ=new Environ(newEnv1);
  if (body != AbsentTreeNode.instance) {
    node.setBody((BlockNode)body.accept(this,childArgs));
  }
  return node;
}
Program: 76123
Project: 76123
Buggy source:
public Object visitLocalVarDeclNode(LocalVarDeclNode node,LinkedList args){
  node.setInitExpr((TreeNode)node.getInitExpr().accept(this,args));
  NameContext ctx=(NameContext)args.get(0);
  Environ env=ctx.environ;
  NameNode name=node.getName();
  String varName=name.getIdent();
  Decl other=env.lookup(varName,CG_FORMAL);
  if (other != null) {
    ApplicationUtility.error("String_Node_Str" + varName);
  }
 else {
    other=env.lookupProper(varName,CG_LOCALVAR);
    if (other != null) {
      ApplicationUtility.error("String_Node_Str" + varName);
    }
  }
  LocalVarDecl d=new LocalVarDecl(varName,node.getDefType(),node.getModifiers(),node);
  env.add(d);
  name.setProperty(DECL_KEY,d);
  return node;
}

Fixed version (ground truth):
public Object visitLocalVarDeclNode(LocalVarDeclNode node,LinkedList args){
  node.setInitExpr((TreeNode)node.getInitExpr().accept(this,args));
  NameContext ctx=(NameContext)args.get(0);
  Environ env=ctx.environ;
  NameNode name=node.getName();
  String varName=name.getIdent();
  Decl other=env.lookup(varName,CG_FORMAL);
  if (other != null) {
    ApplicationUtility.error("String_Node_Str" + varName);
  }
  other=env.lookupProper(varName,CG_LOCALVAR);
  if (other != null) {
    ApplicationUtility.error("String_Node_Str" + varName);
  }
  LocalVarDecl d=new LocalVarDecl(varName,node.getDefType(),node.getModifiers(),node);
  env.add(d);
  name.setProperty(DECL_KEY,d);
  return node;
}
Program: 76124
Project: 76124
Buggy source:
public Object visitObjectFieldAccessNode(ObjectFieldAccessNode node,LinkedList args){
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=true;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setObject((ExprNode)(node.getObject().accept(this,childArgs)));
  return node;
}

Fixed version (ground truth):
public Object visitObjectFieldAccessNode(ObjectFieldAccessNode node,LinkedList args){
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=true;
  node.setObject((ExprNode)(node.getObject().accept(this,TNLManip.cons(subCtx))));
  return node;
}
Program: 76125
Project: 76125
Buggy source:
public Object visitSwitchNode(SwitchNode node,LinkedList args){
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  node.setExpr((ExprNode)node.getExpr().accept(this,args));
  subCtx.breakTarget=node;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setSwitchBlocks(TNLManip.traverseList(this,node,childArgs,node.getSwitchBlocks()));
  return node;
}

Fixed version (ground truth):
public Object visitSwitchNode(SwitchNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  node.setExpr((ExprNode)node.getExpr().accept(this,args));
  subCtx.breakTarget=node;
  subCtx.environ=new Environ(ctx.environ);
  node.setSwitchBlocks(TNLManip.traverseList(this,node,TNLManip.cons(subCtx),node.getSwitchBlocks()));
  return node;
}
Program: 76126
Project: 76126
Buggy source:
public Object visitLabeledStmtNode(LabeledStmtNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  Environ env=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  NameNode label=node.getName();
  String labelString=label.getIdent();
  Decl other=ctx.environ.lookup(labelString,CG_STMTLABEL);
  if (other != null) {
    ApplicationUtility.error("String_Node_Str" + labelString);
  }
  StmtLblDecl d=new StmtLblDecl(labelString,node);
  label.setProperty(DECL_KEY,d);
  env.add(d);
  NameContext subCtx=new NameContext(ctx);
  subCtx.environ=env;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setStmt((StatementNode)node.getStmt().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitLabeledStmtNode(LabeledStmtNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameNode label=node.getName();
  String labelString=label.getIdent();
  Decl other=ctx.environ.lookup(labelString,CG_STMTLABEL);
  Environ newEnv=new Environ(ctx.environ);
  if (other != null) {
    ApplicationUtility.error("String_Node_Str" + labelString);
  }
  StmtLblDecl d=new StmtLblDecl(labelString,node);
  label.setProperty(DECL_KEY,d);
  newEnv.add(d);
  NameContext subCtx=new NameContext(ctx);
  subCtx.environ=newEnv;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setStmt((StatementNode)node.getStmt().accept(this,childArgs));
  return node;
}
Program: 76127
Project: 76127
Buggy source:
protected Object _visitUserTypeDeclNode(UserTypeDeclNode node,LinkedList args){
  NameContext ctx=new NameContext();
  ctx.environ=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  ClassDecl decl=(ClassDecl)JavaDecl.getDecl((NamedNode)node);
  ctx.currentClass=decl.getDefType();
  LinkedList childArgs=TNLManip.cons(ctx);
  node.setMembers(TNLManip.traverseList(this,node,childArgs,node.getMembers()));
  return node;
}

Fixed version (ground truth):
protected Object _visitUserTypeDeclNode(UserTypeDeclNode node,LinkedList args){
  NameContext ctx=new NameContext();
  ClassDecl decl=(ClassDecl)JavaDecl.getDecl((NamedNode)node);
  ctx.environ=decl.getEnviron();
  ctx.currentClass=decl.getDefType();
  LinkedList childArgs=TNLManip.cons(ctx);
  node.setMembers(TNLManip.traverseList(this,node,childArgs,node.getMembers()));
  return node;
}
Program: 76128
Project: 76128
Buggy source:
public Object visitTypeFieldAccessNode(TypeFieldAccessNode node,LinkedList args){
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=true;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setFType((TypeNameNode)node.getFType().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitTypeFieldAccessNode(TypeFieldAccessNode node,LinkedList args){
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=true;
  LinkedList childArgs=TNLManip.cons(subCtx);
  return node;
}
Program: 76129
Project: 76129
Buggy source:
public Object visitCatchNode(CatchNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  Environ env=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  subCtx.environ=env;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setParam((ParameterNode)node.getParam().accept(this,childArgs));
  node.setBlock((BlockNode)node.getBlock().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitCatchNode(CatchNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  subCtx.environ=new Environ(ctx.environ);
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setParam((ParameterNode)node.getParam().accept(this,childArgs));
  node.setBlock((BlockNode)node.getBlock().accept(this,childArgs));
  return node;
}
Program: 76130
Project: 76130
Buggy source:
public Object visitParameterNode(ParameterNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  Environ env=ctx.environ;
  NameNode name=node.getName();
  String varName=name.getIdent();
  Decl other=env.lookup(varName,CG_FORMAL | CG_LOCALVAR);
  if (other != null) {
    ApplicationUtility.error("String_Node_Str" + varName);
  }
  FormalParameterDecl d=new FormalParameterDecl(varName,node.getDefType(),node.getModifiers(),node);
  env.add(d);
  name.setProperty(DECL_KEY,d);
  return node;
}

Fixed version (ground truth):
public Object visitParameterNode(ParameterNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  Environ env=ctx.environ;
  NameNode name=node.getName();
  String varName=name.getIdent();
  Decl other=env.lookup(varName,CG_FORMAL | CG_LOCALVAR);
  if (other != null) {
    ApplicationUtility.error("String_Node_Str" + varName);
  }
  FormalParameterDecl d=new FormalParameterDecl(varName,node.getDefType(),node.getModifiers(),node);
  name.setProperty(DECL_KEY,d);
  env.add(d);
  return node;
}
Program: 76131
Project: 76131
Buggy source:
public Object visitBlockNode(BlockNode node,LinkedList args){
  NameContext subctx=new NameContext((NameContext)args.get(0));
  subctx.environ=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  LinkedList childArgs=TNLManip.cons(subctx);
  node.setStmts(TNLManip.traverseList(this,node,childArgs,node.getStmts()));
  return node;
}

Fixed version (ground truth):
public Object visitBlockNode(BlockNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subctx=new NameContext(ctx);
  subctx.environ=new Environ(ctx.environ);
  node.setStmts(TNLManip.traverseList(this,node,TNLManip.cons(subctx),node.getStmts()));
  return node;
}
Program: 76132
Project: 76132
Buggy source:
public Object visitConstructorDeclNode(ConstructorDeclNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  subCtx.encLoop=null;
  subCtx.breakTarget=null;
  Environ env=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  subCtx.environ=env;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setParams(TNLManip.traverseList(this,node,childArgs,node.getParams()));
  node.setConstructorCall((ConstructorCallNode)node.getConstructorCall().accept(this,childArgs));
  node.setBody((BlockNode)node.getBody().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitConstructorDeclNode(ConstructorDeclNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  subCtx.encLoop=null;
  subCtx.breakTarget=null;
  Environ newEnv1=new Environ(ctx.environ);
  subCtx.environ=newEnv1;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setParams(TNLManip.traverseList(this,node,childArgs,node.getParams()));
  subCtx.environ=new Environ(newEnv1);
  node.setConstructorCall((ConstructorCallNode)node.getConstructorCall().accept(this,childArgs));
  node.setBody((BlockNode)node.getBody().accept(this,childArgs));
  return node;
}
Program: 76133
Project: 76133
Buggy source:
public Object visitForNode(ForNode node,LinkedList args){
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  Environ env=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  subCtx.environ=env;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setInit(TNLManip.traverseList(this,node,childArgs,node.getInit()));
  subCtx.breakTarget=node;
  subCtx.encLoop=node;
  node.setTest((ExprNode)node.getTest().accept(this,childArgs));
  node.setUpdate(TNLManip.traverseList(this,node,childArgs,node.getUpdate()));
  node.setStmt((StatementNode)node.getStmt().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitForNode(ForNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  subCtx.environ=new Environ(ctx.environ);
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setInit(TNLManip.traverseList(this,node,childArgs,node.getInit()));
  subCtx.breakTarget=node;
  subCtx.encLoop=node;
  node.setTest((ExprNode)node.getTest().accept(this,childArgs));
  node.setUpdate(TNLManip.traverseList(this,node,childArgs,node.getUpdate()));
  node.setStmt((StatementNode)node.getStmt().accept(this,childArgs));
  return node;
}
Program: 76134
Project: 76134
Buggy source:
public Object visitMethodCallNode(MethodCallNode node,LinkedList args){
  node.setArgs(TNLManip.traverseList(this,node,args,node.getArgs()));
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=false;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setMethod((ExprNode)node.getMethod().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitMethodCallNode(MethodCallNode node,LinkedList args){
  node.setArgs(TNLManip.traverseList(this,node,args,node.getArgs()));
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=false;
  node.setMethod((ExprNode)node.getMethod().accept(this,TNLManip.cons(subCtx)));
  return node;
}
Program: 76135
Project: 76135
Buggy source:
protected JumpStmtNode _resolveJump(JumpStmtNode node,TreeNode noLabel,Environ env){
  TreeNode label=node.getLabel();
  if (label == AbsentTreeNode.instance) {
    node.setProperty(JUMP_DESTINATION_KEY,noLabel);
  }
 else {
    NameNode labelName=(NameNode)label;
    String labelString=labelName.getIdent();
    StmtLblDecl dest=(StmtLblDecl)env.lookup(labelString,CG_STMTLABEL);
    if (dest == null) {
      ApplicationUtility.error("String_Node_Str" + labelString + "String_Node_Str");
    }
    labelName.setProperty(DECL_KEY,dest);
    LabeledStmtNode labeledStmtNode=(LabeledStmtNode)dest.getSource();
    node.setProperty(JUMP_DESTINATION_KEY,labeledStmtNode.getStmt());
  }
  return node;
}

Fixed version (ground truth):
protected static JumpStmtNode _resolveJump(JumpStmtNode node,TreeNode noLabel,Environ env){
  TreeNode label=node.getLabel();
  if (label == AbsentTreeNode.instance) {
    node.setProperty(JUMP_DESTINATION_KEY,noLabel);
  }
 else {
    NameNode labelName=(NameNode)label;
    String labelString=labelName.getIdent();
    StmtLblDecl dest=(StmtLblDecl)env.lookup(labelString,CG_STMTLABEL);
    if (dest == null) {
      ApplicationUtility.error("String_Node_Str" + labelString + "String_Node_Str");
    }
    labelName.setProperty(DECL_KEY,dest);
    LabeledStmtNode labeledStmtNode=(LabeledStmtNode)dest.getSource();
    node.setProperty(JUMP_DESTINATION_KEY,labeledStmtNode.getStmt());
  }
  return node;
}
Program: 76136
Project: 76136
Buggy source:
public Object visitLoopNode(LoopNode node,LinkedList args){
  node.setTest((ExprNode)node.getTest().accept(this,args));
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.breakTarget=node;
  subCtx.encLoop=node;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setForeStmt((TreeNode)node.getForeStmt().accept(this,childArgs));
  node.setAftStmt((TreeNode)node.getAftStmt().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitLoopNode(LoopNode node,LinkedList args){
  node.setTest((ExprNode)node.getTest().accept(this,args));
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  subCtx.breakTarget=node;
  subCtx.encLoop=node;
  subCtx.environ=new Environ(ctx.environ);
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setForeStmt((TreeNode)node.getForeStmt().accept(this,childArgs));
  node.setAftStmt((TreeNode)node.getAftStmt().accept(this,childArgs));
  return node;
}
Program: 76137
Project: 76137
Buggy source:
/** 
 * Visit the types defined in this file. 
 */
public Object visitCompileUnitNode(CompileUnitNode node,LinkedList args){
  _currentPackage=(PackageDecl)node.getDefinedProperty(PACKAGE_KEY);
  LinkedList childArgs=new LinkedList();
  childArgs.add(node.getDefinedProperty(ENVIRON_KEY));
  TNLManip.traverseList(this,node,childArgs,node.getDefTypes());
  return null;
}

Fixed version (ground truth):
/** 
 * Visit the types defined in this file. 
 */
public Object visitCompileUnitNode(CompileUnitNode node,LinkedList args){
  _currentPackage=(PackageDecl)node.getDefinedProperty(PACKAGE_KEY);
  TNLManip.traverseList(this,node,TNLManip.cons(node.getDefinedProperty(ENVIRON_KEY)),node.getDefTypes());
  return null;
}
Program: 76138
Project: 76138
Buggy source:
public Object visitAllocateNode(AllocateNode node,LinkedList args){
  StringBuffer sb=new StringBuffer();
  String enclosingInstance=(String)node.childReturnValueAt(node.CHILD_INDEX_ENCLOSINGINSTANCE);
  if (!enclosingInstance.equals("String_Node_Str")) {
    sb.append(enclosingInstance + '.');
  }
  List argsList=(List)node.childReturnValueAt(node.CHILD_INDEX_ARGS);
  sb.append("String_Node_Str" + (String)node.childReturnValueAt(node.CHILD_INDEX_DTYPE) + '('+ _commaList(argsList)+ ')');
  return sb.toString();
}

Fixed version (ground truth):
public Object visitAllocateNode(AllocateNode node,LinkedList args){
  StringBuffer sb=new StringBuffer();
  String enclosingInstance=(String)node.childReturnValueAt(node.CHILD_INDEX_ENCLOSINGINSTANCE);
  if (!(enclosingInstance.equals("String_Node_Str") || enclosingInstance.equals("String_Node_Str"))) {
    sb.append(enclosingInstance + '.');
  }
  List argsList=(List)node.childReturnValueAt(node.CHILD_INDEX_ARGS);
  sb.append("String_Node_Str" + (String)node.childReturnValueAt(node.CHILD_INDEX_DTYPE) + '('+ _commaList(argsList)+ ')');
  return sb.toString();
}
Program: 76139
Project: 76139
Buggy source:
public static final void checkClassModifiers(final int modifiers){
  if ((modifiers & ~(PUBLIC_MOD | PROTECTED_MOD | PRIVATE_MOD| FINAL_MOD| ABSTRACT_MOD| STRICTFP_MOD)) != 0) {
    throw new RuntimeException("String_Node_Str" + toString(modifiers));
  }
}

Fixed version (ground truth):
public static final void checkClassModifiers(final int modifiers){
  if ((modifiers & ~(PUBLIC_MOD | PROTECTED_MOD | PRIVATE_MOD| FINAL_MOD| ABSTRACT_MOD| STATIC_MOD| STRICTFP_MOD)) != 0) {
    throw new RuntimeException("String_Node_Str" + toString(modifiers));
  }
}
Program: 76140
Project: 76140
Buggy source:
public static final void checkInterfaceModifiers(final int modifiers){
  if ((modifiers & ~(PUBLIC_MOD | PROTECTED_MOD | PRIVATE_MOD| FINAL_MOD| ABSTRACT_MOD| STRICTFP_MOD)) != 0) {
    throw new RuntimeException("String_Node_Str" + toString(modifiers));
  }
}

Fixed version (ground truth):
public static final void checkInterfaceModifiers(final int modifiers){
  if ((modifiers & ~(PUBLIC_MOD | PROTECTED_MOD | PRIVATE_MOD| FINAL_MOD| ABSTRACT_MOD| STATIC_MOD| STRICTFP_MOD)) != 0) {
    throw new RuntimeException("String_Node_Str" + toString(modifiers));
  }
}
Program: 76141
Project: 76141
Buggy source:
public Object visitImportNode(ImportNode node,LinkedList args){
  NameNode name=node.getName();
  StaticResolution.resolveAName(name,(Environ)StaticResolution.SYSTEM_PACKAGE.getEnviron(),null,null,JavaDecl.CG_USERTYPE);
  JavaDecl old=(JavaDecl)_fileEnv.lookupProper(name.getIdent());
  JavaDecl current=(JavaDecl)name.getProperty(DECL_KEY);
  if ((old != null) && (old != current)) {
    if (old != current) {
      throw new RuntimeException("String_Node_Str" + old.getName());
    }
  }
  _fileEnv.parent().parent().add((ClassDecl)name.getDefinedProperty(DECL_KEY));
  return null;
}

Fixed version (ground truth):
public Object visitImportNode(ImportNode node,LinkedList args){
  NameNode name=node.getName();
  StaticResolution.resolveAName(name,(Environ)StaticResolution.SYSTEM_PACKAGE.getEnviron(),null,null,CG_USERTYPE);
  JavaDecl old=(JavaDecl)_fileEnv.lookupProper(name.getIdent());
  JavaDecl current=(JavaDecl)name.getProperty(DECL_KEY);
  if ((old != null) && (old != current)) {
    if (old != current) {
      throw new RuntimeException("String_Node_Str" + old.getName());
    }
  }
  _importEnv.add((ClassDecl)name.getDefinedProperty(DECL_KEY));
  return null;
}
Program: 76142
Project: 76142
Buggy source:
protected final void _importOnDemand(String qualName){
  NameNode name=(NameNode)StaticResolution.makeNameNode(qualName);
  StaticResolution.resolveAName(name,StaticResolution.SYSTEM_PACKAGE.getEnviron(),null,null,JavaDecl.CG_PACKAGE);
  _importOnDemand((PackageDecl)name.getDefinedProperty(DECL_KEY));
}

Fixed version (ground truth):
protected final void _importOnDemand(String qualName){
  NameNode name=(NameNode)StaticResolution.makeNameNode(qualName);
  StaticResolution.resolveAName(name,StaticResolution.SYSTEM_PACKAGE.getEnviron(),null,null,CG_PACKAGE);
  _importOnDemand((PackageDecl)name.getDefinedProperty(DECL_KEY));
}
Program: 76143
Project: 76143
Buggy source:
public Object visitImportOnDemandNode(ImportOnDemandNode node,LinkedList args){
  NameNode name=node.getName();
  StaticResolution.resolveAName(name,StaticResolution.SYSTEM_PACKAGE.getEnviron(),null,null,JavaDecl.CG_PACKAGE);
  PackageDecl decl=(PackageDecl)name.getDefinedProperty(DECL_KEY);
  _importOnDemand(decl);
  return null;
}

Fixed version (ground truth):
public Object visitImportOnDemandNode(ImportOnDemandNode node,LinkedList args){
  NameNode name=node.getName();
  StaticResolution.resolveAName(name,StaticResolution.SYSTEM_PACKAGE.getEnviron(),null,null,CG_PACKAGE);
  PackageDecl decl=(PackageDecl)name.getDefinedProperty(DECL_KEY);
  _importOnDemand(decl);
  return null;
}
Program: 76144
Project: 76144
Buggy source:
public Object visitCompileUnitNode(CompileUnitNode node,LinkedList args){
  _compileUnit=node;
  _fileEnv=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  if (!node.hasProperty(IMPORTED_PACKAGES_KEY)) {
    _importedPackages=new LinkedList();
    node.setProperty(IMPORTED_PACKAGES_KEY,_importedPackages);
  }
 else {
    _importedPackages=(Collection)node.getDefinedProperty(IMPORTED_PACKAGES_KEY);
  }
  _importOnDemand("String_Node_Str");
  TNLManip.traverseList(this,node,null,node.getImports());
  return null;
}

Fixed version (ground truth):
public Object visitCompileUnitNode(CompileUnitNode node,LinkedList args){
  _compileUnit=node;
  _fileEnv=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  _importEnv=_fileEnv.parent().parent();
  if (!node.hasProperty(IMPORTED_PACKAGES_KEY)) {
    _importedPackages=new LinkedList();
    node.setProperty(IMPORTED_PACKAGES_KEY,_importedPackages);
  }
 else {
    _importedPackages=(Collection)node.getDefinedProperty(IMPORTED_PACKAGES_KEY);
  }
  _importOnDemand("String_Node_Str");
  TNLManip.traverseList(this,node,null,node.getImports());
  return null;
}
Program: 76146
Project: 76146
Buggy source:
public Object visitObjectFieldAccessNode(ObjectFieldAccessNode node,LinkedList args){
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=true;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setObject((ExprNode)node.getObject().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitObjectFieldAccessNode(ObjectFieldAccessNode node,LinkedList args){
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=true;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setObject((ExprNode)(node.getObject().accept(this,childArgs)));
  return node;
}
Program: 76147
Project: 76147
Buggy source:
protected Object _visitUserTypeDeclNode(UserTypeDeclNode node,LinkedList args){
  NameContext ctx=new NameContext();
  ctx.environ=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  ClassDecl decl=(ClassDecl)JavaDecl.getDecl((NamedNode)node);
  ctx.currentClass=decl.getDefType();
  LinkedList childArgs=TNLManip.cons(ctx);
  TNLManip.traverseList(this,node,childArgs,node.getMembers());
  return node;
}

Fixed version (ground truth):
protected Object _visitUserTypeDeclNode(UserTypeDeclNode node,LinkedList args){
  NameContext ctx=new NameContext();
  ctx.environ=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  ClassDecl decl=(ClassDecl)JavaDecl.getDecl((NamedNode)node);
  ctx.currentClass=decl.getDefType();
  LinkedList childArgs=TNLManip.cons(ctx);
  node.setMembers(TNLManip.traverseList(this,node,childArgs,node.getMembers()));
  return node;
}
Program: 76148
Project: 76148
Buggy source:
public Object visitCatchNode(CatchNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  Environ env=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  subCtx.environ=env;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.getParam().accept(this,childArgs);
  return node;
}

Fixed version (ground truth):
public Object visitCatchNode(CatchNode node,LinkedList args){
  NameContext ctx=(NameContext)args.get(0);
  NameContext subCtx=new NameContext(ctx);
  Environ env=(Environ)node.getDefinedProperty(ENVIRON_KEY);
  subCtx.environ=env;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setParam((ParameterNode)node.getParam().accept(this,childArgs));
  node.setBlock((BlockNode)node.getBlock().accept(this,childArgs));
  return node;
}
Program: 76149
Project: 76149
Buggy source:
public Object visitMethodCallNode(MethodCallNode node,LinkedList args){
  TNLManip.traverseList(this,node,args,node.getArgs());
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=false;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setMethod((ExprNode)node.getMethod().accept(this,childArgs));
  return node;
}

Fixed version (ground truth):
public Object visitMethodCallNode(MethodCallNode node,LinkedList args){
  node.setArgs(TNLManip.traverseList(this,node,args,node.getArgs()));
  NameContext subCtx=new NameContext((NameContext)args.get(0));
  subCtx.resolveAsObject=false;
  LinkedList childArgs=TNLManip.cons(subCtx);
  node.setMethod((ExprNode)node.getMethod().accept(this,childArgs));
  return node;
}
Program: 76150
Project: 76150
Buggy source:
/** 
 * The default visit method. Visits all child nodes with the same environment as in the argument list. Only nodes that do not have their own environment should call this method.
 */
protected Object _defaultVisit(TreeNode node,LinkedList args){
  return TNLManip.traverseList(this,node,args,node.children());
}

Fixed version (ground truth):
/** 
 * The default visit method. Visits all child nodes with the same environment as in the argument list. Nodes that do not have their own environment should call this method.
 */
protected Object _defaultVisit(TreeNode node,LinkedList args){
  return TNLManip.traverseList(this,node,args,node.children());
}
Program: 76151
Project: 76151
Buggy source:
/** 
 * Return true if this branch is permitted to begin an  engagement with the branch controller; return false otherwise. During an engagement a branch is able transfer a token between its producer receiver and its consumer receiver.
 * @return True if this branch may engage with itsbranch controller.
 */
public boolean isBranchPermitted(){
  try {
    if (!_prodRcvr.hasRoom()) {
      return false;
    }
  }
 catch (  IllegalActionException e) {
  }
  if (_controller.isEngagementEnabled(this)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Return true if this branch is permitted to begin an  engagement with the branch controller; return false otherwise. During an engagement a branch is able transfer a token between its producer receiver and its consumer receiver.
 * @return True if this branch may engage with itsbranch controller.
 */
public boolean isBranchPermitted(){
  try {
    if (!_consRcvr.hasRoom()) {
      System.out.println("String_Node_Str");
      return false;
    }
  }
 catch (  IllegalActionException e) {
  }
  if (_controller.isEngagementEnabled(this)) {
    return true;
  }
  System.out.println("String_Node_Str");
  return false;
}
Program: 76152
Project: 76152
Buggy source:
/** 
 * Transfer a single token between the producer receiver and  the consumer receiver. If a TerminateBranchException is thrown, then reset this receiver and return.  FIXME: Can we optimize this?
 */
public void transferTokens(){
  try {
    Token token=_prodRcvr.get(this);
    _consRcvr.put(token,this);
    _controller.engagementSucceeded(this);
  }
 catch (  TerminateBranchException e) {
    _controller.disengageBranch(this);
    reset();
    return;
  }
}

Fixed version (ground truth):
/** 
 * Transfer a single token between the producer receiver and  the consumer receiver. If a TerminateBranchException is thrown, then reset this receiver and return.  FIXME: Can we optimize this?
 */
public void transferTokens(){
  try {
    System.out.println("String_Node_Str");
    newIteration();
    Token token=_prodRcvr.get(this);
    System.out.println("String_Node_Str");
    _consRcvr.put(token,this);
    System.out.println("String_Node_Str");
    _controller.engagementSucceeded(this);
    System.out.println("String_Node_Str");
  }
 catch (  TerminateBranchException e) {
    _controller.disengageBranch(this);
    reset();
    return;
  }
}
Program: 76155
Project: 76155
Buggy source:
/** 
 * Construct a Branch object.
 */
public Branch(BoundaryReceiver prodRcvr,BoundaryReceiver consRcvr,BranchController cntlr) throws IllegalActionException {
  _controller=cntlr;
  if (!prodRcvr.isProducerReceiver()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  _prodRcvr=prodRcvr;
  if (!consRcvr.isConsumerReceiver()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  _consRcvr=consRcvr;
}

Fixed version (ground truth):
/** 
 * Construct a Branch object.
 */
public Branch(BoundaryReceiver prodRcvr,BoundaryReceiver consRcvr,BranchController cntlr) throws IllegalActionException {
  _controller=cntlr;
  if (!prodRcvr.isProducerReceiver()) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  }
  _prodRcvr=prodRcvr;
  if (!consRcvr.isConsumerReceiver()) {
    String name=((Nameable)consRcvr.getContainer()).getName();
    throw new IllegalActionException("String_Node_Str" + name + "String_Node_Str");
  }
  _consRcvr=consRcvr;
}
Program: 76157
Project: 76157
Buggy source:
/** 
 * Transfer a single token between the producer receiver and  the consumer receiver. If a TerminateBranchException is thrown, then reset this receiver and return.  FIXME: Can we optimize this?
 */
public void transferTokens(){
  try {
    Token token=_prodRcvr.get(this);
    _consRcvr.put(token,this);
  }
 catch (  TerminateBranchException e) {
    reset();
    return;
  }
}

Fixed version (ground truth):
/** 
 * Transfer a single token between the producer receiver and  the consumer receiver. If a TerminateBranchException is thrown, then reset this receiver and return.  FIXME: Can we optimize this?
 */
public void transferTokens(){
  try {
    Token token=_prodRcvr.get(this);
    _consRcvr.put(token,this);
    _controller.engagementSucceeded(this);
  }
 catch (  TerminateBranchException e) {
    _controller.disengageBranch(this);
    reset();
    return;
  }
}
Program: 76158
Project: 76158
Buggy source:
/** 
 * Restart this controller by resetting the branches that it controls and setting flags so engagements can take place. This method is synchronized and will notify any  threads that are synchronized to this object.
 */
public synchronized void restart(){
  _iterationIsOverCache=true;
  _engagements.clear();
  _branchesBlocked=0;
  _branchesActive=0;
  Branch branch=null;
  Iterator branches=_branches.iterator();
  while (branches.hasNext()) {
    branch=(Branch)branches.next();
    branch.reset();
  }
  _iterationIsOverCache=false;
  notifyAll();
}

Fixed version (ground truth):
/** 
 * Restart this controller by resetting the branches that it controls and setting flags so engagements can take place. This method is synchronized and will notify any  threads that are synchronized to this object.
 */
public synchronized void restart(){
  _iterationIsOverCache=true;
  _engagements.clear();
  _branchesBlocked=0;
  Branch branch=null;
  Iterator branches=_branches.iterator();
  while (branches.hasNext()) {
    branch=(Branch)branches.next();
    branch.reset();
  }
  _iterationIsOverCache=false;
  notifyAll();
}