Program: 11031
Project: 11031
Buggy source:
protected void fixSkirts(DrawContext dc,RowColRectTile tile,Map<RectTileKey,RowColRectTile> tileMap){
  int row=tile.getRow();
  int column=tile.getColumn();
  int level=tile.getLevel();
  int sRow=row / 2;
  int sColumn=column / 2;
  int sLevel=level - 1;
  boolean topHalf=row % 2 == 0;
  boolean leftHalf=column % 2 == 0;
  RowColRectTile sLeft=leftHalf ? tileMap.get(new RectTileKey(sLevel,sRow,sColumn - 1)) : null;
  RowColRectTile sRight=!leftHalf ? tileMap.get(new RectTileKey(sLevel,sRow,sColumn + 1)) : null;
  RowColRectTile sTop=topHalf ? tileMap.get(new RectTileKey(sLevel,sRow - 1,sColumn)) : null;
  RowColRectTile sBottom=!topHalf ? tileMap.get(new RectTileKey(sLevel,sRow + 1,sColumn)) : null;
  RowColRectTile left=sLeft == null ? tileMap.get(new RectTileKey(level,row,column - 1)) : null;
  RowColRectTile top=sTop == null ? tileMap.get(new RectTileKey(level,row - 1,column)) : null;
  boolean anyRebuilt=tile.rebuiltVertices || (sLeft != null && sLeft.rebuiltVertices) || (sRight != null && sRight.rebuiltVertices)|| (sTop != null && sTop.rebuiltVertices)|| (sBottom != null && sBottom.rebuiltVertices)|| (left != null && left.rebuiltVertices)|| (top != null && top.rebuiltVertices);
  if (!anyRebuilt) {
    return;
  }
  FloatBuffer vertices=tile.getRi().getVertices();
  Vec4 refCenter=tile.getRi().getReferenceCenter();
  int density=tile.getDensity();
  int size=density + 3;
  if (sLeft != null) {
    FloatBuffer leftVertices=sLeft.getRi().getVertices();
    Vec4 leftRefCenter=sLeft.getRi().getReferenceCenter();
    int srcStart=topHalf ? 1 : density / 2 + 1;
    subdivideVerticesFromNeighboringSuperTile(leftVertices,vertices,leftRefCenter,refCenter,size,srcStart,size - 1,0,true);
  }
 else   if (left != null) {
    FloatBuffer leftVertices=left.getRi().getVertices();
    Vec4 leftRefCenter=left.getRi().getReferenceCenter();
    copyVerticesFromNeighboringTile(leftVertices,vertices,leftRefCenter,refCenter,size,size - 1,0,true);
  }
  if (sRight != null) {
    FloatBuffer rightVertices=sRight.getRi().getVertices();
    Vec4 rightRefCenter=sRight.getRi().getReferenceCenter();
    int srcStart=topHalf ? 1 : density / 2 + 1;
    subdivideVerticesFromNeighboringSuperTile(rightVertices,vertices,rightRefCenter,refCenter,size,srcStart,0,size - 1,true);
  }
  if (sTop != null) {
    FloatBuffer topVertices=sTop.getRi().getVertices();
    Vec4 topRefCenter=sTop.getRi().getReferenceCenter();
    int srcStart=leftHalf ? 1 : density / 2 + 1;
    subdivideVerticesFromNeighboringSuperTile(topVertices,vertices,topRefCenter,refCenter,size,srcStart,size - 1,0,false);
  }
 else   if (top != null) {
    FloatBuffer topVertices=top.getRi().getVertices();
    Vec4 topRefCenter=top.getRi().getReferenceCenter();
    copyVerticesFromNeighboringTile(topVertices,vertices,topRefCenter,refCenter,size,size - 1,0,false);
  }
  if (sBottom != null) {
    FloatBuffer bottomVertices=sBottom.getRi().getVertices();
    Vec4 bottomRefCenter=sBottom.getRi().getReferenceCenter();
    int srcStart=leftHalf ? 1 : density / 2 + 1;
    subdivideVerticesFromNeighboringSuperTile(bottomVertices,vertices,bottomRefCenter,refCenter,size,srcStart,0,size - 1,false);
  }
  if (dc.getGLRuntimeCapabilities().isUseVertexBufferObject()) {
    GL2 gl=dc.getGL();
    OGLStackHandler ogsh=new OGLStackHandler();
    try {
      ogsh.pushClientAttrib(gl,GL2.GL_CLIENT_VERTEX_ARRAY_BIT);
      int[] vboIds=(int[])dc.getGpuResourceCache().get(tile.getRi().getVboCacheKey());
      gl.glBindBuffer(GL2.GL_ARRAY_BUFFER,vboIds[0]);
      gl.glBufferData(GL2.GL_ARRAY_BUFFER,vertices.limit() * 4,vertices.rewind(),GL2.GL_DYNAMIC_DRAW);
    }
  finally {
      ogsh.pop(gl);
    }
  }
}

