nus-yam/ex-repair huggingface dataset:
Program: 70824
Project: 70824
Buggy source:
protected GLShaderProgram getBasicLineProgram(GL3 gl,boolean hasNormals,boolean hasColors,boolean hasTextures){
  GLSLInfoBuilder builder=new GLSLInfoBuilder();
  builder.setNumLights(myProgManager.numLights());
  builder.setNumClipPlanes(myProgManager.numClipPlanes());
  if (!isSelecting()) {
    Shading shading=Shading.NONE;
    builder.setLighting(shading);
    builder.setVertexNormals(hasNormals);
    if (hasColors) {
      builder.setVertexColors(hasColors);
      builder.setVertexColorMixing(getVertexColorMixing());
    }
    if (hasTextures && isTextureMappingEnabled()) {
      if (myCurrentColorMapProps != null && myCurrentColorMapProps.isEnabled()) {
        builder.enableColorMap(true);
        builder.setVertexTextures(true);
        builder.setTextureColorMixing(myCurrentColorMapProps.getTextureColorMixing());
        builder.mixTextureColorDiffuse(myCurrentColorMapProps.getDiffuseColoring());
        builder.mixTextureColorSpecular(myCurrentColorMapProps.getSpecularColoring());
        builder.mixTextureColorEmission(myCurrentColorMapProps.getDiffuseColoring());
      }
    }
  }
  return myProgManager.getProgram(gl,builder.build());
}

Fixed version (ground truth):
protected GLShaderProgram getBasicLineProgram(GL3 gl,boolean hasNormals,boolean hasColors,boolean hasTextures){
  if (isSelecting()) {
    return myProgManager.getSelectionProgram(gl,RenderMode.LINES);
  }
  GLSLInfoBuilder builder=new GLSLInfoBuilder();
  builder.setNumLights(myProgManager.numLights());
  builder.setNumClipPlanes(myProgManager.numClipPlanes());
  if (!isSelecting()) {
    Shading shading=Shading.NONE;
    builder.setLighting(shading);
    builder.setVertexNormals(hasNormals);
    if (hasColors) {
      builder.setVertexColors(hasColors);
      builder.setVertexColorMixing(getVertexColorMixing());
    }
    if (hasTextures && isTextureMappingEnabled()) {
      if (myCurrentColorMapProps != null && myCurrentColorMapProps.isEnabled()) {
        builder.enableColorMap(true);
        builder.setVertexTextures(true);
        builder.setTextureColorMixing(myCurrentColorMapProps.getTextureColorMixing());
        builder.mixTextureColorDiffuse(myCurrentColorMapProps.getDiffuseColoring());
        builder.mixTextureColorSpecular(myCurrentColorMapProps.getSpecularColoring());
        builder.mixTextureColorEmission(myCurrentColorMapProps.getDiffuseColoring());
      }
    }
  }
  return myProgManager.getProgram(gl,builder.build());
}
Program: 70825
Project: 70825
Buggy source:
protected GLShaderProgram getBasicPointProgram(GL3 gl){
  GLSLInfoBuilder builder=new GLSLInfoBuilder();
  builder.setNumLights(myProgManager.numLights());
  builder.setNumClipPlanes(myProgManager.numClipPlanes());
  builder.setRoundPoints(true);
  if (!isSelecting()) {
    Shading shading=Shading.NONE;
    builder.setLighting(shading);
    if (isTextureMappingEnabled()) {
      if (myCurrentColorMapProps != null && myCurrentColorMapProps.isEnabled()) {
        builder.enableColorMap(true);
        builder.setVertexTextures(true);
        builder.setTextureColorMixing(myCurrentColorMapProps.getTextureColorMixing());
        builder.mixTextureColorDiffuse(myCurrentColorMapProps.getDiffuseColoring());
        builder.mixTextureColorSpecular(myCurrentColorMapProps.getSpecularColoring());
        builder.mixTextureColorEmission(myCurrentColorMapProps.getDiffuseColoring());
      }
    }
  }
  return myProgManager.getProgram(gl,builder.build());
}

Fixed version (ground truth):
protected GLShaderProgram getBasicPointProgram(GL3 gl){
  if (isSelecting()) {
    return myProgManager.getSelectionProgram(gl,RenderMode.POINTS);
  }
  GLSLInfoBuilder builder=new GLSLInfoBuilder();
  builder.setNumLights(myProgManager.numLights());
  builder.setNumClipPlanes(myProgManager.numClipPlanes());
  builder.setRoundPoints(true);
  if (!isSelecting()) {
    Shading shading=Shading.NONE;
    builder.setLighting(shading);
    if (isTextureMappingEnabled()) {
      if (myCurrentColorMapProps != null && myCurrentColorMapProps.isEnabled()) {
        builder.enableColorMap(true);
        builder.setVertexTextures(true);
        builder.setTextureColorMixing(myCurrentColorMapProps.getTextureColorMixing());
        builder.mixTextureColorDiffuse(myCurrentColorMapProps.getDiffuseColoring());
        builder.mixTextureColorSpecular(myCurrentColorMapProps.getSpecularColoring());
        builder.mixTextureColorEmission(myCurrentColorMapProps.getDiffuseColoring());
      }
    }
  }
  return myProgManager.getProgram(gl,builder.build());
}
Program: 70827
Project: 70827
Buggy source:
protected void maybeUpdateMaterials(GL3 gl){
  if (myCurrentMaterialModified && !selectEnabled) {
    if (mySelectedColorActive) {
      mySelectedColor[3]=myCurrentMaterial.getAlpha();
      myProgManager.setMaterials(gl,myCurrentMaterial,mySelectedColor,myCurrentMaterial,mySelectedColor);
    }
 else {
      myProgManager.setMaterials(gl,myCurrentMaterial,myCurrentMaterial.getDiffuse(),myCurrentMaterial,myBackColor);
    }
    myCurrentMaterialModified=false;
  }
}

Fixed version (ground truth):
protected void maybeUpdateMaterials(GL3 gl){
  if (myCurrentMaterialModified) {
    if (isSelecting()) {
      myProgManager.setMaterials(gl,myCurrentMaterial,mySelectingColor,myCurrentMaterial,mySelectingColor);
    }
 else {
      if (mySelectedColorActive) {
        mySelectedColor[3]=myCurrentMaterial.getAlpha();
        myProgManager.setMaterials(gl,myCurrentMaterial,mySelectedColor,myCurrentMaterial,mySelectedColor);
      }
 else {
        myProgManager.setMaterials(gl,myCurrentMaterial,myCurrentMaterial.getDiffuse(),myCurrentMaterial,myBackColor);
      }
    }
    myCurrentMaterialModified=false;
  }
}
Program: 70828
Project: 70828
Buggy source:
protected GLShaderProgram getBasicProgram(GL3 gl){
  GLSLInfoBuilder builder=new GLSLInfoBuilder();
  builder.setNumLights(myProgManager.numLights());
  builder.setNumClipPlanes(myProgManager.numClipPlanes());
  if (!isSelecting()) {
    Shading shading=Shading.NONE;
    builder.setLighting(shading);
    if (shading != Shading.NONE) {
      builder.setVertexNormals(true);
    }
    if (isTextureMappingEnabled()) {
      if (myCurrentColorMapProps != null && myCurrentColorMapProps.isEnabled()) {
        builder.enableColorMap(true);
        builder.setVertexTextures(true);
        builder.setTextureColorMixing(myCurrentColorMapProps.getTextureColorMixing());
        builder.mixTextureColorDiffuse(myCurrentColorMapProps.getDiffuseColoring());
        builder.mixTextureColorSpecular(myCurrentColorMapProps.getSpecularColoring());
        builder.mixTextureColorEmission(myCurrentColorMapProps.getDiffuseColoring());
      }
    }
  }
  return myProgManager.getProgram(gl,builder.build());
}

