nus-yam/ex-repair huggingface dataset:
Program: 135835
Project: 135835
Buggy source:
/** 
 * Checks if the test address and mask conflicts with the filter address and mask <p/> For example: testAddress: 172.28.2.23 testMask: 255.255.255.0 filterAddress: 172.28.1.10 testMask: 255.255.255.0 do conflict <p/> testAddress: 172.28.2.23 testMask: 255.255.255.0 filterAddress: 172.28.1.10 testMask: 255.255.0.0 do not conflict <p/> Null parameters are permitted
 * @param testAddress
 * @param filterAddress
 * @param testMask
 * @param filterMask
 * @return
 */
public static boolean inetAddressConflict(InetAddress testAddress,InetAddress filterAddress,InetAddress testMask,InetAddress filterMask){
  if ((testAddress == null) || (filterAddress == null)) {
    return false;
  }
  if (isAny(testAddress) || isAny(filterAddress)) {
    return false;
  }
  int testMaskLen=(testMask == null) ? ((testAddress instanceof Inet4Address) ? 32 : 128) : NetUtils.getSubnetMaskLength(testMask);
  int filterMaskLen=(filterMask == null) ? ((testAddress instanceof Inet4Address) ? 32 : 128) : NetUtils.getSubnetMaskLength(filterMask);
  if (testMaskLen < filterMaskLen) {
    return true;
  }
  InetAddress prefix1=getSubnetPrefix(testAddress,filterMaskLen);
  InetAddress prefix2=getSubnetPrefix(filterAddress,filterMaskLen);
  return (!prefix1.equals(prefix2));
}

Fixed version (ground truth):
/** 
 * Checks if the test address and mask conflicts with the filter address and mask <p> For example: testAddress: 172.28.2.23 testMask: 255.255.255.0 filterAddress: 172.28.1.10 testMask: 255.255.255.0 do conflict <p> testAddress: 172.28.2.23 testMask: 255.255.255.0 filterAddress: 172.28.1.10 testMask: 255.255.0.0 do not conflict <p> Null parameters are permitted
 * @param testAddress
 * @param filterAddress
 * @param testMask
 * @param filterMask
 * @return
 */
public static boolean inetAddressConflict(InetAddress testAddress,InetAddress filterAddress,InetAddress testMask,InetAddress filterMask){
  if ((testAddress == null) || (filterAddress == null)) {
    return false;
  }
  if (isAny(testAddress) || isAny(filterAddress)) {
    return false;
  }
  int testMaskLen=(testMask == null) ? ((testAddress instanceof Inet4Address) ? 32 : 128) : NetUtils.getSubnetMaskLength(testMask);
  int filterMaskLen=(filterMask == null) ? ((testAddress instanceof Inet4Address) ? 32 : 128) : NetUtils.getSubnetMaskLength(filterMask);
  if (testMaskLen < filterMaskLen) {
    return true;
  }
  InetAddress prefix1=getSubnetPrefix(testAddress,filterMaskLen);
  InetAddress prefix2=getSubnetPrefix(filterAddress,filterMaskLen);
  return (!prefix1.equals(prefix2));
}
Program: 135836
Project: 135836
Buggy source:
/** 
 * Adds links to existing graph or creates new directed graph with given links if graph was not initialized.
 * @param links The links to add.
 */
@Override public synchronized void addLinks(List<Link> links){
  if (links == null || links.isEmpty()) {
    _logger.info("String_Node_Str");
    return;
  }
  if (networkGraph == null) {
    networkGraph=new UndirectedSparseGraph<>();
  }
  for (  Link link : links) {
    NodeId sourceNodeId=link.getSource().getSourceNode();
    NodeId destinationNodeId=link.getDestination().getDestNode();
    networkGraph.addVertex(sourceNodeId);
    networkGraph.addVertex(destinationNodeId);
    networkGraph.addEdge(link,sourceNodeId,destinationNodeId);
  }
}

Fixed version (ground truth):
/** 
 * Adds links to existing graph or creates new directed graph with given links if graph was not initialized.
 * @param links The links to add.
 */
@Override public synchronized void addLinks(List<Link> links){
  if (links == null || links.isEmpty()) {
    _logger.info("String_Node_Str");
    return;
  }
  if (networkGraph == null) {
    networkGraph=new SparseMultigraph<>();
  }
  for (  Link link : links) {
    if (linkAlreadyAdded(link)) {
      continue;
    }
    NodeId sourceNodeId=link.getSource().getSourceNode();
    NodeId destinationNodeId=link.getDestination().getDestNode();
    networkGraph.addVertex(sourceNodeId);
    networkGraph.addVertex(destinationNodeId);
    networkGraph.addEdge(link,sourceNodeId,destinationNodeId,EdgeType.UNDIRECTED);
  }
}
Program: 135839
Project: 135839
Buggy source:
@Override public List<Link> getAllLinks(){
  List<Link> allLinks=new ArrayList<>();
  allLinks.addAll(networkGraph.getEdges());
  return allLinks;
}

Fixed version (ground truth):
@Override public List<Link> getAllLinks(){
  List<Link> allLinks=new ArrayList<>();
  if (networkGraph != null) {
    allLinks.addAll(networkGraph.getEdges());
  }
  return allLinks;
}
Program: 135840
Project: 135840
Buggy source:
/** 
 * Forms MST(minimum spanning tree) from network graph and returns links that are not in MST.
 * @return
 */
@Override public synchronized List<Link> getLinksInMst(){
  List<Link> linksInMst=new ArrayList<>();
  PrimMinimumSpanningTree<NodeId,Link> networkMst=new PrimMinimumSpanningTree<>(DelegateTree.<NodeId,Link>getFactory());
  Graph<NodeId,Link> mstGraph=networkMst.transform(networkGraph);
  Collection<Link> mstLinks=mstGraph.getEdges();
  linksInMst.addAll(mstLinks);
  return linksInMst;
}

Fixed version (ground truth):
/** 
 * Forms MST(minimum spanning tree) from network graph and returns links that are not in MST.
 * @return
 */
@Override public synchronized List<Link> getLinksInMst(){
  List<Link> linksInMst=new ArrayList<>();
  if (networkGraph != null) {
    PrimMinimumSpanningTree<NodeId,Link> networkMst=new PrimMinimumSpanningTree<>(DelegateTree.<NodeId,Link>getFactory());
    Graph<NodeId,Link> mstGraph=networkMst.transform(networkGraph);
    Collection<Link> mstLinks=mstGraph.getEdges();
    linksInMst.addAll(mstLinks);
  }
  return linksInMst;
}
Program: 135841
Project: 135841
Buggy source:
@Test public void onNodeUpdated_Valid() throws Exception {
  InstanceIdentifier<Node> nodeInstanceIdentifier=InstanceIdentifier.builder(Nodes.class).child(Node.class).toInstance();
  NodeUpdated nodeUpdated=new NodeUpdatedBuilder().setNodeRef(new NodeRef(nodeInstanceIdentifier)).build();
  initialFlowWriter.onNodeUpdated(nodeUpdated);
  Thread.sleep(250);
  verify(salFlowService,times(0)).addFlow(any(AddFlowInput.class));
}

