nus-yam/ex-repair huggingface dataset:
Program: 43038
Project: 43038
Buggy source:
/** 
 * Remove an edge.  Does not remove any vertices or other related structures.
 * @param e The edge to remove
 */
public void removeEdge(int e){
  if (DEBUG) {
    System.out.println("String_Node_Str" + e);
  }
  int prev=Edge.getPrev(edges,e);
  if (prev != -1) {
    Edge.setNext(Edge.getNext(edges,e),edges,prev);
  }
 else {
    startEdge=Edge.getNext(edges,e);
  }
  if (e == lastEdge) {
    lastEdge=prev;
    if (lastEdge == -1) {
    }
 else {
      Edge.setNext(-1,edges,lastEdge);
    }
  }
 else {
    int next=Edge.getNext(edges,e);
    if (next != -1) {
      Edge.setPrev(prev,edges,next);
    }
  }
  edgeCount--;
}

Fixed version (ground truth):
/** 
 * Remove an edge.  Does not remove any vertices or other related structures.
 * @param e The edge to remove
 */
public void removeEdge(int e){
  if (DEBUG) {
    System.out.println("String_Node_Str" + e);
  }
  int prev=Edge.getPrev(edges,e);
  if (prev != -1) {
    Edge.setNext(Edge.getNext(edges,e),edges,prev);
  }
 else {
    startEdge=Edge.getNext(edges,e);
  }
  if (e == lastEdge) {
    lastEdge=prev;
    if (lastEdge == -1) {
    }
 else {
      Edge.setNext(-1,edges,lastEdge);
    }
  }
 else {
    int next=Edge.getNext(edges,e);
    if (next != -1) {
      Edge.setPrev(prev,edges,next);
      return;
    }
  }
  edgeCount--;
}
Program: 43041
Project: 43041
Buggy source:
/** 
 * Verify that the mesh structure is correct.  Chase as many pointers and references as we can to confirm that nothing is messed up.
 * @param mesh
 * @return
 */
public static boolean verifyCounts(TriangleMesh mesh){
  StructMixedData edges=mesh.getEdges();
  int startEdge=mesh.getStartEdge();
  StructMixedData faces=mesh.getFaces();
  int startFace=mesh.getStartFace();
  StructMixedData vertices=mesh.getVertices();
  int startVertex=mesh.getStartVertex();
  StructMixedData hedges=mesh.getHalfEdges();
  int e=startEdge;
  int edgeCount=0;
  while (e != -1) {
    edgeCount++;
    int he=Edge.getHe(edges,e);
    e=Edge.getNext(edges,e);
  }
  System.out.println("String_Node_Str" + mesh.getEdgeCount() + "String_Node_Str"+ edgeCount);
  int f=startFace;
  int faceCount=0;
  while (f != -1) {
    faceCount++;
    f=Face.getNext(faces,f);
  }
  System.out.println("String_Node_Str" + mesh.getFaceCount() + "String_Node_Str"+ faceCount);
  int v=startVertex;
  int vertexCount=0;
  while (v != -1) {
    vertexCount++;
    v=Vertex.getNext(vertices,v);
  }
  System.out.println("String_Node_Str" + mesh.getVertexCount() + "String_Node_Str"+ vertexCount);
  return true;
}

Fixed version (ground truth):
/** 
 * Verify that the mesh structure is correct.  Chase as many pointers and references as we can to confirm that nothing is messed up.
 * @param mesh
 * @return
 */
public boolean verifyCounts(TriangleMesh mesh){
  StructMixedData edges=mesh.getEdges();
  int startEdge=mesh.getStartEdge();
  StructMixedData faces=mesh.getFaces();
  int startFace=mesh.getStartFace();
  StructMixedData vertices=mesh.getVertices();
  int startVertex=mesh.getStartVertex();
  StructMixedData hedges=mesh.getHalfEdges();
  int e=startEdge;
  int edgeCount=0;
  while (e != -1) {
    edgeCount++;
    e=Edge.getNext(edges,e);
  }
  System.out.println("String_Node_Str" + mesh.getEdgeCount() + "String_Node_Str"+ edgeCount);
  int f=startFace;
  int faceCount=0;
  while (f != -1) {
    faceCount++;
    f=Face.getNext(faces,f);
  }
  System.out.println("String_Node_Str" + mesh.getFaceCount() + "String_Node_Str"+ faceCount);
  int v=startVertex;
  int vertexCount=0;
  while (v != -1) {
    vertexCount++;
    v=Vertex.getNext(vertices,v);
  }
  System.out.println("String_Node_Str" + mesh.getVertexCount() + "String_Node_Str"+ vertexCount);
  return true;
}
Program: 43042
Project: 43042
Buggy source:
/** 
 * Remove an edge.  Does not remove any vertices or other related structures.
 * @param e The edge to remove
 */
public void removeEdge(int e){
  if (DEBUG) {
    System.out.println("String_Node_Str" + e);
  }
  int prev=Edge.getPrev(edges,e);
  if (prev != -1) {
    Edge.setNext(Edge.getNext(edges,e),edges,prev);
  }
 else {
    startEdge=Edge.getNext(edges,e);
  }
  if (e == lastEdge) {
    lastEdge=prev;
    if (lastEdge == -1) {
    }
 else {
      Edge.setNext(-1,edges,lastEdge);
    }
  }
 else {
    int next=Edge.getNext(edges,e);
    if (next != -1) {
      Edge.setPrev(prev,edges,next);
    }
 else {
      return;
    }
  }
  edgeCount--;
}

Fixed version (ground truth):
/** 
 * Remove an edge.  Does not remove any vertices or other related structures.
 * @param e The edge to remove
 */
public void removeEdge(int e){
  if (Edge.getHe(edges,e) == -1) {
    return;
  }
  if (DEBUG) {
    System.out.println("String_Node_Str" + e);
  }
  int prev=Edge.getPrev(edges,e);
  if (prev != -1) {
    Edge.setNext(Edge.getNext(edges,e),edges,prev);
  }
 else {
    startEdge=Edge.getNext(edges,e);
  }
  if (e == lastEdge) {
    lastEdge=prev;
    if (lastEdge == -1) {
    }
 else {
      Edge.setNext(-1,edges,lastEdge);
    }
  }
 else {
    int next=Edge.getNext(edges,e);
    if (next != -1) {
      Edge.setPrev(prev,edges,next);
    }
 else {
      return;
    }
  }
  Edge.setHe(-1,edges,e);
  edgeCount--;
}
Program: 43043
Project: 43043
Buggy source:
public void removeVertex(int v){
  if (DEBUG) {
    System.out.println("String_Node_Str" + v);
  }
  int prev=Vertex.getPrev(vertices,v);
  if (prev != -1) {
    Vertex.setNext(Vertex.getNext(vertices,v),vertices,prev);
  }
 else {
    startVertex=Vertex.getNext(vertices,v);
  }
  if (v == lastVertex) {
    lastVertex=prev;
    if (lastVertex == -1) {
    }
 else {
      Vertex.setNext(-1,vertices,lastVertex);
    }
  }
 else {
    int next=Vertex.getNext(vertices,v);
    Vertex.setPrev(prev,vertices,next);
  }
  Vertex.setLink(-1,vertices,v);
  Vertex.setNext(-1,vertices,v);
  vertexCount--;
}