Fixed version (ground truth):
protected GLShaderProgram getBasicProgram(GL3 gl){
  if (isSelecting()) {
    return myProgManager.getSelectionProgram(gl,RenderMode.TRIANGLES);
  }
  GLSLInfoBuilder builder=new GLSLInfoBuilder();
  builder.setNumLights(myProgManager.numLights());
  builder.setNumClipPlanes(myProgManager.numClipPlanes());
  if (!isSelecting()) {
    Shading shading=Shading.NONE;
    builder.setLighting(shading);
    if (shading != Shading.NONE) {
      builder.setVertexNormals(true);
    }
    if (isTextureMappingEnabled()) {
      if (myCurrentColorMapProps != null && myCurrentColorMapProps.isEnabled()) {
        builder.enableColorMap(true);
        builder.setVertexTextures(true);
        builder.setTextureColorMixing(myCurrentColorMapProps.getTextureColorMixing());
        builder.mixTextureColorDiffuse(myCurrentColorMapProps.getDiffuseColoring());
        builder.mixTextureColorSpecular(myCurrentColorMapProps.getSpecularColoring());
        builder.mixTextureColorEmission(myCurrentColorMapProps.getDiffuseColoring());
      }
    }
  }
  return myProgManager.getProgram(gl,builder.build());
}
Program: 70830
Project: 70830
Buggy source:
@Override public void drawSolidArrow(float[] pnt0,float[] pnt1,double rad,boolean capped){
  if (rad < Double.MIN_NORMAL) {
    return;
  }
  int nslices=getSurfaceResolution();
  double dx=pnt1[0] - pnt0[0];
  double dy=pnt1[1] - pnt0[1];
  double dz=pnt1[2] - pnt0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  double arrowRad=3 * rad;
  double arrowLen=Math.min(2 * arrowRad,len / 2);
  double lenFrac=1 - arrowLen / len;
  float[] coordsMid=new float[]{pnt0[0] + (float)(lenFrac * dx),pnt0[1] + (float)(lenFrac * dy),pnt0[2] + (float)(lenFrac * dz)};
  pushModelMatrix();
  RigidTransform3d lineRot=getLineTransform(pnt0,pnt1);
  mulModelMatrix(lineRot);
  scaleModelMatrix(rad,rad,len - arrowLen);
  maybeUpdateState(gl);
  GLShaderProgram prog=getProgram(gl);
  prog.use(gl);
  GL3Object cylinder=myPrimitiveManager.getCylinder(gl,nslices,capped);
  cylinder.draw(gl);
  popModelMatrix();
  pushModelMatrix();
  lineRot.setTranslation(coordsMid[0],coordsMid[1],coordsMid[2]);
  mulModelMatrix(lineRot);
  scaleModelMatrix(arrowRad,arrowRad,arrowLen);
  maybeUpdateState(gl);
  GL3Object cone=myPrimitiveManager.getCone(gl,nslices,capped);
  cone.draw(gl);
  gl.glUseProgram(0);
  popModelMatrix();
}

Fixed version (ground truth):
@Override public void drawSolidArrow(float[] pnt0,float[] pnt1,double rad,boolean capped){
  if (rad < Double.MIN_NORMAL) {
    return;
  }
  int nslices=getSurfaceResolution();
  double dx=pnt1[0] - pnt0[0];
  double dy=pnt1[1] - pnt0[1];
  double dz=pnt1[2] - pnt0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  double arrowRad=3 * rad;
  double arrowLen=Math.min(2 * arrowRad,len / 2);
  double lenFrac=1 - arrowLen / len;
  float[] coordsMid=new float[]{pnt0[0] + (float)(lenFrac * dx),pnt0[1] + (float)(lenFrac * dy),pnt0[2] + (float)(lenFrac * dz)};
  pushModelMatrix();
  RigidTransform3d lineRot=getLineTransform(pnt0,pnt1);
  mulModelMatrix(lineRot);
  scaleModelMatrix(rad,rad,len - arrowLen);
  maybeUpdateState(gl);
  GLShaderProgram prog=getProgram(gl);
  prog.use(gl);
  GL3Object cylinder=myPrimitiveManager.getCylinder(gl,nslices,capped);
  cylinder.draw(gl);
  popModelMatrix();
  pushModelMatrix();
  lineRot.setTranslation(coordsMid[0],coordsMid[1],coordsMid[2]);
  mulModelMatrix(lineRot);
  scaleModelMatrix(arrowRad,arrowRad,arrowLen);
  maybeUpdateState(gl);
  GL3Object cone=myPrimitiveManager.getCone(gl,nslices,capped);
  cone.draw(gl);
  popModelMatrix();
}
Program: 70833
Project: 70833
Buggy source:
protected void drawEdges(Renderer renderer,RenderObject r,RenderProps props,int group){
  if (r.numLines(group) > 0) {
    r.lineGroup(group);
    int width=props.getLineWidth();
    if (width > 0) {
      boolean selected=(group == SEL_GRP);
      Shading savedShading=renderer.setShading(Shading.NONE);
      renderer.setLineColoring(props,selected);
      renderer.drawLines(r,LineStyle.LINE,width);
      renderer.setShading(savedShading);
    }
  }
}

Fixed version (ground truth):
protected void drawEdges(Renderer renderer,RenderObject r,RenderProps props,int group){
  if (r.numLines(group) > 0) {
    int width=props.getLineWidth();
    if (width > 0) {
      boolean selected=(group == SEL_GRP);
      Shading savedShading=renderer.setShading(Shading.NONE);
      renderer.setLineColoring(props,selected);
      renderer.drawLines(r,group,LineStyle.LINE,width);
      renderer.setShading(savedShading);
    }
  }
}
Program: 70834
Project: 70834
Buggy source:
public void render(Renderer renderer,int flags){
  RenderProps props=myRenderProps;
  if (renderer.isSelecting()) {
    PointStyle style=props.getPointStyle();
    if (style == PointStyle.POINT) {
      int size=props.getPointSize();
      if (size > 0) {
        renderer.setPointSize(size);
      }
 else {
        return;
      }
    }
    for (int i=0; i < size(); i++) {
      Point pnt=get(i);
      if (pnt.getRenderProps() == null && renderer.isSelectable(pnt)) {
        float[] v0=pnt.myRenderCoords;
        renderer.beginSelectionQuery(i);
switch (style) {
case POINT:
{
            renderer.drawPoint(v0);
            break;
          }
case SPHERE:
{
          renderer.drawSphere(v0,props.getPointRadius());
          break;
        }
    }
    renderer.endSelectionQuery();
  }
}
if (style == PointStyle.POINT) {
  renderer.setPointSize(1);
}
}
 else if (myRob != null) {
int numReg=myRob.numPoints(REG_GRP);
int numSel=myRob.numPoints(SEL_GRP);
if (numReg > 0) {
  drawPoints(renderer,REG_GRP,props,false);
}
if (numSel > 0) {
  drawPoints(renderer,SEL_GRP,props,true);
}
}
}