Fixed version (ground truth):
@Test public void onNodeUpdated_Valid() throws Exception {
  InstanceIdentifier<Node> nodeInstanceIdentifier=InstanceIdentifier.builder(Nodes.class).child(Node.class,new NodeKey(new NodeId("String_Node_Str"))).toInstance();
  NodeUpdated nodeUpdated=new NodeUpdatedBuilder().setNodeRef(new NodeRef(nodeInstanceIdentifier)).build();
  initialFlowWriter.onNodeUpdated(nodeUpdated);
  Thread.sleep(250);
  verify(salFlowService,times(1)).addFlow(any(AddFlowInput.class));
}
Program: 135842
Project: 135842
Buggy source:
@Test public void onNodeUpdated_Valid() throws Exception {
  InstanceIdentifier<Node> nodeInstanceIdentifier=InstanceIdentifier.builder(Nodes.class).child(Node.class).toInstance();
  NodeUpdated nodeUpdated=new NodeUpdatedBuilder().setNodeRef(new NodeRef(nodeInstanceIdentifier)).build();
  initialFlowWriter.onNodeUpdated(nodeUpdated);
  Thread.sleep(250);
  verify(salFlowService,times(0)).addFlow(any(AddFlowInput.class));
}

Fixed version (ground truth):
@Test public void onNodeUpdated_Valid() throws Exception {
  InstanceIdentifier<Node> nodeInstanceIdentifier=InstanceIdentifier.builder(Nodes.class).child(Node.class,new NodeKey(new NodeId("String_Node_Str"))).toInstance();
  NodeUpdated nodeUpdated=new NodeUpdatedBuilder().setNodeRef(new NodeRef(nodeInstanceIdentifier)).build();
  initialFlowWriter.onNodeUpdated(nodeUpdated);
  Thread.sleep(250);
  verify(salFlowService,times(1)).addFlow(any(AddFlowInput.class));
}
Program: 135846
Project: 135846
Buggy source:
/** 
 * Setup the L2Switch.
 * @param consumerContext The context of the L2Switch.
 */
@Override public void onSessionInitialized(BindingAwareBroker.ConsumerContext consumerContext){
  DataBrokerService dataService=consumerContext.<DataBrokerService>getSALService(DataBrokerService.class);
  NetworkGraphService networkGraphService=new NetworkGraphDijkstra();
  FlowWriterService flowWriterService=new FlowWriterServiceImpl(dataService,networkGraphService);
  this.topologyLinkDataChangeHandler=new TopologyLinkDataChangeHandler(dataService,networkGraphService);
  topologyLinkDataChangeHandler.registerAsDataChangeListener();
  PacketProcessingService packetProcessingService=consumerContext.<PacketProcessingService>getRpcService(PacketProcessingService.class);
  PacketDispatcher packetDispatcher=new PacketDispatcher();
  packetDispatcher.setInventoryReader(new InventoryReader(dataService));
  packetDispatcher.setPacketProcessingService(packetProcessingService);
  packetDispatcher.setFlowWriterService(flowWriterService);
  AddressObservationWriter addressObservationWriter=new AddressObservationWriter(dataService);
  AddressObserver addressObserver=new AddressObserver(addressObservationWriter,packetDispatcher);
  NotificationService notificationService=consumerContext.<NotificationService>getSALService(NotificationService.class);
  this.listenerRegistration=notificationService.registerNotificationListener(addressObserver);
}

Fixed version (ground truth):
/** 
 * Setup the L2Switch.
 * @param consumerContext The context of the L2Switch.
 */
@Override public void onSessionInitialized(BindingAwareBroker.ConsumerContext consumerContext){
  DataBroker dataService=consumerContext.<DataBroker>getSALService(DataBroker.class);
  NetworkGraphService networkGraphService=new NetworkGraphDijkstra();
  PacketProcessingService packetProcessingService=consumerContext.<PacketProcessingService>getRpcService(PacketProcessingService.class);
  PacketDispatcher packetDispatcher=new PacketDispatcher();
  packetDispatcher.setInventoryReader(new InventoryReader(dataService));
  packetDispatcher.setPacketProcessingService(packetProcessingService);
  AddressObservationWriter addressObservationWriter=new AddressObservationWriter(dataService);
  AddressObserver addressObserver=new AddressObserver(addressObservationWriter,packetDispatcher);
  NotificationService notificationService=consumerContext.<NotificationService>getSALService(NotificationService.class);
  this.listenerRegistration=notificationService.registerNotificationListener(addressObserver);
}
Program: 135847
Project: 135847
Buggy source:
/** 
 * Construct an AddressTracker with the specified inputs
 * @param dataService  The DataBrokerService for the AddressTracker
 */
public AddressObservationWriter(DataBrokerService dataService){
  this.dataService=dataService;
}

Fixed version (ground truth):
/** 
 * Construct an AddressTracker with the specified inputs
 * @param dataService The DataBrokerService for the AddressTracker
 */
public AddressObservationWriter(DataBroker dataService){
  this.dataService=dataService;
}
Program: 135849
Project: 135849
Buggy source:
/** 
 * The handler function for IPv4 packets.
 * @param packetReceived  The incoming packet.
 */
@Override public void onIpv4PacketOverEthernetReceived(Ipv4PacketOverEthernetReceived packetReceived){
  addressObservationWriter.addAddress(packetReceived.getEthernetOverRawPacket().getEthernetPacket().getSourceMac(),new IpAddress(packetReceived.getIpv4Packet().getSourceIpv4()),packetReceived.getEthernetOverRawPacket().getRawPacket().getIngress());
  packetDispatcher.sendPacketOut(packetReceived.getPayload(),packetReceived.getEthernetOverRawPacket().getRawPacket().getIngress());
}

Fixed version (ground truth):
/** 
 * The handler function for IPv4 packets.
 * @param packetReceived  The incoming packet.
 */