Fixed version (ground truth):
public void removeVertex(int v){
  if (Vertex.getLink(vertices,v) == -1) {
    return;
  }
  if (DEBUG) {
    System.out.println("String_Node_Str" + v);
  }
  int prev=Vertex.getPrev(vertices,v);
  if (prev != -1) {
    Vertex.setNext(Vertex.getNext(vertices,v),vertices,prev);
  }
 else {
    startVertex=Vertex.getNext(vertices,v);
  }
  if (v == lastVertex) {
    lastVertex=prev;
    if (lastVertex == -1) {
    }
 else {
      Vertex.setNext(-1,vertices,lastVertex);
    }
  }
 else {
    int next=Vertex.getNext(vertices,v);
    Vertex.setPrev(prev,vertices,next);
  }
  Vertex.setLink(-1,vertices,v);
  Vertex.setNext(-1,vertices,v);
  vertexCount--;
}
Program: 43044
Project: 43044
Buggy source:
/** 
 * Remove a face from the mesh.  This method does not remove any edges or vertices.
 * @param f The face to remove
 */
public void removeFace(int f){
  if (DEBUG) {
    System.out.println("String_Node_Str" + f);
  }
  int prev=Face.getPrev(faces,f);
  if (prev != -1) {
    Face.setNext(Face.getNext(faces,f),faces,prev);
  }
 else {
    startFace=Face.getNext(faces,f);
  }
  if (f == lastFace) {
    lastFace=prev;
    if (lastFace == -1) {
    }
 else {
      Face.setNext(-1,faces,lastFace);
    }
  }
 else {
    int next=Face.getNext(faces,f);
    Face.setPrev(prev,faces,next);
  }
  faceCount--;
}

Fixed version (ground truth):
/** 
 * Remove a face from the mesh.  This method does not remove any edges or vertices.
 * @param f The face to remove
 */
public void removeFace(int f){
  if (Face.getHe(faces,f) == -1) {
    return;
  }
  if (DEBUG) {
    System.out.println("String_Node_Str" + f);
  }
  int prev=Face.getPrev(faces,f);
  if (prev != -1) {
    Face.setNext(Face.getNext(faces,f),faces,prev);
  }
 else {
    startFace=Face.getNext(faces,f);
  }
  if (f == lastFace) {
    lastFace=prev;
    if (lastFace == -1) {
    }
 else {
      Face.setNext(-1,faces,lastFace);
    }
  }
 else {
    int next=Face.getNext(faces,f);
    Face.setPrev(prev,faces,next);
  }
  Face.setHe(-1,faces,f);
  faceCount--;
}
Program: 43046
Project: 43046
Buggy source:
void getCandidateEdges(StructMixedData edges,int start,EdgeData ed[]){
  for (int i=0; i < ed.length; i++) {
    m_edgeArray.getRandomEdge(ed[i]);
  }
}

Fixed version (ground truth):
/** 
 */
void getCandidateEdges(EdgeData ed[]){
  for (int i=0; i < ed.length; i++) {
    m_edgeArray.getRandomEdge(ed[i]);
  }
}
Program: 43047
Project: 43047
Buggy source:
/** 
 * init vertices with initial quadrics
 */