Fixed version (ground truth):
public void render(Renderer renderer,int flags){
  RenderProps props=myRenderProps;
  if (renderer.isSelecting()) {
    PointStyle style=props.getPointStyle();
    if (style == PointStyle.POINT) {
      int size=props.getPointSize();
      if (size > 0) {
        renderer.setPointSize(size);
      }
 else {
        return;
      }
    }
    for (int i=0; i < size(); i++) {
      Point pnt=get(i);
      if (pnt.getRenderProps() == null && renderer.isSelectable(pnt)) {
        float[] v0=pnt.myRenderCoords;
        renderer.beginSelectionQuery(i);
switch (style) {
case POINT:
{
            renderer.drawPoint(v0);
            break;
          }
case SPHERE:
{
          renderer.drawSphere(v0,props.getPointRadius());
          break;
        }
    }
    renderer.endSelectionQuery();
  }
}
if (style == PointStyle.POINT) {
  renderer.setPointSize(1);
}
}
 else if (myRob != null) {
int numReg=myRob.numPoints(REG_GRP);
int numSel=myRob.numPoints(SEL_GRP);
if (numSel > 0) {
  drawPoints(renderer,SEL_GRP,props,true);
}
if (numReg > 0) {
  drawPoints(renderer,REG_GRP,props,false);
}
}
}
Program: 70836
Project: 70836
Buggy source:
@Override public void drawPoints(RenderObject robj,int gidx,PointStyle style,double rad){
switch (style) {
case POINT:
{
      float fold=getPointSize();
      float frad=(float)rad;
      boolean changed=false;
      if (fold != frad) {
        setPointSize(frad);
        changed=true;
      }
      drawPoints(robj,gidx);
      if (changed) {
        setPointSize(fold);
      }
      break;
    }
case SPHERE:
  drawSpheres(robj,gidx,rad);
break;
}
}

Fixed version (ground truth):
@Override public void drawPoints(RenderObject robj,int gidx,PointStyle style,double rad){
switch (style) {
case POINT:
{
      float fold=getPointSize(gl);
      float frad=(float)rad;
      boolean changed=false;
      if (fold != frad) {
        setPointSize(gl,frad);
        changed=true;
      }
      drawPoints(robj,gidx);
      if (changed) {
        setPointSize(gl,fold);
      }
      break;
    }
case SPHERE:
  drawSpheres(robj,gidx,rad);
break;
}
}
Program: 70838
Project: 70838
Buggy source:
@Override public void drawLines(RenderObject robj,int gidx,LineStyle style,double rad){
  maybeUpdateState(gl);
switch (style) {
case LINE:
{
      float fold=getLineWidth();
      float frad=(float)rad;
      boolean changeWidth=false;
      if (fold != frad) {
        setLineWidth(frad);
        changeWidth=true;
      }
      drawLines(robj,gidx);
      if (changeWidth) {
        setLineWidth(fold);
      }
      break;
    }
case CYLINDER:
case SPINDLE:
case SOLID_ARROW:
  drawSolidLines(robj,gidx,style,(float)rad);
break;
}
}

Fixed version (ground truth):
@Override public void drawLines(RenderObject robj,int gidx,LineStyle style,double rad){
  maybeUpdateState(gl);
switch (style) {
case LINE:
{
      float fold=getLineWidth(gl);
      float frad=(float)rad;
      boolean changeWidth=false;
      if (fold != frad) {
        setLineWidth(gl,frad);
        changeWidth=true;
      }
      drawLines(robj,gidx);
      if (changeWidth) {
        setLineWidth(gl,fold);
      }
      break;
    }
case CYLINDER:
case SPINDLE:
case SOLID_ARROW:
  drawSolidLines(robj,gidx,style,(float)rad);
break;
}
}
Program: 70839
Project: 70839
Buggy source:
public void drawLines(GL3 gl,int mode,int gidx){
  int vstart=lineGroupOffsets[gidx];
  int vcount=lineGroupOffsets[gidx + 1] - vstart;
  gl.glDrawArrays(mode,vstart,2 * vcount);
}

Fixed version (ground truth):
public void drawLines(GL3 gl,int mode,int gidx){
  int vstart=lineGroupOffsets[gidx];
  int vcount=lineGroupOffsets[gidx + 1] - vstart;
  gl.glDrawArrays(mode,2 * vstart,2 * vcount);
}
Program: 70840
Project: 70840
Buggy source:
@Override public void drawPoints(RenderObject robj,int gidx,PointStyle style,double rad){
  GL3RenderObjectPoints gro=myRenderObjectManager.getPoints(gl,robj);
  maybeUpdateState(gl);
switch (style) {
case POINT:
{
      float fold=getPointSize();
      float frad=(float)rad;
      boolean changed=false;
      if (fold != frad) {
        setPointSize(frad);
        changed=true;
      }
      updateProgram(gl,RenderingMode.POINTS,robj.hasNormals(),robj.hasColors(),robj.hasTextureCoords());
      gro.drawPointGroup(gl,GL.GL_POINTS,gidx);
      if (changed) {
        setPointSize(fold);
      }
      break;
    }
case CUBE:
case SPHERE:
{
    GL3Object sphere=myPrimitiveManager.getSphere(gl,mySurfaceResolution,mySurfaceResolution / 2);
    gro.setRadius(gl,(float)rad);
    updateProgram(gl,RenderingMode.INSTANCED_POINTS,robj.hasNormals(),robj.hasColors(),robj.hasTextureCoords());
    gro.drawInstancedPointGroup(gl,sphere,gidx);
    break;
  }
}
}

Fixed version (ground truth):
@Override public void drawPoints(RenderObject robj,int gidx,PointStyle style,double rad){
  GL3RenderObjectPoints gro=myRenderObjectManager.getPoints(gl,robj);
  maybeUpdateState(gl);
switch (style) {
case POINT:
{
      float fold=getPointSize(gl);
      float frad=(float)rad;
      boolean changed=false;
      if (fold != frad) {
        setPointSize(gl,frad);
        changed=true;
      }
      updateProgram(gl,RenderingMode.POINTS,robj.hasNormals(),robj.hasColors(),robj.hasTextureCoords());
      gro.drawPointGroup(gl,GL.GL_POINTS,gidx);
      if (changed) {
        setPointSize(gl,fold);
      }
      break;
    }
case SPHERE:
{
    GL3Object sphere=myPrimitiveManager.getSphere(gl,mySurfaceResolution,mySurfaceResolution / 2);
    gro.setRadius(gl,(float)rad);
    updateProgram(gl,RenderingMode.INSTANCED_POINTS,robj.hasNormals(),robj.hasColors(),robj.hasTextureCoords());
    gro.drawInstancedPointGroup(gl,sphere,gidx);
    break;
  }
}
}
Program: 70844
Project: 70844
Buggy source:
public void setupSelection(GLAutoDrawable drawable){
  GL2GL3 gl=(GL2GL3)(myViewer.getGL());
  myGl=gl;
  myTotalMaxQ=myViewer.numSelectionQueriesNeeded();
  myCurrentMaxQ=myTotalMaxQ;
  myCurrentIdx=-1;
  myIdxBase=0;
  myMaxQStack.clear();
  myIdxBaseStack.clear();
  savedViewport=myViewer.getViewport();
  myViewW=(int)Math.ceil(myRectW);
  myViewH=(int)Math.ceil(myRectH);
  myViewer.setPickMatrix((float)(myRectX),(float)(savedViewport[3] - myRectY),(float)myRectW,(float)myRectH,savedViewport);
  myViewer.setViewport(0,0,myViewW,myViewH);
  myViewer.setLightingEnabled(false);
  myViewer.getBackgroundColor(savedBackgroundColor);
  myViewer.setBackgroundColor(0,0,0,0);
  savedBlend=gl.glIsEnabled(GL.GL_BLEND);
  if (savedBlend) {
    gl.glDisable(GL.GL_BLEND);
  }
  savedMulti=gl.glIsEnabled(GL.GL_MULTISAMPLE);
  if (savedMulti) {
    gl.glDisable(GL.GL_MULTISAMPLE);
  }
  myViewer.setColor(0,0,0,0);
  fbo=new FrameBufferObject(myViewW,myViewH,1);
  fbo.activate(gl);
}