@Override public void onIpv4PacketOverEthernetReceived(Ipv4PacketOverEthernetReceived packetReceived){
  if (!IPV4_IP_TO_IGNORE.equals(packetReceived.getIpv4Packet().getSourceIpv4().getValue())) {
    addressObservationWriter.addAddress(packetReceived.getEthernetOverRawPacket().getEthernetPacket().getSourceMac(),new IpAddress(packetReceived.getIpv4Packet().getSourceIpv4().getValue().toCharArray()),packetReceived.getEthernetOverRawPacket().getRawPacket().getIngress());
    packetDispatcher.sendPacketOut(packetReceived.getPayload(),packetReceived.getEthernetOverRawPacket().getRawPacket().getIngress());
  }
}
Program: 135850
Project: 135850
Buggy source:
/** 
 * Construct an InventoryService object with the specified inputs.
 * @param dataService  The DataBrokerService associated with the InventoryService.
 */
public InventoryReader(DataBrokerService dataService){
  this.dataService=dataService;
  controllerSwitchConnectors=new HashMap<String,NodeConnectorRef>();
  switchNodeConnectors=new HashMap<String,List<NodeConnectorRef>>();
}

Fixed version (ground truth):
/** 
 * Construct an InventoryService object with the specified inputs.
 * @param dataService The DataBrokerService associated with the InventoryService.
 */
public InventoryReader(DataBroker dataService){
  this.dataService=dataService;
  controllerSwitchConnectors=new HashMap<String,NodeConnectorRef>();
  switchNodeConnectors=new HashMap<String,List<NodeConnectorRef>>();
}
Program: 135853
Project: 135853
Buggy source:
@Override public void syntaxError(Recognizer<?,?> recognizer,Object offendingSymbol,int line,int charPositionInLine,String msg,RecognitionException e){
  if (msg.startsWith("String_Node_Str")) {
    msg=msg.substring(11);
    System.err.println(String.format("String_Node_Str",Version.get().getTitle(),e.getMessage(),line,charPositionInLine));
  }
 else   if (msg.startsWith("String_Node_Str")) {
    msg=msg.substring(9);
    System.err.println(String.format("String_Node_Str",Version.get().getTitle(),e.getMessage(),line,charPositionInLine));
  }
 else   System.err.println(String.format("String_Node_Str",Version.get().getTitle(),e.getMessage(),line,charPositionInLine));
}

Fixed version (ground truth):
@Override public void syntaxError(Recognizer<?,?> recognizer,Object offendingSymbol,int line,int charPositionInLine,String msg,RecognitionException e){
  if (msg.startsWith("String_Node_Str")) {
    msg=msg.substring(11);
    System.err.println(String.format("String_Node_Str",Version.get().getTitle(),msg,line,charPositionInLine));
  }
 else   if (msg.startsWith("String_Node_Str")) {
    msg=msg.substring(9);
    System.err.println(String.format("String_Node_Str",Version.get().getTitle(),msg,line,charPositionInLine));
  }
 else   System.err.println(String.format("String_Node_Str",Version.get().getTitle(),msg,line,charPositionInLine));
}
Program: 135854
Project: 135854
Buggy source:
@Override public void exitGroundMinus1(GroundMinus1Context ctx){
  if (null != ctx)   builders.push(Builder.get(Atom.ARITH_MINUS).append(ctx.groundAtom().getText()));
}

Fixed version (ground truth):
@Override public void exitGroundMinus1(GroundMinus1Context ctx){
  if (null != ctx)   builders.push(Builder.get("String_Node_Str" + ctx.groundAtom().getText()));
}
Program: 135855
Project: 135855
Buggy source:
@Override public void exitGroundPredicate(GroundPredicateContext ctx){
  if (null != ctx) {
    Stack<Atom> atoms=new Stack<>();
    for (int i=0; i < ctx.groundTerm().size(); i++)     atoms.push(builders.pop().build());
    Builder builder=builders.peek();
    while (!atoms.empty())     builder.append(atoms.pop());
  }
}

Fixed version (ground truth):
@Override public void exitGroundPredicate(GroundPredicateContext ctx){
  if (null != ctx) {
    Stack<Atom> atoms=new Stack<>();
    for (int i=0; i < ctx.groundTerm().size(); i++) {
      Atom atom=builders.pop().build();
      String name=atom.name();
      if (0 == atom.arity() && isNegValue(name)) {
        Atom discard=builders.peek().build();
        if (0 == discard.arity() && name.equals("String_Node_Str" + discard.name()))         builders.pop();
      }
      atoms.push(atom);
    }
    Builder builder=builders.peek();
    while (!atoms.empty())     builder.append(atoms.pop());
  }
}
Program: 135856
Project: 135856
Buggy source:
@Override public void syntaxError(Recognizer<?,?> recognizer,Object offendingSymbol,int line,int charPositionInLine,String msg,RecognitionException e){
  if (msg.startsWith("String_Node_Str")) {
    msg=msg.substring(11);
    System.err.println(String.format("String_Node_Str",Version.get().getTitle(),e.getMessage(),line,charPositionInLine));
  }
 else   if (msg.startsWith("String_Node_Str")) {
    msg=msg.substring(9);
    System.err.println(String.format("String_Node_Str",Version.get().getTitle(),e.getMessage(),line,charPositionInLine));
  }
 else   System.err.println(String.format("String_Node_Str",Version.get().getTitle(),e.getMessage(),line,charPositionInLine));
}

Fixed version (ground truth):
@Override public void syntaxError(Recognizer<?,?> recognizer,Object offendingSymbol,int line,int charPositionInLine,String msg,RecognitionException e){
  if (msg.startsWith("String_Node_Str")) {
    msg=msg.substring(11);
    System.err.println(String.format("String_Node_Str",Version.get().getTitle(),msg,line,charPositionInLine));
  }
 else   if (msg.startsWith("String_Node_Str")) {
    msg=msg.substring(9);
    System.err.println(String.format("String_Node_Str",Version.get().getTitle(),msg,line,charPositionInLine));
  }
 else   System.err.println(String.format("String_Node_Str",Version.get().getTitle(),msg,line,charPositionInLine));
}
Program: 135858
Project: 135858
Buggy source:
/** 
 * Added 21 Mar 2013 by LL.
 * @param key
 * @param messageText
 * @param pageId
 * @param type
 * @param control
 */
public void removeErrorMessage(Object key,Control control){
  if (control != null) {
    for (int i=0; i < pagesToAdd.length; i++) {
      pagesToAdd[i].getManagedForm().getMessageManager().removeMessage(key,control);
    }
  }
}