protected void doInitialization(){
  if (DEBUG)   printf("String_Node_Str");
  m_maxError=0;
  m_ecr=new EdgeCollapseResult();
  m_ecp=new EdgeCollapseParams();
  m_candidates=new EdgeData[RANDOM_CANDIDATES_COUNT];
  m_errorFunction=new ErrorQuadric(quadrics);
  m_collapseCount=0;
  for (int i=0; i < m_candidates.length; i++) {
    m_candidates[i]=new EdgeData(quadrics);
  }
  int ecount=m_mesh.getEdgeCount();
  printf("String_Node_Str",ecount);
  m_edgeArray=new EdgeArray(ecount);
  StructMixedData edges=m_mesh.getEdges();
  int e=m_mesh.getStartEdge();
  int count=0;
  System.out.println("String_Node_Str" + e);
  while (e != -1) {
    Edge.setUserData(count,edges,e);
    if (count + 1 > ecount) {
      System.out.println("String_Node_Str");
      WingedEdgeTriangleMesh.verifyCounts(m_mesh);
    }
    m_edgeArray.set(count++,e);
    e=Edge.getNext(edges,e);
  }
  m_errorFunction.init(m_mesh);
  printf("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * init vertices with initial quadrics
 */
protected void doInitialization(){
  if (DEBUG)   printf("String_Node_Str");
  m_maxError=0;
  m_ecr=new EdgeCollapseResult();
  m_ecp=new EdgeCollapseParams();
  m_candidates=new EdgeData[RANDOM_CANDIDATES_COUNT];
  m_errorFunction=new ErrorQuadric(quadrics);
  m_collapseCount=0;
  for (int i=0; i < m_candidates.length; i++) {
    m_candidates[i]=new EdgeData(quadrics);
  }
  int ecount=m_mesh.getEdgeCount();
  printf("String_Node_Str",ecount);
  m_edgeArray=new EdgeArray(ecount);
  StructMixedData edges=m_mesh.getEdges();
  int e=m_mesh.getStartEdge();
  int count=0;
  System.out.println("String_Node_Str" + e);
  while (e != -1) {
    Edge.setUserData(count,edges,e);
    m_edgeArray.set(count++,e);
    e=Edge.getNext(edges,e);
  }
  m_errorFunction.init(m_mesh);
  printf("String_Node_Str");
}
Program: 43049
Project: 43049
Buggy source:
/** 
 * Remove an edge.  Does not remove any vertices or other related structures.
 * @param e The edge to remove
 */
public void removeEdge(int e){
  if (DEBUG) {
    System.out.println("String_Node_Str" + e);
  }
  int prev=Edge.getPrev(edges,e);
  if (prev != -1) {
    Edge.setNext(Edge.getNext(edges,e),edges,prev);
  }
 else {
    startEdge=Edge.getNext(edges,e);
  }
  if (e == lastEdge) {
    lastEdge=prev;
    if (lastEdge == -1) {
    }
 else {
      Edge.setNext(-1,edges,lastEdge);
    }
  }
 else {
    int next=Edge.getNext(edges,e);
    if (next != -1) {
      Edge.setPrev(prev,edges,next);
      return;
    }
  }
  edgeCount--;
}

Fixed version (ground truth):
/** 
 * Remove an edge.  Does not remove any vertices or other related structures.
 * @param e The edge to remove
 */
public void removeEdge(int e){
  if (DEBUG) {
    System.out.println("String_Node_Str" + e);
  }
  int prev=Edge.getPrev(edges,e);
  if (prev != -1) {
    Edge.setNext(Edge.getNext(edges,e),edges,prev);
  }
 else {
    startEdge=Edge.getNext(edges,e);
  }
  if (e == lastEdge) {
    lastEdge=prev;
    if (lastEdge == -1) {
    }
 else {
      Edge.setNext(-1,edges,lastEdge);
    }
  }
 else {
    int next=Edge.getNext(edges,e);
    if (next != -1) {
      Edge.setPrev(prev,edges,next);
    }
 else {
      return;
    }
  }
  edgeCount--;
}
Program: 43050
Project: 43050
Buggy source:
public void testSphereHard() throws Exception {
  String fpath="String_Node_Str";
  processFile(fpath,1e-2,0.3);
}

Fixed version (ground truth):
/** 
 * Burn the sphere to almost nothing to test edge cases.
 * @throws Exception
 */
public void testSphereHard() throws Exception {
  String fpath="String_Node_Str";
  processFile(fpath,1e-2,0.3);
}
Program: 43051
Project: 43051
Buggy source:
/** 
 * Write a grid using the IsoSurfaceMaker to the specified file
 * @param grid
 * @param smoothSteps
 * @throws IOException
 */
public static WingedEdgeTriangleMesh createIsosurface(Grid grid,int smoothSteps) throws IOException {
  int nx=grid.getWidth();
  int ny=grid.getHeight();
  int nz=grid.getDepth();
  double vs=grid.getVoxelSize();
  double gbounds[]=new double[]{-nx * vs / 2,nx * vs / 2,-ny * vs / 2,ny * vs / 2,-nz * vs / 2,nz * vs / 2};
  double ibounds[]=extendBounds(gbounds,-vs / 2);
  IsosurfaceMaker im=new IsosurfaceMaker();
  im.setIsovalue(0.);
  im.setBounds(ibounds);
  im.setGridSize(nx,ny,nz);
  IndexedTriangleSetBuilder its=new IndexedTriangleSetBuilder();
  im.makeIsosurface(new IsosurfaceMaker.SliceGrid(grid,gbounds,0),its);
  int[][] faces=its.getFaces();
  WingedEdgeTriangleMesh mesh=new WingedEdgeTriangleMesh(its.getVertices(),faces);
  double centerWeight=1.0;
  LaplasianSmooth ls=new LaplasianSmooth();
  ls.setCenterWeight(centerWeight);
  System.out.println("String_Node_Str");
  long t0=currentTimeMillis();
  printf("String_Node_Str");
  t0=currentTimeMillis();
  ls.processMesh(mesh,smoothSteps);
  printf("String_Node_Str",(currentTimeMillis() - t0));
  return mesh;
}

Fixed version (ground truth):
/** 
 * Write a grid using the IsoSurfaceMaker to the specified file
 * @param grid
 * @param smoothSteps
 * @throws IOException
 */
public static WingedEdgeTriangleMesh createIsosurface(Grid grid,int smoothSteps) throws IOException {
  int nx=grid.getWidth();
  int ny=grid.getHeight();
  int nz=grid.getDepth();
  double vs=grid.getVoxelSize();
  double gbounds[]=new double[]{-nx * vs / 2,nx * vs / 2,-ny * vs / 2,ny * vs / 2,-nz * vs / 2,nz * vs / 2};
  double ibounds[]=extendBounds(gbounds,-vs / 2);
  IsosurfaceMaker im=new IsosurfaceMaker();
  im.setIsovalue(0.);
  im.setBounds(ibounds);
  im.setGridSize(nx,ny,nz);
  IndexedTriangleSetBuilder its=new IndexedTriangleSetBuilder();
  im.makeIsosurface(new IsosurfaceMaker.SliceGrid(grid,gbounds,0),its);
  int[][] faces=its.getFaces();
  WingedEdgeTriangleMesh mesh=new WingedEdgeTriangleMesh(its.getVertices(),faces);
  double centerWeight=1.0;
  LaplasianSmooth ls=new LaplasianSmooth();
  ls.setCenterWeight(centerWeight);
  long t0=currentTimeMillis();
  printf("String_Node_Str",smoothSteps);
  t0=currentTimeMillis();
  ls.processMesh(mesh,smoothSteps);
  printf("String_Node_Str",(currentTimeMillis() - t0));
  return mesh;
}
Program: 43052
Project: 43052
Buggy source:
public HalfEdgeKey(Object o1,Object o2){
  this.o1=o1;
  this.o2=o2;
}

Fixed version (ground truth):
public HalfEdgeKey(Vertex head,Vertex tail){
  this.head=head;
  this.tail=tail;
}
Program: 43053
Project: 43053
Buggy source:
public int hashCode(){
  return o1.hashCode() + 119 * o2.hashCode();
}

Fixed version (ground truth):
public int hashCode(){
  return head.hashCode() + 119 * tail.hashCode();
}
Program: 43054
Project: 43054
Buggy source:
public boolean equals(Object obj){
  HalfEdgeKey hk=(HalfEdgeKey)obj;
  return (hk.o1 == o1) && (hk.o2 == o2);
}

Fixed version (ground truth):
public boolean equals(Object obj){
  HalfEdgeKey hk=(HalfEdgeKey)obj;
  return (hk.head == head) && (hk.tail == tail);
}
Program: 43055
Project: 43055
Buggy source:
public void removeEdge(Edge e){
  if (DEBUG)   System.out.println("String_Node_Str" + e);
  Edge prev=e.getPrev();
  if (prev != null) {
    prev.setNext(e.getNext());
  }
 else {
    edges=e.getNext();
  }
  e.getNext().setPrev(e.getPrev());
  if (e == lastEdge) {
    lastEdge=prev;
    lastEdge.setNext(null);
  }
  edgeMap.remove(e);
}

Fixed version (ground truth):
public void removeEdge(Edge e){
  if (DEBUG)   System.out.println("String_Node_Str" + e);
  Edge prev=e.getPrev();
  if (prev != null) {
    prev.setNext(e.getNext());
  }
 else {
    edges=e.getNext();
  }
  e.getNext().setPrev(e.getPrev());
  if (e == lastEdge) {
    lastEdge=prev;
    lastEdge.setNext(null);
  }
}
Program: 43056
Project: 43056
Buggy source:
public WingedEdgeTriangleMesh(Point3d vertCoord[],int[][] findex){
  Vertex V[]=new Vertex[vertCoord.length];
  for (int nv=0; nv < V.length; nv++) {
    V[nv]=new Vertex();
    V[nv].setPoint(new Point3d(vertCoord[nv]));
    V[nv].setID(nv);
  }
  ArrayList eface=new ArrayList(findex.length * 3);
  for (int i=0; i < findex.length; i++) {
    int[] face=findex[i];
    if (face == null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    eface.clear();
    if (face.length != 3) {
      throw new IllegalArgumentException("String_Node_Str" + i);
    }
    for (int j=0; j < face.length; j++) {
      Vertex v1=V[face[j]];
      Vertex v2=V[face[(j + 1) % face.length]];
      HalfEdge he=buildHalfEdge(v1,v2);
      edgeMap.put(new HalfEdgeKey(he.getTail(),he.getHead()),he);
      eface.add(he);
    }
    buildFace(eface);
  }
  boolean notifyNonManifold=true;
  HalfEdgeKey key=new HalfEdgeKey();
  for (  HalfEdge he1 : edgeMap.values()) {
    if (he1.getTwin() == null) {
      key.o1=he1.getHead();
      key.o2=he1.getTail();
      HalfEdge he2=edgeMap.get(key);
      if (he2 != null) {
        betwin(he1,he2);
        buildEdge(he1);
      }
 else {
        if (DEBUG && notifyNonManifold) {
          System.out.println("String_Node_Str" + he1 + "String_Node_Str"+ he1.getHead().getID()+ "String_Node_Str"+ he1.getTail().getID());
        }
        buildEdge(he1);
      }
    }
  }
  for (int i=0; i < V.length; i++) {
    addVertex(V[i]);
  }
}

Fixed version (ground truth):
public WingedEdgeTriangleMesh(Point3d vertCoord[],int[][] findex){
  Vertex V[]=new Vertex[vertCoord.length];
  for (int nv=0; nv < V.length; nv++) {
    V[nv]=new Vertex();
    V[nv].setPoint(new Point3d(vertCoord[nv]));
    V[nv].setID(nv);
  }
  ArrayList eface=new ArrayList(findex.length * 3);
  for (int i=0; i < findex.length; i++) {
    int[] face=findex[i];
    if (face == null) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    eface.clear();
    if (face.length != 3) {
      throw new IllegalArgumentException("String_Node_Str" + i);
    }
    for (int j=0; j < face.length; j++) {
      Vertex v1=V[face[j]];
      Vertex v2=V[face[(j + 1) % face.length]];
      HalfEdge he=buildHalfEdge(v1,v2);
      edgeMap.put(new HalfEdgeKey(he.getHead(),he.getTail()),he);
      eface.add(he);
    }
    buildFace(eface);
  }
  boolean notifyNonManifold=true;
  HalfEdgeKey key=new HalfEdgeKey();
  for (  HalfEdge he1 : edgeMap.values()) {
    if (he1.getTwin() == null) {
      key.setHead(he1.getTail());
      key.setTail(he1.getHead());
      HalfEdge he2=edgeMap.get(key);
      if (he2 != null) {
        betwin(he1,he2);
        buildEdge(he1);
      }
 else {
        if (DEBUG && notifyNonManifold) {
          System.out.println("String_Node_Str" + he1 + "String_Node_Str"+ he1.getHead().getID()+ "String_Node_Str"+ he1.getTail().getID());
        }
        buildEdge(he1);
      }
    }
  }
  for (int i=0; i < V.length; i++) {
    addVertex(V[i]);
  }
}
Program: 43058
Project: 43058
Buggy source:
/** 
 * Change a vertex reference from one vertex to another for a face.
 * @param f The face
 * @param vorig The original vertex
 * @param vnew The new vertex
 * @param hedges List of hald
 */
private void changeVertex(Face f,Vertex vorig,Vertex vnew,List<Edge> hedges){
  if (DEBUG)   System.out.println("String_Node_Str" + f + "String_Node_Str"+ vorig.getID()+ "String_Node_Str"+ vnew.getID());
  HalfEdge he=f.getHe();
  HalfEdge start=he;
  while (he != null) {
    if (he.getHead() == vorig) {
      if (DEBUG)       System.out.print("String_Node_Str" + he);
      hedges.add(he.getEdge());
      he.setHead(vnew);
      if (DEBUG)       System.out.println("String_Node_Str" + he);
      changeVertex(he.getTwin().getLeft(),vorig,vnew,hedges);
    }
 else     if (he.getTail() == vorig) {
      if (DEBUG)       System.out.print("String_Node_Str" + he);
      hedges.add(he.getEdge());
      he.setTail(vnew);
      if (DEBUG)       System.out.println("String_Node_Str" + he);
      changeVertex(he.getTwin().getLeft(),vorig,vnew,hedges);
    }
    he=he.getNext();
    if (he == start) {
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * Change a vertex reference from one vertex to another for a face.
 * @param f The face
 * @param vorig The original vertex
 * @param vnew The new vertex
 * @param hedges List of hald
 */
private void changeVertex(Face f,Vertex vorig,Vertex vnew,List<Edge> hedges){
  if (DEBUG)   System.out.println("String_Node_Str" + f + "String_Node_Str"+ vorig.getID()+ "String_Node_Str"+ vnew.getID());
  HalfEdge he=f.getHe();
  HalfEdge start=he;
  while (he != null) {
    if (he.getHead() == vorig) {
      if (DEBUG)       System.out.print("String_Node_Str" + he);
      hedges.add(he.getEdge());
      HalfEdgeKey key=new HalfEdgeKey(he.getHead(),he.getTail());
      edgeMap.remove(key);
      he.setHead(vnew);
      key.setHead(he.getHead());
      key.setTail(he.getTail());
      edgeMap.put(key,he);
      if (DEBUG)       System.out.println("String_Node_Str" + he);
      changeVertex(he.getTwin().getLeft(),vorig,vnew,hedges);
    }
 else     if (he.getTail() == vorig) {
      if (DEBUG)       System.out.print("String_Node_Str" + he);
      hedges.add(he.getEdge());
      HalfEdgeKey key=new HalfEdgeKey(he.getHead(),he.getTail());
      edgeMap.remove(key);
      he.setTail(vnew);
      key.setHead(he.getHead());
      key.setTail(he.getTail());
      edgeMap.put(key,he);
      if (DEBUG)       System.out.println("String_Node_Str" + he);
      changeVertex(he.getTwin().getLeft(),vorig,vnew,hedges);
    }
    he=he.getNext();
    if (he == start) {
      break;
    }
  }
}
Program: 43059
Project: 43059
Buggy source:
public void allocate(TestCase testCase){
  int w=Integer.parseInt(testCase.getParam("String_Node_Str"));
  int h=Integer.parseInt(testCase.getParam("String_Node_Str"));
  int d=Integer.parseInt(testCase.getParam("String_Node_Str"));
  grid=new BlockArrayGrid(w,h,d,voxel_size,slice_height,new int[]{3,3,3},BlockType.Array);
  ((BlockArrayGrid)grid).clean();
}

Fixed version (ground truth):
public void allocate(TestCase testCase){
  int w=Integer.parseInt(testCase.getParam("String_Node_Str"));
  int h=Integer.parseInt(testCase.getParam("String_Node_Str"));
  int d=Integer.parseInt(testCase.getParam("String_Node_Str"));
  grid=new BlockArrayGrid(w,h,d,voxel_size,slice_height,new int[]{4,4,4},BlockType.Array);
}
Program: 43060
Project: 43060
Buggy source:
public void allocate(TestCase testCase){
  int w=Integer.parseInt(testCase.getParam("String_Node_Str"));
  int h=Integer.parseInt(testCase.getParam("String_Node_Str"));
  int d=Integer.parseInt(testCase.getParam("String_Node_Str"));
  grid=new BlockArrayGrid(w,h,d,voxel_size,slice_height,new int[]{3,3,3},BlockArrayGrid.BlockType.RLE);
  ((BlockArrayGrid)grid).clean();
}

Fixed version (ground truth):
public void allocate(TestCase testCase){
  int w=Integer.parseInt(testCase.getParam("String_Node_Str"));
  int h=Integer.parseInt(testCase.getParam("String_Node_Str"));
  int d=Integer.parseInt(testCase.getParam("String_Node_Str"));
  grid=new BlockArrayGrid(w,h,d,voxel_size,slice_height,new int[]{4,4,4},BlockArrayGrid.BlockType.RLE);
}
Program: 43061
Project: 43061
Buggy source:
/** 
 * Fill cells with the specified value along an axis.
 * @param val The value
 * @param result The cube to fill
 * @param axis
 */
private void fillCells(boolean val,boolean[] result,int[] origin,TunnelRegion.Axis axis,int[] min,int[] max){
  int start=0;
  int len=0;
switch (axis) {
case X:
    len=max[0] - min[0] + 1;
  start=min[0];
break;
case Y:
len=max[1] - min[1] + 1;
start=min[1];
break;
case Z:
len=max[2] - min[2] + 1;
start=min[2];
break;
}
for (int i=0; i < len; i++) {
result[start + i]=val;
}
}

Fixed version (ground truth):
/** 
 * Fill cells with the specified value along an axis.
 * @param val The value
 * @param result The cube to fill
 * @param axis
 */
private void fillCells(boolean val,boolean[] result,TunnelRegion.Axis axis,int[] min,int[] max){
  int start=0;
  int len=0;
switch (axis) {
case X:
    len=max[0] - min[0] + 1;
  start=min[0];
break;
case Y:
len=max[1] - min[1] + 1;
start=min[1];
break;
case Z:
len=max[2] - min[2] + 1;
start=min[2];
break;
}
for (int i=0; i < len; i++) {
result[start + i]=val;
}
}
Program: 43062
Project: 43062
Buggy source:
/** 
 * @param x The x translation applied before voxelization
 * @param y The y translation applied before voxelization
 * @param z The z translation applied before voxelization
 * @param rx The x rotation applied before voxelization
 * @param ry The y rotation applied before voxelization
 * @param rz The z rotation applied before voxelization
 * @param rangle The angle rotation applied before voxelization
 */
public InteriorFinderTriangleBased(GeometryData geom,float[] bounds,double x,double y,double z,double rx,double ry,double rz,double rangle,int material,int newMaterial){
  this.geom=geom;
  this.material=material;
  this.innerMaterial=newMaterial;
  this.bounds=bounds.clone();
  this.x=x;
  this.y=y;
  this.z=z;
  this.rx=rx;
  this.ry=ry;
  this.rz=rz;
  this.rangle=rangle;
  needTransform=true;
  origin=new int[3];
}

Fixed version (ground truth):
/** 
 * @param x The x translation applied before voxelization
 * @param y The y translation applied before voxelization
 * @param z The z translation applied before voxelization
 * @param rx The x rotation applied before voxelization
 * @param ry The y rotation applied before voxelization
 * @param rz The z rotation applied before voxelization
 * @param rangle The angle rotation applied before voxelization
 */
public InteriorFinderTriangleBased(GeometryData geom,float[] bounds,double x,double y,double z,double rx,double ry,double rz,double rangle,int material,int newMaterial){
  this.geom=geom;
  this.material=material;
  this.innerMaterial=newMaterial;
  this.bounds=bounds.clone();
  this.x=x;
  this.y=y;
  this.z=z;
  this.rx=rx;
  this.ry=ry;
  this.rz=rz;
  this.rangle=rangle;
  needTransform=true;
}
Program: 43067
Project: 43067
Buggy source:
/** 
 * Get the material of the voxel.
 * @param x The x world coordinate
 * @param y The y world coordinate
 * @param z The z world coordinate
 * @param The voxel material
 */
public int getMaterial(int x,int y,int z){
  int idx=y * sliceSize + x * depth + z;
  byte mat=(byte)(0x3FFF & data[idx]);
  return mat;
}

Fixed version (ground truth):
/** 
 * Get the material of the voxel.
 * @param x The x world coordinate
 * @param y The y world coordinate
 * @param z The z world coordinate
 * @param The voxel material
 */
public int getMaterial(int x,int y,int z){
  int idx=y * sliceSize + x * depth + z;
  short mat=(short)(0x3FFF & data[idx]);
  return mat;
}
Program: 43068
Project: 43068
Buggy source:
/** 
 * Set the value of a voxel.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param state The voxel state
 * @param material The material
 */
public void setData(int x,int y,int z,byte state,int material){
  int idx=y * sliceSize + x * depth + z;
  data[idx]=(short)(0xFFFF & (((short)state) << 14 | material));
}

Fixed version (ground truth):
/** 
 * Set the value of a voxel.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param state The voxel state
 * @param material The material
 */
public void setData(int x,int y,int z,byte state,int material){
  int idx=y * sliceSize + x * depth + z;
  data[idx]=(short)(0xFFFF & (((short)state) << 14 | (short)material));
  System.out.println("String_Node_Str" + data[idx]);
}
Program: 43070
Project: 43070
Buggy source:
/** 
 * A voxel of the class requested has been found. VoxelData classes may be reused so clone the object if you keep a copy.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param vd The voxel data
 */
public boolean foundInterruptible(int x,int y,int z,VoxelData start){
  if (canIgnore(x,y,z)) {
    return true;
  }
  int[] pos=new int[]{x,y,z};
  path.init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
  boolean escaped=true;
  while (path.next(pos)) {
    VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
    if (vd.getState() != Grid.OUTSIDE && vd.getMaterial() != material) {
      escaped=false;
      break;
    }
  }
  if (!escaped) {
    allEscaped=false;
    return false;
  }
  addIgnoredVoxels(x,y,z);
  return true;
}

Fixed version (ground truth):
/** 
 * A voxel of the class requested has been found. VoxelData classes may be reused so clone the object if you keep a copy.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param start The voxel data
 */
public boolean foundInterruptible(int x,int y,int z,VoxelData start){
  if (canIgnore(x,y,z)) {
    return true;
  }
  int[] pos=new int[]{x,y,z};
  path.init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
  boolean escaped=true;
  while (path.next(pos)) {
    VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
    if (vd.getState() != Grid.OUTSIDE && vd.getMaterial() != material) {
      escaped=false;
      break;
    }
  }
  if (!escaped) {
    allEscaped=false;
    return false;
  }
  addIgnoredVoxels(x,y,z);
  return true;
}
Program: 43071
Project: 43071
Buggy source:
/** 
 * A voxel of the class requested has been found. VoxelData classes may be reused so clone the object if you keep a copy.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param vd The voxel data
 */
public void found(int x,int y,int z,VoxelData start){
  if (!allEscaped || canIgnore(x,y,z)) {
    return;
  }
  int[] pos=new int[]{x,y,z};
  path.init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
  boolean escaped=true;
  while (path.next(pos)) {
    VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
    if (vd.getState() != Grid.OUTSIDE && vd.getMaterial() != material) {
      escaped=false;
      break;
    }
  }
  if (!escaped)   allEscaped=false;
  addIgnoredVoxels(x,y,z);
}

Fixed version (ground truth):
/** 
 * A voxel of the class requested has been found. VoxelData classes may be reused so clone the object if you keep a copy.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param start The voxel data
 */
public void found(int x,int y,int z,VoxelData start){
  if (!allEscaped || canIgnore(x,y,z)) {
    return;
  }
  int[] pos=new int[]{x,y,z};
  path.init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
  boolean escaped=true;
  while (path.next(pos)) {
    VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
    if (vd.getState() != Grid.OUTSIDE && vd.getMaterial() != material) {
      escaped=false;
      break;
    }
  }
  if (!escaped)   allEscaped=false;
  addIgnoredVoxels(x,y,z);
}
Program: 43072
Project: 43072
Buggy source:
boolean canIgnore(int x,int y,int z){
  if (ignoreSet.contains(new VoxelCoordinate(x,y,z))) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if a voxel can be ignored.
 * @param x The X coordinate of the voxel to check
 * @param y The Y coordinate of the voxel to check
 * @param z The Z coordinate of the voxel to check
 * @return True if the voxel can be ignored.
 */
private boolean canIgnore(int x,int y,int z){
  if (ignoreSet.contains(new VoxelCoordinate(x,y,z))) {
    return true;
  }
  return false;
}
Program: 43073
Project: 43073
Buggy source:
private void addIgnoredVoxels(int x,int y,int z){
  int[] pos=new int[]{x,y,z};
  Path invertedPath=path.invertPath();
  invertedPath.init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
  while (invertedPath.next(pos)) {
    VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
    if (vd.getState() == Grid.OUTSIDE)     break;
    ignoreSet.add(new VoxelCoordinate(pos[0],pos[1],pos[2]));
  }
}

Fixed version (ground truth):
/** 
 * Add voxels to be ignored for a given path as specified by ignoreSetIndex.
 * @param ignoreSetIndex The index of the path array to add voxels to ignore
 * @param x The X coordinate for the starting position
 * @param y The Y coordinate for the starting position
 * @param z The Z coordinate for the starting position
 */
private void addIgnoredVoxels(int x,int y,int z){
  int[] pos=new int[]{x,y,z};
  Path invertedPath=path.invertPath();
  invertedPath.init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
  while (invertedPath.next(pos)) {
    VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
    if (vd.getState() == Grid.OUTSIDE)     break;
    if (vd.getState() == Grid.EXTERIOR) {
      ignoreSet.add(new VoxelCoordinate(pos[0],pos[1],pos[2]));
    }
  }
}
Program: 43074
Project: 43074
Buggy source:
/** 
 * A voxel of the class requested has been found. VoxelData classes may be reused so clone the object if you keep a copy.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param vd The voxel data
 */
public boolean foundInterruptible(int x,int y,int z,VoxelData start){
  int[] pos=new int[]{x,y,z};
  boolean escaped;
  for (int i=0; i < paths.length; i++) {
    if (canIgnore(i,x,y,z)) {
      return true;
    }
    escaped=true;
    paths[i].init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
    while (paths[i].next(pos)) {
      VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
      if (vd.getState() != Grid.OUTSIDE && vd.getMaterial() != material) {
        escaped=false;
        break;
      }
    }
    if (!escaped) {
      allEscaped=false;
      return false;
    }
    addIgnoredVoxels(i,x,y,z);
    return true;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * A voxel of the class requested has been found. VoxelData classes may be reused so clone the object if you keep a copy.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param start The voxel data
 */
public boolean foundInterruptible(int x,int y,int z,VoxelData start){
  if (!canEscape())   return false;
  boolean[] badPaths=new boolean[paths.length];
  badPathCount=0;
  for (int i=0; i < paths.length; i++) {
    if (canIgnore(i,x,y,z)) {
      continue;
    }
    int[] pos=new int[]{x,y,z};
    paths[i].init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
    while (paths[i].next(pos)) {
      VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
      if (vd.getState() != Grid.OUTSIDE && vd.getMaterial() != material) {
        badPathCount++;
        badPaths[i]=true;
        break;
      }
    }
    addIgnoredVoxels(i,x,y,z);
  }
  processBadPaths(badPaths);
  return canEscape();
}
Program: 43075
Project: 43075
Buggy source:
/** 
 * A voxel of the class requested has been found. VoxelData classes may be reused so clone the object if you keep a copy.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param vd The voxel data
 */
public void found(int x,int y,int z,VoxelData start){
  if (!allEscaped) {
    return;
  }
  int[] pos=new int[]{x,y,z};
  boolean escaped;
  for (int i=0; i < paths.length; i++) {
    if (canIgnore(i,x,y,z)) {
      return;
    }
    escaped=true;
    paths[i].init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
    while (paths[i].next(pos)) {
      VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
      if (vd.getState() != Grid.OUTSIDE && vd.getMaterial() != material) {
        escaped=false;
        break;
      }
    }
    if (!escaped)     allEscaped=false;
    addIgnoredVoxels(i,x,y,z);
  }
}

Fixed version (ground truth):
/** 
 * A voxel of the class requested has been found. VoxelData classes may be reused so clone the object if you keep a copy.
 * @param x The x grid coordinate
 * @param y The y grid coordinate
 * @param z The z grid coordinate
 * @param start The voxel data
 */
public void found(int x,int y,int z,VoxelData start){
  boolean[] badPaths=new boolean[paths.length];
  badPathCount=0;
  for (int i=0; i < paths.length; i++) {
    if (canIgnore(i,x,y,z)) {
      continue;
    }
    int[] pos=new int[]{x,y,z};
    paths[i].init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
    while (paths[i].next(pos)) {
      VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
      if (vd.getState() != Grid.OUTSIDE && vd.getMaterial() != material) {
        badPathCount++;
        badPaths[i]=true;
        break;
      }
    }
    addIgnoredVoxels(i,x,y,z);
  }
  processBadPaths(badPaths);
}
Program: 43076
Project: 43076
Buggy source:
boolean canIgnore(int ignoreSetIndex,int x,int y,int z){
  if (ignoreSet[ignoreSetIndex].contains(new VoxelCoordinate(x,y,z))) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean canIgnore(int ignoreSetIndex,int x,int y,int z){
  if (ignoreSet[ignoreSetIndex].contains(new VoxelCoordinate(x,y,z))) {
    return true;
  }
  return false;
}
Program: 43077
Project: 43077
Buggy source:
private void addIgnoredVoxels(int ignoreSetIndex,int x,int y,int z){
  int[] pos=new int[]{x,y,z};
  Path invertedPath=paths[ignoreSetIndex].invertPath();
  invertedPath.init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
  while (invertedPath.next(pos)) {
    VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
    if (vd.getState() == Grid.OUTSIDE)     break;
    ignoreSet[ignoreSetIndex].add(new VoxelCoordinate(pos[0],pos[1],pos[2]));
  }
}

Fixed version (ground truth):
/** 
 * Add voxels to be ignored for a given path as specified by ignoreSetIndex.
 * @param ignoreSetIndex The index of the path array to add voxels to ignore
 * @param x The X coordinate for the starting position
 * @param y The Y coordinate for the starting position
 * @param z The Z coordinate for the starting position
 */
private void addIgnoredVoxels(int ignoreSetIndex,int x,int y,int z){
  int[] pos=new int[]{x,y,z};
  Path invertedPath=paths[ignoreSetIndex].invertPath();
  invertedPath.init(pos,grid.getWidth(),grid.getHeight(),grid.getDepth());
  while (invertedPath.next(pos)) {
    VoxelData vd=grid.getData(pos[0],pos[1],pos[2]);
    if (vd.getState() == Grid.OUTSIDE)     break;
    if (vd.getState() == Grid.EXTERIOR) {
      ignoreSet[ignoreSetIndex].add(new VoxelCoordinate(pos[0],pos[1],pos[2]));
    }
  }
}
Program: 43078
Project: 43078
Buggy source:
/** 
 * Can the specified material move along the path to exit the voxel space.  Any intersection with another materialID will cause failure.
 * @param grid The grid to use for grid src
 * @return true if it can move to an exit.
 */
public boolean execute(Grid grid){
  allEscaped=true;
  this.grid=grid;
  for (int i=0; i < ignoreSet.length; i++) {
    ignoreSet[i]=new HashSet<VoxelCoordinate>();
  }
  grid.findInterruptible(VoxelClasses.EXTERIOR,material,this);
  System.out.println("String_Node_Str" + allEscaped);
  return allEscaped;
}

Fixed version (ground truth):
/** 
 * Can the specified material move along the path to exit the voxel space.  Any intersection with another materialID will cause failure.
 * @param grid The grid to use for grid src
 * @return true if it can move to an exit.
 */
public boolean execute(Grid grid){
  this.grid=grid;
  for (int i=0; i < ignoreSet.length; i++) {
    ignoreSet[i]=new HashSet<VoxelCoordinate>();
  }
  grid.findInterruptible(VoxelClasses.EXTERIOR,material,this);
  System.out.println("String_Node_Str" + canEscape());
  return canEscape();
}
Program: 43082
Project: 43082
Buggy source:
public static void debug(DebugLevel level,String msg){
  if (Config.Debug)   if (Config.DebugLevel.compareTo(level) > 0)   Util.info("String_Node_Str" + msg);
}

Fixed version (ground truth):
public static void debug(DebugLevel level,String msg){
  if (Config.Debug)   if (Config.DebugLevel.compareTo(level) >= 0)   Util.info("String_Node_Str" + msg);
}
Program: 43084
Project: 43084
Buggy source:
@Override public boolean execute(){
  SearchParser parser=null;
  try {
    if (args.size() != 0 && !Util.isInteger(args.get(0)))     throw new IllegalArgumentException("String_Node_Str");
    int integer;
    if (args.size() > 0)     integer=Integer.parseInt(args.get(0));
 else     integer=Config.DefaultHereRadius;
    if ((integer > Config.MaxRadius && Config.MaxRadius > 0) || integer < 0)     throw new IllegalArgumentException("String_Node_Str");
    parser=new SearchParser(player,integer);
    for (    DataType type : DataType.values())     if (type.canHere())     parser.actions.add(type);
    if (args.size() > 1)     parser.players=args.get(1).split("String_Node_Str");
    for (    DataType type : DataType.values())     if (type.canHere())     parser.actions.add(type);
  }
 catch (  IllegalArgumentException e) {
    Util.sendMessage(sender,"String_Node_Str" + e.getMessage());
    return true;
  }
  new SearchQuery(new SearchCallback(session),parser,SearchDir.DESC);
  return true;
}

Fixed version (ground truth):
@Override public boolean execute(){
  SearchParser parser=null;
  try {
    if (args.size() != 0 && !Util.isInteger(args.get(0)))     throw new IllegalArgumentException("String_Node_Str");
    int integer;
    if (args.size() > 0)     integer=Integer.parseInt(args.get(0));
 else     integer=Config.DefaultHereRadius;
    if ((integer > Config.MaxRadius && Config.MaxRadius > 0) || integer < 0)     throw new IllegalArgumentException("String_Node_Str");
    parser=new SearchParser(player,integer);
    for (    DataType type : DataType.values())     if (type.canHere())     parser.actions.add(type);
    if (args.size() > 1)     for (    String p : args.get(1).split("String_Node_Str"))     parser.players.add(p);
    for (    DataType type : DataType.values())     if (type.canHere())     parser.actions.add(type);
  }
 catch (  IllegalArgumentException e) {
    Util.sendMessage(sender,"String_Node_Str" + e.getMessage());
    return true;
  }
  new SearchQuery(new SearchCallback(session),parser,SearchDir.DESC);
  return true;
}
Program: 43085
Project: 43085
Buggy source:
public void onBlockFromTo(BlockFromToEvent event){
  if (event.isCancelled())   return;
  List<Integer> fluidBlocks=Arrays.asList(0,27,28,31,32,37,38,39,40,50,51,55,59,66,69,70,75,76,78,93,94);
  Location loc=event.getToBlock().getLocation();
  BlockState from=event.getBlock().getState();
  BlockState to=event.getToBlock().getState();
  MaterialData data=from.getData();
  if (from.getTypeId() == 10 || from.getTypeId() == 11) {
  }
 else   if (from.getTypeId() == 8 || from.getTypeId() == 9) {
    if (fluidBlocks.contains(to.getTypeId())) {
      data.setData((byte)(from.getRawData() + 1));
      from.setData(data);
      DataManager.addEntry(new BlockChangeEntry("String_Node_Str",DataType.WATER_FLOW,loc,to,from));
    }
    BlockState lower=event.getToBlock().getRelative(BlockFace.DOWN).getState();
    if (lower.getTypeId() == 10 || lower.getTypeId() == 11) {
      from.setTypeId(lower.getData().getData() == 0 ? 49 : 4);
      loc.setY(loc.getY() - 1);
      DataManager.addEntry(new BlockChangeEntry("String_Node_Str",DataType.WATER_FLOW,loc,lower,from));
    }
  }
}

Fixed version (ground truth):
public void onBlockFromTo(BlockFromToEvent event){
  if (event.isCancelled())   return;
  List<Integer> fluidBlocks=Arrays.asList(0,27,28,31,32,37,38,39,40,50,51,55,59,66,69,70,75,76,78,93,94);
  Location loc=event.getToBlock().getLocation();
  BlockState from=event.getBlock().getState();
  BlockState to=event.getToBlock().getState();
  MaterialData data=from.getData();
  if (from.getTypeId() == 10 || from.getTypeId() == 11) {
    if (fluidBlocks.contains(to.getTypeId())) {
      data.setData((byte)(from.getRawData() + 1));
      from.setData(data);
    }
 else     if (to.getTypeId() == 8 || to.getTypeId() == 9) {
      from.setTypeId(event.getFace() == BlockFace.DOWN ? 10 : 4);
      data.setData((byte)0);
      from.setData(data);
    }
    DataManager.addEntry(new BlockChangeEntry("String_Node_Str",DataType.LAVA_FLOW,loc,to,from));
  }
 else   if (from.getTypeId() == 8 || from.getTypeId() == 9) {
    if (fluidBlocks.contains(to.getTypeId())) {
      data.setData((byte)(from.getRawData() + 1));
      from.setData(data);
      DataManager.addEntry(new BlockChangeEntry("String_Node_Str",DataType.WATER_FLOW,loc,to,from));
    }
    BlockState lower=event.getToBlock().getRelative(BlockFace.DOWN).getState();
    if (lower.getTypeId() == 10 || lower.getTypeId() == 11) {
      from.setTypeId(lower.getData().getData() == 0 ? 49 : 4);
      loc.setY(loc.getY() - 1);
      DataManager.addEntry(new BlockChangeEntry("String_Node_Str",DataType.WATER_FLOW,loc,lower,from));
    }
  }
}
Program: 43086
Project: 43086
Buggy source:
public boolean execute(){
  if (session.doingRollback()) {
    Util.sendMessage(sender,"String_Node_Str");
    return true;
  }
  SearchParser parser=null;
  try {
    parser=new SearchParser(player,args);
    parser.loc=null;
    if (parser.actions.size() > 0) {
      for (      DataType type : parser.actions)       if (!type.canRollback())       throw new IllegalArgumentException("String_Node_Str" + type.getConfigName());
    }
 else {
      for (      DataType type : DataType.values())       if (type.canRollback())       parser.actions.add(type);
    }
  }
 catch (  IllegalArgumentException e) {
    Util.sendMessage(sender,"String_Node_Str" + e.getMessage());
    return true;
  }
  new SearchQuery(new RebuildCallback(session),parser,SearchDir.DESC);
  return true;
}

Fixed version (ground truth):
public boolean execute(){
  if (session.doingRollback()) {
    Util.sendMessage(sender,"String_Node_Str");
    return true;
  }
  SearchParser parser=null;
  try {
    parser=new SearchParser(player,args);
    parser.loc=null;
    if (parser.actions.size() > 0) {
      for (      DataType type : parser.actions)       if (!type.canRollback())       throw new IllegalArgumentException("String_Node_Str" + type.getConfigName());
    }
 else {
      for (      DataType type : DataType.values())       if (type.canRollback())       parser.actions.add(type);
    }
  }
 catch (  IllegalArgumentException e) {
    Util.sendMessage(sender,"String_Node_Str" + e.getMessage());
    return true;
  }
  new SearchQuery(new RebuildCallback(session),parser,SearchDir.ASC);
  return true;
}
Program: 43087
Project: 43087
Buggy source:
@Override public boolean rebuild(Block block){
  if (data == null)   return false;
 else   BlockUtil.setBlockString(block,data);
  return true;
}

Fixed version (ground truth):
@Override public boolean rebuild(Block block){
  if (data == null)   return false;
 else   block.setTypeId(0);
  return true;
}
Program: 43088
Project: 43088
Buggy source:
public void onStructureGrow(StructureGrowEvent event){
  if (event.isCancelled())   return;
  DataType type=DataType.TREE_GROW;
  if (event.getSpecies().name().toLowerCase().contains("String_Node_Str"))   type=DataType.MUSHROOM_GROW;
  for (  BlockState block : event.getBlocks()) {
    Location loc=new Location(event.getWorld(),block.getX(),block.getY(),block.getZ());
    if (event.getPlayer() != null) {
      DataManager.addEntry(new BlockChangeEntry(event.getPlayer(),type,loc,"String_Node_Str",BlockUtil.getBlockString(block)));
    }
 else {
      DataManager.addEntry(new BlockChangeEntry("String_Node_Str",type,loc,"String_Node_Str",BlockUtil.getBlockString(block)));
    }
  }
}

Fixed version (ground truth):
public void onStructureGrow(StructureGrowEvent event){
  if (event.isCancelled())   return;
  DataType type=DataType.TREE_GROW;
  if (event.getSpecies().name().toLowerCase().contains("String_Node_Str"))   type=DataType.MUSHROOM_GROW;
  for (  BlockState block : event.getBlocks()) {
    if (block.getType() == Material.MYCEL || block.getType() == Material.DIRT || block.getType() == Material.GRASS)     continue;
    Location loc=new Location(event.getWorld(),block.getX(),block.getY(),block.getZ());
    if (event.getPlayer() != null) {
      DataManager.addEntry(new BlockChangeEntry(event.getPlayer(),type,loc,"String_Node_Str",BlockUtil.getBlockString(block)));
    }
 else {
      DataManager.addEntry(new BlockChangeEntry("String_Node_Str",type,loc,"String_Node_Str",BlockUtil.getBlockString(block)));
    }
  }
}