Fixed version (ground truth):
public void setupSelection(GLAutoDrawable drawable){
  GL2GL3 gl=(GL2GL3)(drawable.getGL());
  myGl=gl;
  myTotalMaxQ=myViewer.numSelectionQueriesNeeded();
  myCurrentMaxQ=myTotalMaxQ;
  myCurrentIdx=-1;
  myIdxBase=0;
  myMaxQStack.clear();
  myIdxBaseStack.clear();
  savedViewport=myViewer.getViewport(gl);
  myViewW=(int)Math.ceil(myRectW);
  myViewH=(int)Math.ceil(myRectH);
  myViewer.setPickMatrix((float)(myRectX),(float)(savedViewport[3] - myRectY),(float)myRectW,(float)myRectH,savedViewport);
  myViewer.setViewport(gl,0,0,myViewW,myViewH);
  myViewer.setLightingEnabled(false);
  myViewer.getBackgroundColor(savedBackgroundColor);
  myViewer.setBackgroundColor(0,0,0,0);
  savedBlend=gl.glIsEnabled(GL.GL_BLEND);
  if (savedBlend) {
    gl.glDisable(GL.GL_BLEND);
  }
  savedMulti=gl.glIsEnabled(GL.GL_MULTISAMPLE);
  if (savedMulti) {
    gl.glDisable(GL.GL_MULTISAMPLE);
  }
  myViewer.setColor(0,0,0,0);
  fbo=new FrameBufferObject(myViewW,myViewH,1);
  fbo.activate(gl);
}
Program: 70846
Project: 70846
Buggy source:
public void setupSelection(GLAutoDrawable drawable){
  if (!(myViewer instanceof GLViewer)) {
    return;
  }
  GLViewer viewer=(GLViewer)myViewer;
  GL2GL3 gl=(GL2GL3)viewer.getGL();
  myGl=gl;
  myTotalMaxQ=myViewer.numSelectionQueriesNeeded();
  if (myTotalMaxQ == 0) {
    return;
  }
  myCurrentMaxQ=myTotalMaxQ;
  myCurrentIdx=-1;
  myIdxBase=0;
  myMaxQStack.clear();
  myIdxBaseStack.clear();
  myQueries=new int[myTotalMaxQ];
  myQueryWasUsed=new boolean[myTotalMaxQ];
  gl.glGenQueries(myTotalMaxQ,myQueries,0);
  mySavedViewport=viewer.getViewport();
  if (changeViewport) {
    viewer.setPickMatrix((float)myRectX,(float)(mySavedViewport[3] - myRectY),(float)myRectW,(float)myRectH,mySavedViewport);
    viewer.setViewport(0,0,(int)Math.ceil(myRectW),(int)Math.ceil(myRectH));
  }
 else {
    viewer.setPickMatrix((float)myRectX,(float)(mySavedViewport[3] - myRectY),(float)myRectW,(float)myRectH,mySavedViewport);
  }
  Vector2d zRange=new Vector2d();
  myViewer.getZRange(zRange);
  myViewer.setViewVolume(zRange.x,zRange.y);
  viewer.setLightingEnabled(false);
  viewer.setColorEnabled(false);
  viewer.setDepthEnabled(false);
}

Fixed version (ground truth):
public void setupSelection(GLAutoDrawable drawable){
  if (!(myViewer instanceof GLViewer)) {
    return;
  }
  GLViewer viewer=(GLViewer)myViewer;
  GL2GL3 gl=(GL2GL3)drawable.getGL();
  myGl=gl;
  myTotalMaxQ=myViewer.numSelectionQueriesNeeded();
  if (myTotalMaxQ == 0) {
    return;
  }
  myCurrentMaxQ=myTotalMaxQ;
  myCurrentIdx=-1;
  myIdxBase=0;
  myMaxQStack.clear();
  myIdxBaseStack.clear();
  myQueries=new int[myTotalMaxQ];
  myQueryWasUsed=new boolean[myTotalMaxQ];
  gl.glGenQueries(myTotalMaxQ,myQueries,0);
  mySavedViewport=viewer.getViewport(gl);
  if (changeViewport) {
    viewer.setPickMatrix((float)myRectX,(float)(mySavedViewport[3] - myRectY),(float)myRectW,(float)myRectH,mySavedViewport);
    viewer.setViewport(gl,0,0,(int)Math.ceil(myRectW),(int)Math.ceil(myRectH));
  }
 else {
    viewer.setPickMatrix((float)myRectX,(float)(mySavedViewport[3] - myRectY),(float)myRectW,(float)myRectH,mySavedViewport);
  }
  Vector2d zRange=new Vector2d();
  myViewer.getZRange(zRange);
  myViewer.setViewVolume(zRange.x,zRange.y);
  viewer.setLightingEnabled(false);
  viewer.setColorEnabled(false);
  viewer.setDepthEnabled(false);
}
Program: 70847
Project: 70847
Buggy source:
@Override public void drawAxes(RigidTransform3d X,double[] len,int lineWidth,boolean selected){
  GLSupport.checkAndPrintGLError(gl);
  double lx=len[0];
  double ly=len[1];
  double lz=len[2];
  boolean drawx=true;
  boolean drawy=true;
  boolean drawz=true;
  if (X == null) {
    X=RigidTransform3d.IDENTITY;
  }
  if (lx == 0) {
    lx=1;
    drawx=false;
  }
  if (ly == 0) {
    ly=1;
    drawy=false;
  }
  if (lz == 0) {
    lz=1;
    drawz=false;
  }
  pushModelMatrix();
  mulModelMatrix(X);
  scaleModelMatrix(lx,ly,lz);
  updateMatrices(gl);
  gl.glLineWidth(lineWidth);
  GL3Object axes=myGLResources.getAxes(gl,drawx,drawy,drawz);
  if (selectEnabled || selected) {
    axes.draw(gl,getBasicProgram(gl));
  }
 else {
    axes.draw(gl,getColorProgram(gl,Shading.NONE,ColorInterpolation.RGB));
  }
  gl.glLineWidth(1);
  popModelMatrix();
}