Fixed version (ground truth):
/** 
 * This removes the error "message" added by the corresponding call to addErrorMessage if it exists.  It does nothing if the "message   does not exist.  This provides a partial fix to the problem of page validation showing an error when the user has made a mistake, but not removing the error when the user corrects the mistake.  Code that checks for an error and calls addErrorMessage when it is found can call removeErrorMessage when it's not found.  It is only a partial  solution for two reasons: 1. It can't be used where the same error "message" can be added in two different places in the code.  Perhaps this can be fixed by splitting such messages into separate ones with  different keys and different messages, it is added, but I haven't  tried this because I don't know where those keys might be used.   If all those places where the error is generated lie in the same call of pageValidate, then error messages generated in  the previous call of pageValidate can be remembered in a field and removed at the beginning of the call. 2. Some of those keys are dynamically created when addErrorMessage is called, and it may be impossible to recompute the keys for which the error messages were previously generated.  Such cases could also be handled by adding a field that remembers what error messages  were added the last time the error was chaecked for.  Added 21 Mar 2013 by LL.
 * @param key the unique message key
 * @param control the control to associate the message with
 */
public void removeErrorMessage(Object key,Control control){
  if (control != null) {
    for (int i=0; i < pagesToAdd.length; i++) {
      pagesToAdd[i].getManagedForm().getMessageManager().removeMessage(key,control);
    }
  }
}
Program: 135861
Project: 135861
Buggy source:
/** 
 * The process fairness condition written as a formula that begins in column col (Java numbering) and ends with "\n". It is formatted to try to extend no further than column  PcalTLAGen.wrapColumn, but no individual formula is split across lines.
 * @param col
 * @return
 */
public StringBuffer format(int col){
  int singleLineWidth=this.singleLineWidth();
  if (fitsAsSingleLine(col)) {
    return this.singleLine(col);
  }
  StringBuffer val=prefixAsStringBuffer(col);
  int prefixWidth=0;
  if (prefix != null && prefix.size() > 0) {
    prefixWidth=((String)prefix.elementAt(prefix.size() - 1)).length();
  }
  int curCol=col + prefixWidth;
  String line=this.bodyFormulas.singleLine();
  if (curCol + line.length() + 3 <= PcalTLAGen.wrapColumn) {
    val.append("String_Node_Str" + line);
  }
 else {
    val.append(this.bodyFormulas.multiLine(curCol));
  }
  if (prcdFormulas == null) {
    return val;
  }
  for (int i=0; i < this.prcdFormulas.size(); i++) {
    FormulaPair form=(FormulaPair)this.prcdFormulas.elementAt(i);
    line=form.singleLine();
    val.append("String_Node_Str");
    val.append(NSpaces(curCol));
    if (curCol + line.length() + 3 <= PcalTLAGen.wrapColumn) {
      val.append("String_Node_Str" + line + "String_Node_Str");
    }
 else {
      val.append(form.multiLine(curCol));
    }
  }
  return val;
}

Fixed version (ground truth):
/** 
 * The process fairness condition written as a formula that begins in column col (Java numbering) and ends with "\n". It is formatted to try to extend no further than column  PcalTLAGen.wrapColumn, but no individual formula is split across lines.
 * @param col
 * @return
 */
public StringBuffer format(int col){
  int singleLineWidth=this.singleLineWidth();
  if (fitsAsSingleLine(col)) {
    return this.singleLine(col);
  }
  StringBuffer val=prefixAsStringBuffer(col);
  int prefixWidth=0;
  if (prefix != null && prefix.size() > 0) {
    prefixWidth=((String)prefix.elementAt(prefix.size() - 1)).length();
  }
  int curCol=col + prefixWidth;
  String line=this.bodyFormulas.singleLine();
  if (curCol + line.length() + 3 <= PcalTLAGen.wrapColumn) {
    val.append("String_Node_Str" + line);
  }
 else {
    val.append(this.bodyFormulas.multiLine(curCol));
  }
  if (prcdFormulas == null) {
    return val;
  }
  for (int i=0; i < this.prcdFormulas.size(); i++) {
    FormulaPair form=(FormulaPair)this.prcdFormulas.elementAt(i);
    line=form.singleLine();
    if (i == 0) {
      val.append("String_Node_Str");
    }
    val.append(NSpaces(curCol));
    if (curCol + line.length() + 3 <= PcalTLAGen.wrapColumn) {
      val.append("String_Node_Str" + line + "String_Node_Str");
    }
 else {
      val.append(form.multiLine(curCol));
    }
  }
  return val;
}
Program: 135862
Project: 135862
Buggy source:
public static void WriteTeXAlignmentFile(Token[][] spec,Vector preamble,float linewidth){
  OutputFileWriter writer=new OutputFileWriter(Parameters.LaTeXAlignmentFile + "String_Node_Str");
  writer.putLine("String_Node_Str");
  int i=0;
  while (i < preamble.size()) {
    writer.putLine((String)preamble.elementAt(i));
    i=i + 1;
  }
  ;
  if (linewidth >= 0) {
    writer.putLine("String_Node_Str" + Misc.floatToString(linewidth,2) + "String_Node_Str");
    writer.putLine("String_Node_Str");
  }
  ;
  writer.putLine("String_Node_Str");
  writer.putLine("String_Node_Str");
  InnerWriteAlignmentFile(spec,writer,false);
}

Fixed version (ground truth):
public static void WriteTeXAlignmentFile(Token[][] spec,Vector preamble,float linewidth){
  OutputFileWriter writer=new OutputFileWriter(Parameters.LaTeXAlignmentFile + "String_Node_Str");
  writer.putLine("String_Node_Str");
  int i=0;
  while (i < preamble.size()) {
    writer.putLine((String)preamble.elementAt(i));
    i=i + 1;
  }
  ;
  if (linewidth >= 0) {
    writer.putLine("String_Node_Str" + Misc.floatToString(linewidth,2) + "String_Node_Str");
  }
  ;
  writer.putLine("String_Node_Str");
  writer.putLine("String_Node_Str");
  writer.putLine("String_Node_Str");
  InnerWriteAlignmentFile(spec,writer,false);
}
Program: 135863
Project: 135863
Buggy source:
/** 
 * If nd is a step of a proof--that is, it is an element of the array returned by NonLeafProofNode.getSteps()--then this returns the level number of the proof, which is the i such that the step begins "<i>". A little experimentation reveals that the parser turns "<+>" or "<*>" in the source into "<i>" for the appropriate i.
 * @param nd
 * @return
 */
static int stepLevel(SemanticNode nd){
  String stepStr=((SyntaxTreeNode)nd.stn).getHeirs()[0].image.toString();
  String stepNum=stepStr.substring(stepStr.indexOf('<') + 1,stepStr.indexOf('>'));
  return Integer.valueOf(stepNum).intValue();
}