Fixed version (ground truth):
protected void fixSkirts(DrawContext dc,RowColRectTile tile,Map<RectTileKey,RowColRectTile> tileMap){
  int row=tile.getRow();
  int column=tile.getColumn();
  int level=tile.getLevel();
  int sRow=row / 2;
  int sColumn=column / 2;
  int sLevel=level - 1;
  boolean topHalf=row % 2 == 0;
  boolean leftHalf=column % 2 == 0;
  RowColRectTile sLeft=leftHalf ? tileMap.get(new RectTileKey(sLevel,sRow,sColumn - 1)) : null;
  RowColRectTile sRight=!leftHalf ? tileMap.get(new RectTileKey(sLevel,sRow,sColumn + 1)) : null;
  RowColRectTile sTop=topHalf ? tileMap.get(new RectTileKey(sLevel,sRow - 1,sColumn)) : null;
  RowColRectTile sBottom=!topHalf ? tileMap.get(new RectTileKey(sLevel,sRow + 1,sColumn)) : null;
  RowColRectTile left=sLeft == null ? tileMap.get(new RectTileKey(level,row,column - 1)) : null;
  RowColRectTile top=sTop == null ? tileMap.get(new RectTileKey(level,row - 1,column)) : null;
  boolean anyRebuilt=tile.rebuiltVertices || (sLeft != null && sLeft.rebuiltVertices) || (sRight != null && sRight.rebuiltVertices)|| (sTop != null && sTop.rebuiltVertices)|| (sBottom != null && sBottom.rebuiltVertices)|| (left != null && left.rebuiltVertices)|| (top != null && top.rebuiltVertices);
  if (!anyRebuilt) {
    return;
  }
  FloatBuffer vertices=tile.getRi().getVertices();
  Vec4 refCenter=tile.getRi().getReferenceCenter();
  int density=tile.getDensity();
  int size=density + 3;
  if (sLeft != null) {
    FloatBuffer leftVertices=sLeft.getRi().getVertices();
    Vec4 leftRefCenter=sLeft.getRi().getReferenceCenter();
    int srcStart=topHalf ? 1 : density / 2 + 1;
    subdivideVerticesFromNeighboringSuperTile(leftVertices,vertices,leftRefCenter,refCenter,size,srcStart,size - 1,0,true);
  }
 else   if (left != null) {
    FloatBuffer leftVertices=left.getRi().getVertices();
    Vec4 leftRefCenter=left.getRi().getReferenceCenter();
    copyVerticesFromNeighboringTile(leftVertices,vertices,leftRefCenter,refCenter,size,size - 1,0,true);
  }
  if (sRight != null) {
    FloatBuffer rightVertices=sRight.getRi().getVertices();
    Vec4 rightRefCenter=sRight.getRi().getReferenceCenter();
    int srcStart=topHalf ? 1 : density / 2 + 1;
    subdivideVerticesFromNeighboringSuperTile(rightVertices,vertices,rightRefCenter,refCenter,size,srcStart,0,size - 1,true);
  }
  if (sTop != null) {
    FloatBuffer topVertices=sTop.getRi().getVertices();
    Vec4 topRefCenter=sTop.getRi().getReferenceCenter();
    int srcStart=leftHalf ? 1 : density / 2 + 1;
    subdivideVerticesFromNeighboringSuperTile(topVertices,vertices,topRefCenter,refCenter,size,srcStart,size - 1,0,false);
  }
 else   if (top != null) {
    FloatBuffer topVertices=top.getRi().getVertices();
    Vec4 topRefCenter=top.getRi().getReferenceCenter();
    copyVerticesFromNeighboringTile(topVertices,vertices,topRefCenter,refCenter,size,size - 1,0,false);
  }
  if (sBottom != null) {
    FloatBuffer bottomVertices=sBottom.getRi().getVertices();
    Vec4 bottomRefCenter=sBottom.getRi().getReferenceCenter();
    int srcStart=leftHalf ? 1 : density / 2 + 1;
    subdivideVerticesFromNeighboringSuperTile(bottomVertices,vertices,bottomRefCenter,refCenter,size,srcStart,0,size - 1,false);
  }
  if (dc.getGLRuntimeCapabilities().isUseVertexBufferObject()) {
    GL2 gl=dc.getGL();
    OGLStackHandler ogsh=new OGLStackHandler();
    try {
      ogsh.pushClientAttrib(gl,GL2.GL_CLIENT_VERTEX_ARRAY_BIT);
      int[] vboIds=(int[])dc.getGpuResourceCache().get(tile.getRi().getVboCacheKey());
      if (vboIds != null) {
        gl.glBindBuffer(GL2.GL_ARRAY_BUFFER,vboIds[0]);
        gl.glBufferData(GL2.GL_ARRAY_BUFFER,vertices.limit() * 4,vertices.rewind(),GL2.GL_DYNAMIC_DRAW);
      }
    }
  finally {
      ogsh.pop(gl);
    }
  }
}