Fixed version (ground truth):
@Override public void drawAxes(RigidTransform3d X,double[] len,int lineWidth,boolean selected){
  GLSupport.checkAndPrintGLError(gl);
  double lx=len[0];
  double ly=len[1];
  double lz=len[2];
  boolean drawx=true;
  boolean drawy=true;
  boolean drawz=true;
  if (X == null) {
    X=RigidTransform3d.IDENTITY;
  }
  if (lx == 0) {
    lx=1;
    drawx=false;
  }
  if (ly == 0) {
    ly=1;
    drawy=false;
  }
  if (lz == 0) {
    lz=1;
    drawz=false;
  }
  pushModelMatrix();
  mulModelMatrix(X);
  scaleModelMatrix(lx,ly,lz);
  maybeUpdateState(gl);
  gl.glLineWidth(lineWidth);
  GL3Object axes=myGLResources.getAxes(gl,drawx,drawy,drawz);
  if (selectEnabled || selected) {
    axes.draw(gl,getBasicProgram(gl));
  }
 else {
    axes.draw(gl,getColorProgram(gl,Shading.NONE,ColorInterpolation.RGB));
  }
  gl.glLineWidth(1);
  popModelMatrix();
}
Program: 70848
Project: 70848
Buggy source:
public void drawCone(RenderProps props,float[] coords0,float[] coords1,double r,boolean capped){
  pushModelMatrix();
  RigidTransform3d lineRot=getLineTransform(coords0,coords1);
  double dx=coords1[0] - coords0[0];
  double dy=coords1[1] - coords0[1];
  double dz=coords1[2] - coords0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  mulModelMatrix(lineRot);
  scaleModelMatrix(r,r,len);
  updateMatrices(gl);
  int nslices=props.getPointSlices();
  GL3Object cone=myGLResources.getCone(gl,nslices,capped);
  cone.draw(gl,getRegularProgram(gl));
  popModelMatrix();
}

Fixed version (ground truth):
public void drawCone(RenderProps props,float[] coords0,float[] coords1,double r,boolean capped){
  pushModelMatrix();
  RigidTransform3d lineRot=getLineTransform(coords0,coords1);
  double dx=coords1[0] - coords0[0];
  double dy=coords1[1] - coords0[1];
  double dz=coords1[2] - coords0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  mulModelMatrix(lineRot);
  scaleModelMatrix(r,r,len);
  maybeUpdateState(gl);
  int nslices=props.getPointSlices();
  GL3Object cone=myGLResources.getCone(gl,nslices,capped);
  cone.draw(gl,getRegularProgram(gl));
  popModelMatrix();
}
Program: 70849
Project: 70849
Buggy source:
@Override public void drawTaperedEllipsoid(RenderProps props,float[] coords0,float[] coords1){
  double r=props.getLineRadius();
  if (r < Double.MIN_NORMAL) {
    return;
  }
  pushModelMatrix();
  double dx=coords1[0] - coords0[0];
  double dy=coords1[1] - coords0[1];
  double dz=coords1[2] - coords0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  RigidTransform3d lineRot=getLineTransform(coords0,coords1);
  mulModelMatrix(lineRot);
  scaleModelMatrix(r,r,len);
  updateMatrices(gl);
  int nslices=props.getPointSlices();
  GL3Object ellipsoid=myGLResources.getTaperedEllipsoid(gl,nslices,(int)Math.ceil(nslices / 2));
  ellipsoid.draw(gl,getRegularProgram(gl));
  popModelMatrix();
}

Fixed version (ground truth):
@Override public void drawTaperedEllipsoid(RenderProps props,float[] coords0,float[] coords1){
  double r=props.getLineRadius();
  if (r < Double.MIN_NORMAL) {
    return;
  }
  pushModelMatrix();
  double dx=coords1[0] - coords0[0];
  double dy=coords1[1] - coords0[1];
  double dz=coords1[2] - coords0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  RigidTransform3d lineRot=getLineTransform(coords0,coords1);
  mulModelMatrix(lineRot);
  scaleModelMatrix(r,r,len);
  maybeUpdateState(gl);
  int nslices=props.getPointSlices();
  GL3Object ellipsoid=myGLResources.getTaperedEllipsoid(gl,nslices,(int)Math.ceil(nslices / 2));
  ellipsoid.draw(gl,getRegularProgram(gl));
  popModelMatrix();
}
Program: 70850
Project: 70850
Buggy source:
@Override public void drawSphere(RenderProps props,float[] coords,double r){
  if (r < Double.MIN_NORMAL) {
    return;
  }
  pushModelMatrix();
  translateModelMatrix(coords[0],coords[1],coords[2]);
  scaleModelMatrix(r);
  updateMatrices(gl);
  int nslices=props.getPointSlices();
  GL3Object sphere=myGLResources.getSphere(gl,nslices,(int)Math.ceil(nslices / 2));
  sphere.draw(gl,getRegularProgram(gl));
  popModelMatrix();
}

Fixed version (ground truth):
@Override public void drawSphere(RenderProps props,float[] coords,double r){
  if (r < Double.MIN_NORMAL) {
    return;
  }
  pushModelMatrix();
  translateModelMatrix(coords[0],coords[1],coords[2]);
  scaleModelMatrix(r);
  maybeUpdateState(gl);
  int nslices=props.getPointSlices();
  GL3Object sphere=myGLResources.getSphere(gl,nslices,(int)Math.ceil(nslices / 2));
  sphere.draw(gl,getRegularProgram(gl));
  popModelMatrix();
}
Program: 70851
Project: 70851
Buggy source:
@Override public void drawCylinder(RenderProps props,float[] coords0,float[] coords1,double r,boolean capped){
  pushModelMatrix();
  RigidTransform3d lineRot=getLineTransform(coords0,coords1);
  mulModelMatrix(lineRot);
  double dx=coords1[0] - coords0[0];
  double dy=coords1[1] - coords0[1];
  double dz=coords1[2] - coords0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  scaleModelMatrix(r,r,len);
  updateMatrices(gl);
  int nslices=props.getPointSlices();
  GL3Object cylinder=myGLResources.getCylinder(gl,nslices,capped);
  cylinder.draw(gl,getRegularProgram(gl));
  popModelMatrix();
}

Fixed version (ground truth):
@Override public void drawCylinder(RenderProps props,float[] coords0,float[] coords1,double r,boolean capped){
  pushModelMatrix();
  RigidTransform3d lineRot=getLineTransform(coords0,coords1);
  mulModelMatrix(lineRot);
  double dx=coords1[0] - coords0[0];
  double dy=coords1[1] - coords0[1];
  double dz=coords1[2] - coords0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  scaleModelMatrix(r,r,len);
  maybeUpdateState(gl);
  int nslices=props.getPointSlices();
  GL3Object cylinder=myGLResources.getCylinder(gl,nslices,capped);
  cylinder.draw(gl,getRegularProgram(gl));
  popModelMatrix();
}
Program: 70852
Project: 70852
Buggy source:
@Override public void drawSolidArrow(RenderProps props,float[] coords0,float[] coords1,boolean capped){
  double r=props.getLineRadius();
  if (r < Double.MIN_NORMAL) {
    return;
  }
  int nslices=props.getPointSlices();
  double dx=coords1[0] - coords0[0];
  double dy=coords1[1] - coords0[1];
  double dz=coords1[2] - coords0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  double arrowRad=3 * props.getLineRadius();
  double arrowLen=Math.min(2 * arrowRad,len / 2);
  double lenFrac=1 - arrowLen / len;
  float[] coordsMid=new float[]{coords0[0] + (float)(lenFrac * dx),coords0[1] + (float)(lenFrac * dy),coords0[2] + (float)(lenFrac * dz)};
  pushModelMatrix();
  RigidTransform3d lineRot=getLineTransform(coords0,coords1);
  mulModelMatrix(lineRot);
  scaleModelMatrix(r,r,len - arrowLen);
  updateMatrices(gl);
  GL3Object cylinder=myGLResources.getCylinder(gl,nslices,capped);
  cylinder.draw(gl,getRegularProgram(gl));
  popModelMatrix();
  pushModelMatrix();
  lineRot.setTranslation(coordsMid[0],coordsMid[1],coordsMid[2]);
  mulModelMatrix(lineRot);
  scaleModelMatrix(arrowRad,arrowRad,arrowLen);
  updateMatrices(gl);
  GL3Object cone=myGLResources.getCone(gl,nslices,capped);
  cone.draw(gl,getRegularProgram(gl));
  gl.glUseProgram(0);
  popModelMatrix();
}