Fixed version (ground truth):
/** 
 * If nd is a step of a proof--that is, it is an element of the array returned by NonLeafProofNode.getSteps()--then this returns the level number of the proof, which is the i such that the step begins "<i>". A little experimentation reveals that the parser turns "<+>" or "<*>" in the source into "<i>" for the appropriate i. This method must not be called if nd is a DefStepNode or InstanceNode, since for an unnumbered step (which such a step is likely to be), there is no way to find the level number.  See the comments to the one place where this method is called.
 * @param nd
 * @return
 */
static int stepLevel(SemanticNode nd){
  String stepStr=((SyntaxTreeNode)nd.stn).getHeirs()[0].image.toString();
  String stepNum=stepStr.substring(stepStr.indexOf('<') + 1,stepStr.indexOf('>'));
  return Integer.valueOf(stepNum).intValue();
}
Program: 135868
Project: 135868
Buggy source:
/** 
 * Record the state of the top menu's check buttons.
 */
private void readButtons(){
  useSufficesValue=useSufficesButton.getSelection();
  subexpressionValue=subexpressionButton.getSelection();
}

Fixed version (ground truth):
/** 
 * Record the state of the top menu's check buttons.
 */
private void readButtons(){
  useSufficesValue=useSufficesButton.getSelection();
  useCaseValue=useCaseButton.getSelection();
  subexpressionValue=subexpressionButton.getSelection();
}
Program: 135869
Project: 135869
Buggy source:
void existsAction(NodeRepresentation nodeRep){
  int idx=nodeRep.getParentIndex();
  Vector<NodeRepresentation> parentVec=nodeRep.parentVector;
  Decomposition decomp=nodeRep.decomposition;
  hasChanged=true;
  if (decomp.definedOp != null) {
    goalDefinitions.add(decomp.definedOp);
  }
  if (!nodeRep.isCreated && this.hasAssumes) {
    needsStepNumber=true;
  }
  QuantifierDecomposition qdc=decomposeQuantifier(nodeRep,true);
  parentVec.remove(idx);
  for (int i=0; i < qdc.news.size(); i++) {
    parentVec.add(idx + i,qdc.news.elementAt(i));
  }
  parentVec.add(idx + qdc.news.size(),qdc.body);
  raiseWindow();
}

Fixed version (ground truth):
void existsAction(NodeRepresentation nodeRep){
  int idx=nodeRep.getParentIndex();
  Vector<NodeRepresentation> parentVec=nodeRep.parentVector;
  Decomposition decomp=nodeRep.decomposition;
  hasChanged=true;
  if (decomp.definedOp != null) {
    assumeDefinitions.add(decomp.definedOp);
  }
  if (!nodeRep.isCreated && this.hasAssumes) {
    needsStepNumber=true;
  }
  QuantifierDecomposition qdc=decomposeQuantifier(nodeRep,true);
  parentVec.remove(idx);
  for (int i=0; i < qdc.news.size(); i++) {
    parentVec.add(idx + i,qdc.news.elementAt(i));
  }
  parentVec.add(idx + qdc.news.size(),qdc.body);
  raiseWindow();
}
Program: 135871
Project: 135871
Buggy source:
void existsAction(NodeRepresentation nodeRep){
  int idx=nodeRep.getParentIndex();
  Vector<NodeRepresentation> parentVec=nodeRep.parentVector;
  Decomposition decomp=nodeRep.decomposition;
  hasChanged=true;
  if (decomp.definedOp != null) {
    goalDefinitions.add(decomp.definedOp);
  }
  if (!nodeRep.isCreated) {
    needsStepNumber=true;
  }
  QuantifierDecomposition qdc=decomposeQuantifier(nodeRep,true);
  parentVec.remove(idx);
  for (int i=0; i < qdc.news.size(); i++) {
    parentVec.add(idx + i,qdc.news.elementAt(i));
  }
  parentVec.add(idx + qdc.news.size(),qdc.body);
  raiseWindow();
}