Fixed version (ground truth):
@Override public void drawSolidArrow(RenderProps props,float[] coords0,float[] coords1,boolean capped){
  double r=props.getLineRadius();
  if (r < Double.MIN_NORMAL) {
    return;
  }
  int nslices=props.getPointSlices();
  double dx=coords1[0] - coords0[0];
  double dy=coords1[1] - coords0[1];
  double dz=coords1[2] - coords0[2];
  double len=Math.sqrt(dx * dx + dy * dy + dz * dz);
  double arrowRad=3 * props.getLineRadius();
  double arrowLen=Math.min(2 * arrowRad,len / 2);
  double lenFrac=1 - arrowLen / len;
  float[] coordsMid=new float[]{coords0[0] + (float)(lenFrac * dx),coords0[1] + (float)(lenFrac * dy),coords0[2] + (float)(lenFrac * dz)};
  pushModelMatrix();
  RigidTransform3d lineRot=getLineTransform(coords0,coords1);
  mulModelMatrix(lineRot);
  scaleModelMatrix(r,r,len - arrowLen);
  maybeUpdateState(gl);
  GL3Object cylinder=myGLResources.getCylinder(gl,nslices,capped);
  cylinder.draw(gl,getRegularProgram(gl));
  popModelMatrix();
  pushModelMatrix();
  lineRot.setTranslation(coordsMid[0],coordsMid[1],coordsMid[2]);
  mulModelMatrix(lineRot);
  scaleModelMatrix(arrowRad,arrowRad,arrowLen);
  maybeUpdateState(gl);
  GL3Object cone=myGLResources.getCone(gl,nslices,capped);
  cone.draw(gl,getRegularProgram(gl));
  gl.glUseProgram(0);
  popModelMatrix();
}
Program: 70856
Project: 70856
Buggy source:
public void clearElements(){
  myElements.removeAll();
  for (int i=0; i < myNodes.size(); i++) {
    myNodes.get(i).setMass(0);
  }
  if (myAutoGenerateSurface) {
    mySurfaceMeshValid=false;
    myInternalSurfaceMeshComp=null;
  }
}

Fixed version (ground truth):
public void clearElements(){
  myElements.removeAll();
  for (int i=0; i < myNodes.size(); i++) {
    myNodes.get(i).clearMass();
  }
  if (myAutoGenerateSurface) {
    mySurfaceMeshValid=false;
    myInternalSurfaceMeshComp=null;
  }
}
Program: 70857
Project: 70857
Buggy source:
public void clearContactActivity(){
  for (  ContactConstraint c : myBilaterals0.values()) {
    c.setActive(false);
  }
  for (  ContactConstraint c : myBilaterals1.values()) {
    c.setActive(false);
  }
}

Fixed version (ground truth):
public void clearContactActivity(){
  for (  ContactConstraint c : myBilaterals0.values()) {
    c.setActive(false);
    c.setDistance(0);
  }
  for (  ContactConstraint c : myBilaterals1.values()) {
    c.setActive(false);
    c.setDistance(0);
  }
}
Program: 70858
Project: 70858
Buggy source:
boolean hashContactUsingFace(CollidableBody collidable0,CollidableBody collidable1){
  PolygonalMesh mesh0=collidable0.getCollisionMesh();
  PolygonalMesh mesh1=collidable1.getCollisionMesh();
  return (hasLowDOF(collidable0) && mesh0.numVertices() > mesh1.numVertices());
}

Fixed version (ground truth):
boolean hashContactUsingFace(CollidableBody collidable0,CollidableBody collidable1){
  PolygonalMesh mesh0=collidable0.getCollisionMesh();
  PolygonalMesh mesh1=collidable1.getCollisionMesh();
  return (!isCompliant() && hasLowDOF(collidable0) && mesh0.numVertices() > mesh1.numVertices());
}
Program: 70859
Project: 70859
Buggy source:
protected void computeStiffnessPosCorrection(VectorNd vel,int velSize){
  boolean analyze=false;
  updateSolveMatrixStructure();
  if (myKKTSolveMatrixVersion != mySolveMatrixVersion) {
    myKKTSolveMatrixVersion=mySolveMatrixVersion;
    analyze=true;
  }
  SparseNumberedBlockMatrix S=mySolveMatrix;
  S.setZero();
  mySys.addVelJacobian(S,null,-1);
  mySys.addPosJacobian(S,null,-1);
  addActiveMassMatrix(mySys,S);
  if (myKKTSolver == null) {
    myKKTSolver=new KKTSolver();
    analyze=true;
  }
  if (myKKTGTVersion != myGTVersion) {
    analyze=true;
    myKKTGTVersion=myGTVersion;
  }
  if (analyze) {
    myKKTSolver.analyze(S,velSize,myGT,mySys.getSolveMatrixType());
  }
  if (myHybridSolveP && !analyze && myNT.colSize() == 0) {
    myKKTSolver.factorAndSolve(S,velSize,myGT,myRg,vel,myLam,myBf,myBg,myHybridSolveTol);
  }
 else {
    myKKTSolver.factor(S,velSize,myGT,myRg,myNT,myRn);
    myKKTSolver.solve(vel,myLam,myThe,myBf,myBg,myBn);
  }
  if (computeKKTResidual) {
    double res=myKKTSolver.residual(S,velSize,myGT,myRg,myNT,myRn,vel,myLam,myThe,myBf,myBg,myBn);
    System.out.println("String_Node_Str" + velSize + "String_Node_Str"+ myGT.colSize()+ "String_Node_Str"+ myNT.colSize()+ "String_Node_Str"+ res);
  }
}

Fixed version (ground truth):
protected void computeStiffnessPosCorrection(VectorNd vel,int velSize){
  boolean analyze=false;
  updateSolveMatrixStructure();
  if (myKKTSolveMatrixVersion != mySolveMatrixVersion) {
    myKKTSolveMatrixVersion=mySolveMatrixVersion;
    analyze=true;
  }
  SparseNumberedBlockMatrix S=mySolveMatrix;
  S.setZero();
  mySys.addVelJacobian(S,null,-1);
  mySys.addPosJacobian(S,null,-1);
  addActiveMassMatrix(mySys,S);
  if (myKKTSolver == null) {
    myKKTSolver=new KKTSolver();
    analyze=true;
  }
  if (myKKTGTVersion != myGTVersion) {
    analyze=true;
    myKKTGTVersion=myGTVersion;
  }
  if (analyze) {
    myKKTSolver.analyze(S,velSize,myGT,myRg,mySys.getSolveMatrixType());
  }
  if (myHybridSolveP && !analyze && myNT.colSize() == 0) {
    myKKTSolver.factorAndSolve(S,velSize,myGT,myRg,vel,myLam,myBf,myBg,myHybridSolveTol);
  }
 else {
    myKKTSolver.factor(S,velSize,myGT,myRg,myNT,myRn);
    myKKTSolver.solve(vel,myLam,myThe,myBf,myBg,myBn);
  }
  if (computeKKTResidual) {
    double res=myKKTSolver.residual(S,velSize,myGT,myRg,myNT,myRn,vel,myLam,myThe,myBf,myBg,myBn);
    System.out.println("String_Node_Str" + velSize + "String_Node_Str"+ myGT.colSize()+ "String_Node_Str"+ myNT.colSize()+ "String_Node_Str"+ res);
  }
}
Program: 70862
Project: 70862
Buggy source:
protected void computeMassPosCorrection(VectorNd vel,int velSize){
  if (myConMassVersion != myMassVersion || myConGTVersion != myGTVersion) {
    myConSolver.analyze(myMass,velSize,myGT,Matrix.SPD);
    myConMassVersion=myMassVersion;
    myConGTVersion=myGTVersion;
  }
  myConSolver.factor(myMass,velSize,myGT,myRg,myNT,myRn);
  myConSolver.solve(vel,myLam,myThe,myBf,myBg,myBn);
  if (computeKKTResidual) {
    double res=myConSolver.residual(myMass,velSize,myGT,myRg,myNT,myRn,vel,myLam,myThe,myBf,myBg,myBn);
    System.out.println("String_Node_Str" + velSize + "String_Node_Str"+ myGT.colSize()+ "String_Node_Str"+ myNT.colSize()+ "String_Node_Str"+ res);
  }
}

Fixed version (ground truth):
protected void computeMassPosCorrection(VectorNd vel,int velSize){
  if (myConMassVersion != myMassVersion || myConGTVersion != myGTVersion) {
    myConSolver.analyze(myMass,velSize,myGT,myRg,Matrix.SPD);
    myConMassVersion=myMassVersion;
    myConGTVersion=myGTVersion;
  }
  myConSolver.factor(myMass,velSize,myGT,myRg,myNT,myRn);
  myConSolver.solve(vel,myLam,myThe,myBf,myBg,myBn);
  if (computeKKTResidual) {
    double res=myConSolver.residual(myMass,velSize,myGT,myRg,myNT,myRn,vel,myLam,myThe,myBf,myBg,myBn);
    System.out.println("String_Node_Str" + velSize + "String_Node_Str"+ myGT.colSize()+ "String_Node_Str"+ myNT.colSize()+ "String_Node_Str"+ res);
  }
}
Program: 70865
Project: 70865
Buggy source:
public void build(String[] args){
  MechModel mech=new MechModel("String_Node_Str");
  addModel(mech);
  RigidBody ball=RigidBody.createIcosahedralSphere("String_Node_Str",0.8,0.1,1);
  ball.setPose(new RigidTransform3d(0,0,0,0.4,0.1,0.1));
  ball.setDynamic(false);
  mech.addRigidBody(ball);
  RigidBody plate=RigidBody.createBox("String_Node_Str",5,5,5,1);
  plate.setPose(new RigidTransform3d(0,0,2.94,1,0,0,0));
  plate.setDynamic(false);
  mech.addRigidBody(plate);
  mech.setDefaultCollisionBehavior(true,0.20);
  RenderProps.setFaceStyle(ball,RenderProps.Faces.NONE);
  RenderProps.setDrawEdges(ball,true);
  RenderProps.setEdgeColor(ball,Color.WHITE);
  RenderProps.setVisible(plate,false);
  RenderProps.setAlpha(plate,0.5);
  CollisionManager cm=mech.getCollisionManager();
  RenderProps.setVisible(cm,true);
  RenderProps.setLineWidth(cm,3);
  RenderProps.setLineColor(cm,Color.RED);
  RenderProps.setEdgeWidth(cm,3);
  RenderProps.setEdgeColor(cm,Color.BLUE);
  cm.setContactNormalLen(0.5);
  cm.setDrawIntersectionContours(true);
  cm.setDrawIntersectionFaces(true);
  addMonitor(new PenetrationRenderer(cm.collisionHandlers().get(0)));
}

Fixed version (ground truth):
public void build(String[] args){
  MechModel mech=new MechModel("String_Node_Str");
  addModel(mech);
  RigidBody ball=RigidBody.createIcosahedralSphere("String_Node_Str",0.8,0.1,1);
  ball.setPose(new RigidTransform3d(0,0,0,0.4,0.1,0.1));
  ball.setDynamic(false);
  mech.addRigidBody(ball);
  RigidBody plate=RigidBody.createBox("String_Node_Str",5,5,5,1);
  plate.setPose(new RigidTransform3d(0,0,2.94,1,0,0,0));
  plate.setDynamic(false);
  mech.addRigidBody(plate);
  mech.setDefaultCollisionBehavior(true,0.20);
  RenderProps.setFaceStyle(ball,RenderProps.Faces.NONE);
  RenderProps.setDrawEdges(ball,true);
  RenderProps.setEdgeColor(ball,Color.WHITE);
  RenderProps.setVisible(plate,false);
  RenderProps.setAlpha(plate,0.5);
  CollisionManager cm=mech.getCollisionManager();
  RenderProps.setVisible(cm,true);
  RenderProps.setLineWidth(cm,3);
  RenderProps.setLineColor(cm,Color.RED);
  RenderProps.setEdgeWidth(cm,3);
  RenderProps.setEdgeColor(cm,Color.BLUE);
  cm.setContactNormalLen(0.5);
  cm.setDrawIntersectionContours(true);
  cm.setDrawIntersectionFaces(true);
  cm.setDrawIntersectionPoints(true);
  addMonitor(new PenetrationRenderer(cm.collisionHandlers().get(0)));
}
Program: 70866
Project: 70866
Buggy source:
public void printLinearProblem(PrintWriter pw,VectorNd bf,VectorNd bg,String fmtStr,boolean omitLowerRightDiagonal) throws IOException {
  NumberFormat fmt=new NumberFormat(fmtStr);
  int size=mySizeM + myNumG;
  int nnz=myNumVals;
  if (omitLowerRightDiagonal) {
    nnz-=myNumG;
  }
  pw.println(size);
  for (int i=0; i < size + 1; i++) {
    pw.print(Math.min(nnz + 1,myRowOffs[i]));
    if (i < size) {
      pw.print("String_Node_Str");
    }
  }
  pw.println("String_Node_Str");
  for (int i=0; i < nnz; i++) {
    pw.print(myColIdxs[i]);
    if (i < nnz - 1) {
      pw.print("String_Node_Str");
    }
  }
  pw.println("String_Node_Str");
  for (int i=0; i < nnz; i++) {
    pw.print(fmt.format(myVals[i]));
    if (i < nnz - 1) {
      pw.print("String_Node_Str");
    }
  }
  pw.println("String_Node_Str");
  bf.write(pw,fmt);
  pw.print("String_Node_Str");
  bg.write(pw,fmt);
  pw.println("String_Node_Str");
  pw.flush();
}