Fixed version (ground truth):
void existsAction(NodeRepresentation nodeRep){
  int idx=nodeRep.getParentIndex();
  Vector<NodeRepresentation> parentVec=nodeRep.parentVector;
  Decomposition decomp=nodeRep.decomposition;
  hasChanged=true;
  if (decomp.definedOp != null) {
    goalDefinitions.add(decomp.definedOp);
  }
  if (!nodeRep.isCreated && this.hasAssumes) {
    needsStepNumber=true;
  }
  QuantifierDecomposition qdc=decomposeQuantifier(nodeRep,true);
  parentVec.remove(idx);
  for (int i=0; i < qdc.news.size(); i++) {
    parentVec.add(idx + i,qdc.news.elementAt(i));
  }
  parentVec.add(idx + qdc.news.size(),qdc.body);
  raiseWindow();
}
Program: 135874
Project: 135874
Buggy source:
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    handler.realExecute(theEditor,theSelection);
  }
 catch (  ExecutionException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override protected IStatus run(IProgressMonitor monitor){
  return null;
}
Program: 135876
Project: 135876
Buggy source:
/** 
 * Sent when selection occurs in the control. The default behavior is to do nothing.
 * @param e an event containing information about the selection
 */
public void widgetSelected(SelectionEvent e){
  System.out.println("String_Node_Str");
  parent=decomposeHandler.parent;
  decomposeHandler.location=parent.getLocation();
  parent.close();
  if (parent != null) {
    if (parent.isDisposed()) {
      System.out.println("String_Node_Str");
    }
 else {
      parent.dispose();
    }
    if (parent == null) {
      System.out.println("String_Node_Str");
    }
  }
  raiseWindow("String_Node_Str" + decomposeHandler.location.toString());
  exists=true;
}

Fixed version (ground truth):
/** 
 * Sent when selection occurs in the control. The default behavior is to do nothing.
 * @param e an event containing information about the selection
 */
public void widgetSelected(SelectionEvent e){
  System.out.println("String_Node_Str");
  windowShell=decomposeHandler.windowShell;
  decomposeHandler.location=windowShell.getLocation();
  windowShell.close();
  if (windowShell != null) {
    if (windowShell.isDisposed()) {
      System.out.println("String_Node_Str");
    }
 else {
      windowShell.dispose();
    }
    if (windowShell == null) {
      System.out.println("String_Node_Str");
    }
  }
  raiseWindow("String_Node_Str" + decomposeHandler.location.toString());
}
Program: 135878
Project: 135878
Buggy source:
/** 
 * Constructs and returns the command to launch the prover.
 * @return
 */
private String[] constructCommand(){
  List<String> command=new ArrayList<String>();
  command.add(tlapmPath.toOSString());
  if (toolboxMode) {
    command.add("String_Node_Str");
    if (nodeToProve instanceof ModuleNode) {
      command.add("String_Node_Str");
      command.add("String_Node_Str");
    }
 else {
      int beginLine=getBeginLine(nodeToProve);
      int endLine=getEndLine(nodeToProve);
      command.add("String_Node_Str" + beginLine);
      command.add("String_Node_Str" + endLine);
    }
  }
  ProverHelper.setThreadsOption(command);
  ProverHelper.setSolverOption(command);
  ProverHelper.setSafeFPOption(command);
  if (checkStatus) {
    command.add("String_Node_Str");
  }
  if (options != null) {
    for (int i=0; i < options.length; i++) {
      command.add(options[i]);
    }
  }
  command.add(module.getLocation().toOSString());
  return (String[])command.toArray(new String[command.size()]);
}

Fixed version (ground truth):
/** 
 * Constructs and returns the command to launch the prover.
 * @return
 */
private String[] constructCommand(){
  List<String> command=new ArrayList<String>();
  command.add(tlapmPath.toOSString());
  if (toolboxMode) {
    command.add("String_Node_Str");
    if (nodeToProve instanceof ModuleNode) {
      command.add("String_Node_Str");
      command.add("String_Node_Str");
    }
 else {
      int beginLine=getBeginLine(nodeToProve);
      int endLine=getEndLine(nodeToProve);
      command.add("String_Node_Str" + beginLine);
      command.add("String_Node_Str" + endLine);
    }
  }
  ProverHelper.setThreadsOption(command);
  ProverHelper.setSolverOption(command);
  ProverHelper.setSafeFPOption(command);
  if (checkStatus) {
    command.add("String_Node_Str");
  }
  if (options != null) {
    for (int i=0; i < options.length; i++) {
      command.add(options[i]);
    }
  }
  command.add(module.getLocation().toOSString());
  String[] pathList=Activator.getSpecManager().getSpecLoaded().getTLALibraryPath();
  return (String[])command.toArray(new String[command.size()]);
}
Program: 135879
Project: 135879
Buggy source:
public boolean visit(IResource resource) throws CoreException {
  if (!resource.exists() || !new File(resource.getLocation().toOSString()).exists()) {
    return false;
  }
  if (IResource.PROJECT == resource.getType()) {
    return true;
  }
 else   if (IResource.FILE == resource.getType() && ResourceHelper.isModule(resource)) {
    final IPath fullPath=resource.getFullPath();
    final IDocument document=getDocument(fullPath,LocationKind.NORMALIZE);
    final FindReplaceDocumentAdapter searchAdapter=new FindReplaceDocumentAdapter(document);
    try {
      IRegion matchRegion=searchAdapter.find(0,PCAL_ALGORITHM_DEFINITION,true,true,false,false);
      if (matchRegion == null) {
        matchRegion=searchAdapter.find(0,PCAL_FAIR_ALGORITHM_DEFINITION,true,true,false,false);
      }
      final QualifiedName key=new QualifiedName(Activator.PLUGIN_ID,IPreferenceConstants.CONTAINS_PCAL_ALGORITHM);
      if (matchRegion != null) {
        resource.setSessionProperty(key,Boolean.TRUE);
      }
 else {
        resource.setSessionProperty(key,null);
      }
    }
 catch (    BadLocationException e) {
      throw new CoreException(new Status(Status.ERROR,Activator.PLUGIN_ID,"String_Node_Str",e));
    }
 finally {
      final ITextFileBufferManager bufferManager=ITextFileBufferManager.DEFAULT;
      bufferManager.disconnect(fullPath,LocationKind.NORMALIZE,new NullProgressMonitor());
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean visit(IResource resource) throws CoreException {
  if (!resource.exists() || !new File(resource.getLocation().toOSString()).exists()) {
    return false;
  }
  if (IResource.PROJECT == resource.getType()) {
    return true;
  }
 else   if (IResource.FILE == resource.getType() && ResourceHelper.isModule(resource)) {
    final IPath fullPath=resource.getFullPath();
    final IDocument document=getDocument(fullPath,LocationKind.NORMALIZE);
    final FindReplaceDocumentAdapter searchAdapter=new FindReplaceDocumentAdapter(document);
    try {
      IRegion matchRegion=null;
      if (document.getLength() != 0) {
        matchRegion=searchAdapter.find(0,PCAL_ALGORITHM_DEFINITION,true,true,false,false);
      }
 else {
        Activator.getDefault().logError("String_Node_Str");
      }
      if (matchRegion == null) {
        matchRegion=searchAdapter.find(0,PCAL_FAIR_ALGORITHM_DEFINITION,true,true,false,false);
      }
      final QualifiedName key=new QualifiedName(Activator.PLUGIN_ID,IPreferenceConstants.CONTAINS_PCAL_ALGORITHM);
      if (matchRegion != null) {
        resource.setSessionProperty(key,Boolean.TRUE);
      }
 else {
        resource.setSessionProperty(key,null);
      }
    }
 catch (    BadLocationException e) {
      throw new CoreException(new Status(Status.ERROR,Activator.PLUGIN_ID,"String_Node_Str",e));
    }
 finally {
      final ITextFileBufferManager bufferManager=ITextFileBufferManager.DEFAULT;
      bufferManager.disconnect(fullPath,LocationKind.NORMALIZE,new NullProgressMonitor());
    }
  }
  return false;
}
Program: 135880
Project: 135880
Buggy source:
public boolean visit(IResource resource) throws CoreException {
  if (!resource.exists() || !new File(resource.getLocation().toOSString()).exists()) {
    return false;
  }
  if (IResource.PROJECT == resource.getType()) {
    return true;
  }
 else   if (IResource.FILE == resource.getType() && ResourceHelper.isModule(resource)) {
    final IDocument document=getDocument(resource.getFullPath(),LocationKind.NORMALIZE);
    final FindReplaceDocumentAdapter searchAdapter=new FindReplaceDocumentAdapter(document);
    try {
      IRegion matchRegion=searchAdapter.find(0,PCAL_ALGORITHM_DEFINITION,true,true,false,false);
      if (matchRegion == null) {
        matchRegion=searchAdapter.find(0,PCAL_FAIR_ALGORITHM_DEFINITION,true,true,false,false);
      }
      final QualifiedName key=new QualifiedName(Activator.PLUGIN_ID,IPreferenceConstants.CONTAINS_PCAL_ALGORITHM);
      if (matchRegion != null) {
        resource.setSessionProperty(key,Boolean.TRUE);
      }
 else {
        resource.setSessionProperty(key,null);
      }
    }
 catch (    BadLocationException e) {
      throw new CoreException(new Status(Status.ERROR,Activator.PLUGIN_ID,"String_Node_Str",e));
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean visit(IResource resource) throws CoreException {
  if (!resource.exists() || !new File(resource.getLocation().toOSString()).exists()) {
    return false;
  }
  if (IResource.PROJECT == resource.getType()) {
    return true;
  }
 else   if (IResource.FILE == resource.getType() && ResourceHelper.isModule(resource)) {
    final IPath fullPath=resource.getFullPath();
    final IDocument document=getDocument(fullPath,LocationKind.NORMALIZE);
    final FindReplaceDocumentAdapter searchAdapter=new FindReplaceDocumentAdapter(document);
    try {
      IRegion matchRegion=searchAdapter.find(0,PCAL_ALGORITHM_DEFINITION,true,true,false,false);
      if (matchRegion == null) {
        matchRegion=searchAdapter.find(0,PCAL_FAIR_ALGORITHM_DEFINITION,true,true,false,false);
      }
      final QualifiedName key=new QualifiedName(Activator.PLUGIN_ID,IPreferenceConstants.CONTAINS_PCAL_ALGORITHM);
      if (matchRegion != null) {
        resource.setSessionProperty(key,Boolean.TRUE);
      }
 else {
        resource.setSessionProperty(key,null);
      }
    }
 catch (    BadLocationException e) {
      throw new CoreException(new Status(Status.ERROR,Activator.PLUGIN_ID,"String_Node_Str",e));
    }
 finally {
      final ITextFileBufferManager bufferManager=ITextFileBufferManager.DEFAULT;
      bufferManager.disconnect(fullPath,LocationKind.NORMALIZE,new NullProgressMonitor());
    }
  }
  return false;
}
Program: 135881
Project: 135881
Buggy source:
/** 
 * retrieves a new buffered file output stream
 * @param name
 * @return
 */
public static OutputStream newBFOS(String name){
  File file=new File(name);
  if (file != null && file.exists()) {
    try {
      FileOutputStream fos=new FileOutputStream(file);
      return fos;
    }
 catch (    FileNotFoundException e) {
      ToolIO.out.println("String_Node_Str");
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * retrieves a new buffered file output stream
 * @param name
 * @return
 */
public static OutputStream newBFOS(String name){
  File file=new File(name);
  if (file != null) {
    try {
      FileOutputStream fos=new FileOutputStream(file);
      return fos;
    }
 catch (    FileNotFoundException e) {
      ToolIO.out.println("String_Node_Str" + name);
    }
  }
  return null;
}
Program: 135882
Project: 135882
Buggy source:
/** 
 * Returns true iff  this node and otherNode are both OpDefOrDeclNode objects or both ThmOrAssumpDefNode objects and have the same originallyDefinedInModule field.  Added by LL on 31 Oct 2012.
 * @param otherNode
 * @return
 */
public final boolean sameOriginallyDefinedInModule(SymbolNode otherNode){
  if (this.getClass() == otherNode.getClass()) {
    if (this instanceof OpDefOrDeclNode) {
      return ((OpDefOrDeclNode)this).originallyDefinedInModule == ((OpDefOrDeclNode)otherNode).originallyDefinedInModule;
    }
    if (this instanceof ThmOrAssumpDefNode) {
      return ((ThmOrAssumpDefNode)this).getOriginallyDefinedInModuleNode() == ((ThmOrAssumpDefNode)otherNode).getOriginallyDefinedInModuleNode();
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true iff this node and otherNode are both OpDefOrDeclNode objects or both ThmOrAssumpDefNode objects and have the same originallyDefinedInModule field.  Added by LL on 31 Oct 2012.  Corrected by LL on 1 Nov 2012 by (a) using the originallyDefinedInModule for the source definitions (returned by getSource()), and by adding requirement  that their module of origin has no parameters.  This method is used to check that two instantiations of a definition are the same.  They may not be if the two instantiations of their module have different substitutions for parameters.  To check that the substitutions are the same would be difficult, so we require that the module has no parameters.  This covers the common case when the definitions come from a standard module.
 * @param otherNode
 * @return
 */
public final boolean sameOriginallyDefinedInModule(SymbolNode otherNode){
  if (this.getClass() == otherNode.getClass()) {
    ModuleNode thisModule=null;
    if (this instanceof OpDefNode) {
      OpDefNode thisSrc=((OpDefNode)this).getSource();
      if (thisSrc != ((OpDefNode)otherNode).getSource()) {
        return false;
      }
      thisModule=((OpDefNode)thisSrc).getOriginallyDefinedInModuleNode();
    }
 else     if (this instanceof ThmOrAssumpDefNode) {
      ThmOrAssumpDefNode thisSrc=((ThmOrAssumpDefNode)this).getSource();
      if (thisSrc != ((ThmOrAssumpDefNode)otherNode).getSource()) {
        return false;
      }
      thisModule=((ThmOrAssumpDefNode)thisSrc).getOriginallyDefinedInModuleNode();
    }
 else {
      return false;
    }
    return (thisModule == null) || ((thisModule.getConstantDecls().length == 0) && (thisModule.getVariableDecls().length == 0));
  }
  return false;
}
Program: 135884
Project: 135884
Buggy source:
private final ExprOrOpArgNode getArg(SymbolNode param){
  OpDefNode opDef=(OpDefNode)this.operator;
  FormalParamNode[] formals=opDef.getParams();
  for (int i=0; i < this.operands.length; i++) {
    if (formals[i] == param) {
      return this.operands[i];
    }
  }
  return null;
}

Fixed version (ground truth):
private final ExprOrOpArgNode getArg(SymbolNode param){
  AnyDefNode opDef=(AnyDefNode)this.operator;
  FormalParamNode[] formals=opDef.getParams();
  for (int i=0; i < this.operands.length; i++) {
    if (formals[i] == param) {
      return this.operands[i];
    }
  }
  return null;
}
Program: 135889
Project: 135889
Buggy source:
/** 
 * get partitions  
 */
protected void calculatePositions(){
  try {
    IDocumentExtension3 extension=(IDocumentExtension3)document;
    ITypedRegion[] partitions=extension.computePartitioning(TLAPartitionScanner.TLA_PARTITIONING,0,document.getLength(),false);
    for (int i=0; i < partitions.length; i++) {
      IRegion lineOnPartitionStart=document.getLineInformationOfOffset(partitions[i].getOffset());
      if ((partitions[i].getType().equals(TLAPartitionScanner.TLA_MULTI_LINE_COMMENT) || partitions[i].getType().equals(TLAPartitionScanner.TLA_PCAL)) && partitions[i].getLength() > lineOnPartitionStart.getLength()) {
        positions.add(new Position(partitions[i].getOffset(),partitions[i].getLength()));
      }
    }
  }
 catch (  BadLocationException e) {
    e.printStackTrace();
  }
catch (  BadPartitioningException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * get partitions  
 */
protected void calculatePositions(){
  try {
    IDocumentExtension3 extension=(IDocumentExtension3)document;
    ITypedRegion[] partitions=extension.computePartitioning(TLAPartitionScanner.TLA_PARTITIONING,0,document.getLength(),false);
    for (int i=0; i < partitions.length; i++) {
      IRegion lineOnPartitionStart=document.getLineInformationOfOffset(partitions[i].getOffset());
      if ((partitions[i].getType().equals(TLAPartitionScanner.TLA_MULTI_LINE_COMMENT)) && partitions[i].getLength() > lineOnPartitionStart.getLength()) {
        positions.add(new Position(partitions[i].getOffset(),partitions[i].getLength()));
      }
    }
  }
 catch (  BadLocationException e) {
    e.printStackTrace();
  }
catch (  BadPartitioningException e) {
    e.printStackTrace();
  }
}
Program: 135892
Project: 135892
Buggy source:
/** 
 * This is called with parenthesize = true only during the initial parsing  phase (the execution of ParseAlgorithm.getAlgorithm).  It is called with  parenthesize = false by: PcalFixIDs.FixExpr : replaces the string of an IDENT token with a new one to perform renaming in case of name conflicts. PcalTLAGen.AddSubscriptsToExpr: adds the primes and "[self]" subscripts to variables when needed.
 * @param exprs
 * @param strs
 * @param parenthesize
 * @throws TLAExprException
 */
public void substituteForAll(Vector exprs,Vector strs,boolean parenthesize) throws TLAExprException {
  int i=0;
  while (i < exprs.size()) {
    TLAExpr exp=(TLAExpr)exprs.elementAt(i);
    String st=(String)strs.elementAt(i);
    substituteFor(exp,st,parenthesize);
    i=i + 1;
  }
  ;
  return;
}

Fixed version (ground truth):
/** 
 * @param exprs
 * @param strs
 * @param parenthesize
 * @throws TLAExprException
 */
public void substituteForAll(Vector exprs,Vector strs,boolean parenthesize) throws TLAExprException {
  TLAExpr[] expArray=new TLAExpr[exprs.size()];
  String[] strArray=new String[strs.size()];
  IntPair[] nextArray=new IntPair[expArray.length];
  for (int i=0; i < nextArray.length; i++) {
    expArray[i]=(TLAExpr)exprs.elementAt(i);
    strArray[i]=(String)strs.elementAt(i);
    nextArray[i]=findNextInstanceIn(strArray[i],new IntPair(0,0));
  }
  boolean notDone=true;
  while (notDone) {
    IntPair nextPos=null;
    int nextIdx=-1;
    for (int i=0; i < nextArray.length; i++) {
      IntPair pos=nextArray[i];
      if (pos != null) {
        if (nextPos == null) {
          nextPos=pos;
          nextIdx=i;
        }
 else         if ((pos.one < nextPos.one) || ((pos.one == nextPos.one) && (pos.two < nextPos.two))) {
          nextPos=pos;
          nextIdx=i;
        }
      }
    }
    if (nextPos == null) {
      notDone=false;
    }
 else {
      IntPair afterNextPos=stepCoord(nextPos,1);
      IntPair newPos=substituteAt(expArray[nextIdx],nextPos,parenthesize);
      nextArray[nextIdx]=(newPos == null) ? null : findNextInstanceIn(strArray[nextIdx],newPos);
      for (int i=0; i < nextArray.length; i++) {
        if ((i != nextIdx) && (nextArray[i] != null)) {
          Debug.Assert(newPos != null,"String_Node_Str");
          if (afterNextPos.one == newPos.one) {
            if (nextArray[i].one == nextPos.one) {
              nextArray[i].two=nextArray[i].two + (newPos.two - afterNextPos.two);
              Debug.Assert(nextArray[i].two > nextPos.two,"String_Node_Str");
            }
          }
 else {
            if (nextArray[i].one == nextPos.one) {
              nextArray[i].one=nextArray[i].one + (newPos.one - afterNextPos.one);
              Debug.Assert(nextArray[i].two > nextPos.two,"String_Node_Str");
              nextArray[i].two=nextArray[i].two + (newPos.two - afterNextPos.two);
            }
 else {
              nextArray[i].one=nextArray[i].one + (newPos.one - afterNextPos.one);
            }
          }
        }
      }
    }
  }
  return;
}
Program: 135893
Project: 135893
Buggy source:
/** 
 * @return the collisions
 */
public long getCollisions(){
  return collisions;
}

Fixed version (ground truth):
/** 
 * @return the collisions
 */
public long getCollisions(){
  return collisions == 0 ? 1 : collisions;
}
Program: 135894
Project: 135894
Buggy source:
/** 
 * Returns the error message for printError(EC.GENERAL, cause, throwable)
 * @param cause
 * @param throwable
 * @return
 */
public static String ECGeneralMsg(String cause,Throwable throwable){
  String msg="String_Node_Str" + throwable.getClass().getName();
  if (throwable.getMessage() != null) {
    msg=msg + "String_Node_Str" + throwable.getMessage();
  }
  msg=msg + "String_Node_Str";
  if (cause.equals("String_Node_Str")) {
    msg=msg + "String_Node_Str";
  }
 else {
    msg=msg + "String_Node_Str" + cause+ "String_Node_Str";
  }
  return msg;
}

Fixed version (ground truth):
/** 
 * Returns the error message for printError(EC.GENERAL, cause, throwable) Created by LL on 7 April 2012.   Modified by LL on 24 April 2012 because, for some errors, throwable.getMessage() contains a nested error message, and the Toolbox's code for parsing TLC output apparently cannot handle a nested error message containing text before and after it.  So I put all the additional message text before throwable.getMessage().
 * @param cause
 * @param throwable
 * @return
 */
public static String ECGeneralMsg(String cause,Throwable throwable){
  String msg="String_Node_Str";
  msg=msg + "String_Node_Str";
  if (cause.equals("String_Node_Str")) {
    msg=msg + "String_Node_Str";
  }
 else {
    msg=msg + "String_Node_Str" + cause+ "String_Node_Str";
  }
  msg=msg + "String_Node_Str" + throwable.getClass().getName();
  if (throwable.getMessage() != null) {
    msg=msg + "String_Node_Str" + throwable.getMessage();
  }
  return msg;
}