Fixed version (ground truth):
public void printLinearProblem(PrintWriter pw,VectorNd bf,VectorNd bg,String fmtStr,boolean omitLowerRightDiagonal) throws IOException {
  NumberFormat fmt=new NumberFormat(fmtStr);
  int size=mySizeM + myNumG;
  int nnz=myNumVals;
  if (omitLowerRightDiagonal) {
    nnz-=myNumG;
  }
  if (myPartitionM == Matrix.Partition.UpperTriangular) {
    pw.print("String_Node_Str");
  }
  pw.println(size);
  for (int i=0; i < size + 1; i++) {
    pw.print(Math.min(nnz + 1,myRowOffs[i]));
    if (i < size) {
      pw.print("String_Node_Str");
    }
  }
  pw.println("String_Node_Str");
  for (int i=0; i < nnz; i++) {
    pw.print(myColIdxs[i]);
    if (i < nnz - 1) {
      pw.print("String_Node_Str");
    }
  }
  pw.println("String_Node_Str");
  for (int i=0; i < nnz; i++) {
    pw.print(fmt.format(myVals[i]));
    if (i < nnz - 1) {
      pw.print("String_Node_Str");
    }
  }
  pw.println("String_Node_Str");
  bf.write(pw,fmt);
  pw.print("String_Node_Str");
  bg.write(pw,fmt);
  pw.println("String_Node_Str");
  pw.flush();
}
Program: 70867
Project: 70867
Buggy source:
/** 
 * Performs symbolic analysis on the equality portion of the KKT system defined by matrices M and GT. This step must be called before any calls are made to factor().
 * @param M Sparse matrix defining M
 * @param sizeM size of M 
 * @param GT Sparse matrix defining the transpose of G
 * @param typeM describes the type of M, to be used in determining how the resulting KKT system should be factored. Should be either  {@link Matrix#INDEFINITE},   {@link Matrix#SYMMETRIC}, or  {@link Matrix#SPD}. 
 */
public void analyze(SparseBlockMatrix M,int sizeM,SparseBlockMatrix GT,int typeM){
  analyzeMG(M,sizeM,GT,null,typeM);
}

Fixed version (ground truth):
/** 
 * Performs symbolic analysis on the equality portion of the KKT system defined by matrices M and GT. This step must be called before any calls are made to factor().
 * @param M Sparse matrix defining M
 * @param sizeM size of M 
 * @param GT Sparse matrix defining the transpose of G
 * @param Rg if non-null, supplies the diagonal regularization matrix R
 * @param typeM describes the type of M, to be used in determining how the resulting KKT system should be factored. Should be either  {@link Matrix#INDEFINITE},   {@link Matrix#SYMMETRIC}, or  {@link Matrix#SPD}. 
 */
public void analyze(SparseBlockMatrix M,int sizeM,SparseBlockMatrix GT,VectorNd Rg,int typeM){
  analyzeMG(M,sizeM,GT,Rg,typeM);
}
Program: 70868
Project: 70868
Buggy source:
private void solveAndCheck(Object M,int sizeM,SparseBlockMatrix GT,SparseBlockMatrix NT,VectorNd Rg,VectorNd Rn,VectorNd bm,VectorNd bg,VectorNd bn,VectorNd vel,VectorNd lam,VectorNd the,int typeM){
  SparseBlockMatrix DT=null;
  VectorNd mu=null;
  VectorNd bet=null;
  int[] Dref=null;
  int numG=GT.colSize();
  int numN=0;
  if (NT != null && NT.colSize() > 0) {
    numN=NT.colSize();
  }
  KKTSolver solver=new KKTSolver();
  if (M instanceof SparseBlockMatrix) {
    solver.analyze((SparseBlockMatrix)M,sizeM,GT,typeM);
  }
 else {
    solver.analyze((VectorNd)M,sizeM,GT);
  }
  Status status;
  if (numN == 0) {
    if (M instanceof SparseBlockMatrix) {
      solver.factor((SparseBlockMatrix)M,sizeM,GT,Rg);
    }
 else {
      solver.factor((VectorNd)M,sizeM,GT,Rg);
    }
    status=solver.solve(vel,lam,bm,bg);
  }
 else {
    if (M instanceof SparseBlockMatrix) {
      solver.factor((SparseBlockMatrix)M,sizeM,GT,Rg,NT,Rn);
    }
 else {
      solver.factor((VectorNd)M,sizeM,GT,Rg,NT,Rn);
    }
    status=solver.solve(vel,lam,the,bm,bg,bn);
  }
  if (status != Status.SOLVED) {
    throw new TestException("String_Node_Str" + status);
  }
  VectorNd bmCheck=new VectorNd(sizeM);
  VectorNd bgCheck=new VectorNd(numG);
  if (checkSolve(M,sizeM,GT,NT,vel,lam,the,bm,bmCheck) > 1e-8) {
    throw new TestException("String_Node_Str" + bm.toString("String_Node_Str") + "String_Node_Str"+ bmCheck.toString("String_Node_Str"));
  }
  checkComplementarity(GT,NT,null,Rg,Rn,bg,bn,null,null,vel,lam,the,null);
}

Fixed version (ground truth):
private void solveAndCheck(Object M,int sizeM,SparseBlockMatrix GT,SparseBlockMatrix NT,VectorNd Rg,VectorNd Rn,VectorNd bm,VectorNd bg,VectorNd bn,VectorNd vel,VectorNd lam,VectorNd the,int typeM){
  SparseBlockMatrix DT=null;
  VectorNd mu=null;
  VectorNd bet=null;
  int[] Dref=null;
  int numG=GT.colSize();
  int numN=0;
  if (NT != null && NT.colSize() > 0) {
    numN=NT.colSize();
  }
  KKTSolver solver=new KKTSolver();
  if (M instanceof SparseBlockMatrix) {
    solver.analyze((SparseBlockMatrix)M,sizeM,GT,Rg,typeM);
  }
 else {
    solver.analyze((VectorNd)M,sizeM,GT,Rg);
  }
  Status status;
  if (numN == 0) {
    if (M instanceof SparseBlockMatrix) {
      solver.factor((SparseBlockMatrix)M,sizeM,GT,Rg);
    }
 else {
      solver.factor((VectorNd)M,sizeM,GT,Rg);
    }
    status=solver.solve(vel,lam,bm,bg);
  }
 else {
    if (M instanceof SparseBlockMatrix) {
      solver.factor((SparseBlockMatrix)M,sizeM,GT,Rg,NT,Rn);
    }
 else {
      solver.factor((VectorNd)M,sizeM,GT,Rg,NT,Rn);
    }
    status=solver.solve(vel,lam,the,bm,bg,bn);
  }
  if (status != Status.SOLVED) {
    throw new TestException("String_Node_Str" + status);
  }
  VectorNd bmCheck=new VectorNd(sizeM);
  VectorNd bgCheck=new VectorNd(numG);
  if (checkSolve(M,sizeM,GT,NT,vel,lam,the,bm,bmCheck) > 1e-8) {
    throw new TestException("String_Node_Str" + bm.toString("String_Node_Str") + "String_Node_Str"+ bmCheck.toString("String_Node_Str"));
  }
  checkComplementarity(GT,NT,null,Rg,Rn,bg,bn,null,null,vel,lam,the,null);
}
Program: 70870
Project: 70870
Buggy source:
@Override public void drawPoints(RenderObject robj,PointStyle style,double rad){
  maybeUpdateState(gl);
switch (style) {
case POINT:
{
      float fold=getPointSize();
      float frad=(float)rad;
      boolean changed=false;
      if (fold != frad) {
        setPointSize(frad);
        changed=true;
      }
      drawPoints(robj);
      if (changed) {
        setPointSize(fold);
      }
      break;
    }
case SPHERE:
  drawSpheres(robj,rad);
break;
}
}

Fixed version (ground truth):
@Override public void drawPoints(RenderObject robj,PointStyle style,double rad){
switch (style) {
case POINT:
{
      float fold=getPointSize();
      float frad=(float)rad;
      boolean changed=false;
      if (fold != frad) {
        setPointSize(frad);
        changed=true;
      }
      drawPoints(robj);
      if (changed) {
        setPointSize(fold);
      }
      break;
    }
case SPHERE:
  drawSpheres(robj,rad);
break;
}
}