nus-yam/ex-repair huggingface dataset:
Program: 70874
Project: 70874
Buggy source:
private void drawColoredEllipsoid(GL2 gl,int slices,float rad,float[] p0,byte[] c0,float[] p1,byte[] c1,boolean hsv){
  utmp.set(p1[0] - p0[0],p1[1] - p0[1],p1[2] - p0[2]);
  Xtmp.p.set(p0[0],p0[1],p0[2]);
  Xtmp.R.setZDirection(utmp);
  gl.glPushMatrix();
  GL2Viewer.mulTransform(gl,Xtmp);
  int levels=slices / 2;
  levels=Math.max(levels,2);
  double sin0=0;
  double cos0=1;
  double len=utmp.norm();
  byte[] cm=new byte[4];
  for (int slice=0; slice < slices; slice++) {
    double ang=(slice + 1) * 2 * Math.PI / slices;
    double cos1=Math.cos(ang);
    double sin1=Math.sin(ang);
    gl.glBegin(GL2.GL_TRIANGLE_STRIP);
    for (int j=0; j <= levels; j++) {
      double h=j * 1.0 / levels;
      double r=1 * Math.sin(h * Math.PI / 1.0);
      double drdh=Math.PI / 1.0 * 1.0 * Math.cos(h * Math.PI / 1.0);
      interpColor4ub(c0,h,c1,cm,hsv);
      gl.glColor4ubv(cm,0);
      gl.glNormal3d(cos0,sin0,-drdh * rad / len);
      gl.glVertex3d(cos0 * r * rad,sin0 * r * rad,h * len);
      gl.glNormal3d(cos1,sin1,-drdh * rad / len);
      gl.glVertex3d(cos1 * r * rad,sin1 * r * rad,h * len);
    }
    gl.glEnd();
    sin0=sin1;
    cos0=cos1;
  }
  gl.glPopMatrix();
}

Fixed version (ground truth):
private void drawColoredEllipsoid(GL2 gl,int slices,float rad,float[] p0,byte[] c0,float[] p1,byte[] c1,boolean hsv){
  utmp.set(p1[0] - p0[0],p1[1] - p0[1],p1[2] - p0[2]);
  Xtmp.p.set(p0[0],p0[1],p0[2]);
  Xtmp.R.setZDirection(utmp);
  gl.glPushMatrix();
  GL2Viewer.mulTransform(gl,Xtmp);
  int levels=slices / 2;
  levels=Math.max(levels,2);
  double sin0=0;
  double cos0=1;
  double len=utmp.norm();
  byte[] cm=new byte[4];
  for (int slice=0; slice < slices; slice++) {
    double ang=(slice + 1) * 2 * Math.PI / slices;
    double cos1=Math.cos(ang);
    double sin1=Math.sin(ang);
    gl.glBegin(GL2.GL_TRIANGLE_STRIP);
    for (int j=0; j <= levels; j++) {
      double h=j * 1.0 / levels;
      double r=1 * Math.sin(h * Math.PI);
      double drdh=Math.PI * Math.cos(h * Math.PI);
      interpColor4ub(c0,h,c1,cm,hsv);
      setVertexColor(gl,cm,hsv);
      gl.glNormal3d(cos0,sin0,-drdh * rad / len);
      gl.glVertex3d(cos0 * r * rad,sin0 * r * rad,h * len);
      gl.glNormal3d(cos1,sin1,-drdh * rad / len);
      gl.glVertex3d(cos1 * r * rad,sin1 * r * rad,h * len);
    }
    gl.glEnd();
    sin0=sin1;
    cos0=cos1;
  }
  gl.glPopMatrix();
}
Program: 70876
Project: 70876
Buggy source:
private void interpColor4ub(byte[] c0,double t,byte[] c1,byte[] out,boolean hsv){
  if (hsv) {
    byte[] tmp=new byte[4];
    RGBtoHSV(c0,tmp);
    tmp[3]=c0[3];
    RGBtoHSV(c1,out);
    out[3]=c1[3];
    for (int i=0; i < 4; ++i) {
      out[i]=(byte)((1 - t) * tmp[i] + t * out[i]);
    }
    HSVtoRGB(out,out);
  }
 else {
    for (int i=0; i < 4; ++i) {
      out[i]=(byte)((1 - t) * c0[i] + t * c1[i]);
    }
  }
}

Fixed version (ground truth):
private void interpColor4ub(byte[] c0,double t,byte[] c1,byte[] out,boolean hsv){
  if (hsv) {
    byte[] tmp=new byte[4];
    RGBtoHSV(c0,tmp);
    tmp[3]=c0[3];
    RGBtoHSV(c1,out);
    out[3]=c1[3];
    for (int i=0; i < 4; ++i) {
      out[i]=(byte)((1 - t) * (tmp[i] & 0xFF) + t * (out[i] & 0xFF));
    }
    HSVtoRGB(out,out);
  }
 else {
    for (int i=0; i < 4; ++i) {
      out[i]=(byte)((1 - t) * (c0[i] & 0xFF) + t * (c1[i] & 0xFF));
    }
  }
}
Program: 70877
Project: 70877
Buggy source:
protected void maybeUpdateShading(GL2 gl){
  if (myShadingModified && !isSelecting()) {
    Shading shading=getShadeModel();
    if (shading == Shading.NONE) {
      setLightingEnabled(false);
    }
 else {
      setLightingEnabled(true);
      gl.glShadeModel(getGLShadingModel(shading));
    }
    myShadingModified=false;
  }
}

Fixed version (ground truth):
protected void maybeUpdateShading(GL2 gl){
  if (myShadingModified && !isSelecting()) {
    Shading shading=getShadeModel();
    if (shading == Shading.NONE) {
      setLightingEnabled(false);
    }
 else {
      setLightingEnabled(true);
      int glShading=getGLShadingModel(shading);
      gl.glShadeModel(glShading);
    }
    myShadingModified=false;
  }
}
Program: 70886
Project: 70886
Buggy source:
private void drawEdgesRaw(GLRenderer renderer,PolygonalMesh mesh,int flags){
  GL2 gl=renderer.getGL2();
  RenderProps.Shading savedShadeModel=renderer.getShadeModel();
  boolean useRenderNormals=mesh.isRenderBuffered() && !mesh.isFixed();
  boolean useVertexColors=(flags & GLRenderer.VERTEX_COLORING) != 0;
  boolean useHSVInterpolation=(flags & GLRenderer.HSV_COLOR_INTERPOLATION) != 0;
  boolean mergeQuadTriangles=false;
  if (useVertexColors && useHSVInterpolation) {
    useHSVInterpolation=setupHSVInterpolation(gl);
  }
  int[] indexOffs=mesh.getFeatureIndexOffsets();
  ArrayList<Face> faceList=mesh.getFaces();
  for (int faceIdx=0; faceIdx < faceList.size(); faceIdx++) {
    faceIdx=unpackEdges(faceList,faceIdx,mergeQuadTriangles);
    int faceOff=indexOffs[faceIdx];
    gl.glBegin(GL2.GL_LINE_LOOP);
    for (int edgeIdx=0; edgeIdx < myEdgeCnt; edgeIdx++) {
      HalfEdge he=myEdges[edgeIdx];
      int vi=(edgeIdx <= 2 ? edgeIdx : 2);
      Vertex3d vtx=he.head;
      Point3d pnt=useRenderNormals ? vtx.myRenderPnt : vtx.pnt;
      if (useVertexColors) {
        float[] color=null;
        int ci=mesh.myColorIndices[faceOff + vi];
        if (ci == -1) {
          color=null;
        }
 else {
          color=mesh.myColors.get(ci);
        }
        setVertexColor(gl,color,useHSVInterpolation);
      }
      gl.glVertex3d(pnt.x,pnt.y,pnt.z);
    }
    gl.glEnd();
  }
  if (useVertexColors && useHSVInterpolation) {
    gl.glUseProgramObjectARB(0);
  }
}

Fixed version (ground truth):
private void drawEdgesRaw(GLRenderer renderer,PolygonalMesh mesh,int flags){
  GL2 gl=renderer.getGL2();
  RenderProps.Shading savedShadeModel=renderer.getShadeModel();
  boolean useRenderNormals=mesh.isRenderBuffered() && !mesh.isFixed();
  boolean useVertexColors=(flags & GLRenderer.VERTEX_COLORING) != 0;
  boolean useHSVInterpolation=(flags & GLRenderer.HSV_COLOR_INTERPOLATION) != 0;
  boolean mergeQuadTriangles=false;
  if (useVertexColors && useHSVInterpolation) {
    useHSVInterpolation=setupHSVInterpolation(gl);
  }
  int[] indexOffs=mesh.getFeatureIndexOffsets();
  int[] cidxs=useVertexColors ? mesh.getColorIndices() : null;
  ArrayList<float[]> colors=useVertexColors ? mesh.getColors() : null;
  ArrayList<Face> faceList=mesh.getFaces();
  for (int faceIdx=0; faceIdx < faceList.size(); faceIdx++) {
    faceIdx=unpackEdges(faceList,faceIdx,mergeQuadTriangles);
    int faceOff=indexOffs[faceIdx];
    gl.glBegin(GL2.GL_LINE_LOOP);
    for (int edgeIdx=0; edgeIdx < myEdgeCnt; edgeIdx++) {
      HalfEdge he=myEdges[edgeIdx];
      int vi=(edgeIdx <= 2 ? edgeIdx : 2);
      Vertex3d vtx=he.head;
      Point3d pnt=useRenderNormals ? vtx.myRenderPnt : vtx.pnt;
      if (useVertexColors) {
        float[] color=null;
        int ci=cidxs[faceOff + vi];
        if (ci == -1) {
          color=null;
        }
 else {
          color=colors.get(ci);
        }
        setVertexColor(gl,color,useHSVInterpolation);
      }
      gl.glVertex3d(pnt.x,pnt.y,pnt.z);
    }
    gl.glEnd();
  }
  if (useVertexColors && useHSVInterpolation) {
    gl.glUseProgramObjectARB(0);
  }
}
Program: 70894
Project: 70894
Buggy source:
private void setProbeUpdateInterval(double h){
  refTargetForceInProbe.setUpdateInterval(h);
  refTargetMotionInProbe.setUpdateInterval(h);
  excitationInput.setUpdateInterval(h);
  excitationOutProbe.setUpdateInterval(h);
  modelTargetMotionOutProbe.setUpdateInterval(h);
  refTargetMotionOutProbe.setUpdateInterval(h);
}

Fixed version (ground truth):
private void setProbeUpdateInterval(double h){
  if (refTargetForceInProbe != null) {
    refTargetForceInProbe.setUpdateInterval(h);
  }
  if (refTargetMotionInProbe != null) {
    refTargetMotionInProbe.setUpdateInterval(h);
    modelTargetMotionOutProbe.setUpdateInterval(h);
    refTargetMotionOutProbe.setUpdateInterval(h);
  }
  excitationInput.setUpdateInterval(h);
  excitationOutProbe.setUpdateInterval(h);
}
Program: 70895
Project: 70895
Buggy source:
private void configureTargetForceProbe(NumericProbeBase probe,ArrayList<ForceTarget> targets,String filename){
  ArrayList<Property> props=new ArrayList<Property>();
  for (  ForceTarget target : targets) {
    props.add(target.getProperty("String_Node_Str"));
  }
  probe.setAttachedFileName(filename);
  if (probe instanceof NumericInputProbe) {
    ((NumericInputProbe)probe).setInputProperties(props.toArray(new Property[props.size()]));
  }
 else   if (probe instanceof NumericOutputProbe) {
    ((NumericOutputProbe)probe).setOutputProperties(props.toArray(new Property[props.size()]));
  }
  if (probe instanceof NumericInputProbe) {
    File file=probe.getAttachedFile();
    if (file == null || !file.exists()) {
      ((NumericInputProbe)probe).loadEmpty();
      probe.setActive(false);
    }
 else {
      try {
        probe.load();
        probe.setActive(true);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
private void configureTargetForceProbe(NumericProbeBase probe,ArrayList<ForceTarget> targets,String filename){
  System.out.println("String_Node_Str");
  ArrayList<Property> props=new ArrayList<Property>();
  for (  ForceTarget target : targets) {
    props.add(target.getProperty("String_Node_Str"));
  }
  probe.setAttachedFileName(filename);
  if (probe instanceof NumericInputProbe) {
    ((NumericInputProbe)probe).setInputProperties(props.toArray(new Property[props.size()]));
  }
 else   if (probe instanceof NumericOutputProbe) {
    ((NumericOutputProbe)probe).setOutputProperties(props.toArray(new Property[props.size()]));
  }
  if (probe instanceof NumericInputProbe) {
    File file=probe.getAttachedFile();
    if (file == null || !file.exists()) {
      ((NumericInputProbe)probe).loadEmpty();
      probe.setActive(false);
    }
 else {
      try {
        probe.load();
        probe.setActive(true);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 70896
Project: 70896
Buggy source:
private void findOrCreateProbes(RootModel root,TrackingController controller){
  refTargetForceInProbe=findOrCreateInputProbe(root,"String_Node_Str");
  refTargetMotionInProbe=findOrCreateInputProbe(root,"String_Node_Str");
  refTargetMotionOutProbe=findOrCreateOutputProbe(root,"String_Node_Str");
  modelTargetMotionOutProbe=findOrCreateOutputProbe(root,"String_Node_Str");
  excitationOutProbe=findOrCreateOutputProbe(root,"String_Node_Str");
  excitationInput=findOrCreateInputProbe(root,"String_Node_Str");
  setLoneBreakpoint(root,controller.getProbeDuration());
  setProbeDuration(controller.getProbeDuration());
  setProbeUpdateInterval(controller.getProbeUpdateInterval());
  if (myMain.getTimeline() != null && myMain.getRootModel() != null) {
    myMain.getTimeline().requestResetAll();
  }
}

Fixed version (ground truth):
private void findOrCreateProbes(RootModel root,TrackingController controller){
  if (findForceTargetTerm(controller) != null) {
    refTargetForceInProbe=findOrCreateInputProbe(root,"String_Node_Str");
  }
  if (findMotionTargetTerm(controller) != null) {
    refTargetMotionInProbe=findOrCreateInputProbe(root,"String_Node_Str");
    refTargetMotionOutProbe=findOrCreateOutputProbe(root,"String_Node_Str");
    modelTargetMotionOutProbe=findOrCreateOutputProbe(root,"String_Node_Str");
  }
  excitationOutProbe=findOrCreateOutputProbe(root,"String_Node_Str");
  excitationInput=findOrCreateInputProbe(root,"String_Node_Str");
  setLoneBreakpoint(root,controller.getProbeDuration());
  setProbeDuration(controller.getProbeDuration());
  setProbeUpdateInterval(controller.getProbeUpdateInterval());
  if (myMain.getTimeline() != null && myMain.getRootModel() != null) {
    myMain.getTimeline().requestResetAll();
  }
}
Program: 70897
Project: 70897
Buggy source:
private void setProbeDuration(double t){
  refTargetForceInProbe.setStopTime(t);
  refTargetMotionInProbe.setStopTime(t);
  excitationInput.setStopTime(t);
  excitationOutProbe.setStopTime(t);
  modelTargetMotionOutProbe.setStopTime(t);
  refTargetMotionOutProbe.setStopTime(t);
}

Fixed version (ground truth):
private void setProbeDuration(double t){
  if (refTargetForceInProbe != null) {
    refTargetForceInProbe.setStopTime(t);
  }
  if (refTargetMotionInProbe != null) {
    refTargetMotionInProbe.setStopTime(t);
    modelTargetMotionOutProbe.setStopTime(t);
    refTargetMotionOutProbe.setStopTime(t);
  }
  excitationInput.setStopTime(t);
  excitationOutProbe.setStopTime(t);
}
Program: 70898
Project: 70898
Buggy source:
private void configureTargetMotionProbe(NumericProbeBase probe,ArrayList<MotionTargetComponent> targets,String filename){
  ArrayList<Property> props=new ArrayList<Property>();
  for (  ModelComponent target : targets) {
    if (target instanceof Point) {
      props.add(target.getProperty("String_Node_Str"));
    }
 else     if (target instanceof Frame) {
      props.add(target.getProperty("String_Node_Str"));
      props.add(target.getProperty("String_Node_Str"));
    }
 else {
      System.err.println("String_Node_Str" + target.getClass().toString());
    }
  }
  probe.setAttachedFileName(filename);
  if (probe instanceof NumericInputProbe) {
    ((NumericInputProbe)probe).setInputProperties(props.toArray(new Property[props.size()]));
  }
 else   if (probe instanceof NumericOutputProbe) {
    ((NumericOutputProbe)probe).setOutputProperties(props.toArray(new Property[props.size()]));
  }
  if (probe instanceof NumericInputProbe) {
    File file=probe.getAttachedFile();
    if (file == null || !file.exists()) {
      ((NumericInputProbe)probe).loadEmpty();
      probe.setActive(false);
    }
 else {
      try {
        probe.load();
        probe.setActive(true);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
private void configureTargetMotionProbe(NumericProbeBase probe,ArrayList<MotionTargetComponent> targets,String filename){
  System.out.println("String_Node_Str");
  ArrayList<Property> props=new ArrayList<Property>();
  for (  ModelComponent target : targets) {
    if (target instanceof Point) {
      props.add(target.getProperty("String_Node_Str"));
    }
 else     if (target instanceof Frame) {
      props.add(target.getProperty("String_Node_Str"));
      props.add(target.getProperty("String_Node_Str"));
    }
 else {
      System.err.println("String_Node_Str" + target.getClass().toString());
    }
  }
  probe.setAttachedFileName(filename);
  if (probe instanceof NumericInputProbe) {
    ((NumericInputProbe)probe).setInputProperties(props.toArray(new Property[props.size()]));
  }
 else   if (probe instanceof NumericOutputProbe) {
    ((NumericOutputProbe)probe).setOutputProperties(props.toArray(new Property[props.size()]));
  }
  if (probe instanceof NumericInputProbe) {
    File file=probe.getAttachedFile();
    if (file == null || !file.exists()) {
      ((NumericInputProbe)probe).loadEmpty();
      probe.setActive(false);
    }
 else {
      try {
        probe.load();
        probe.setActive(true);
      }
 catch (      IOException e) {
        e.printStackTrace();
      }
    }
  }
}
Program: 70899
Project: 70899
Buggy source:
protected void addSpringMesh(MechModel mech){
  Particle p0=new Particle(0.5,-0.10,0,0.20);
  p0.setDynamic(false);
  Particle p1=new Particle(0.5,0,0,0.25);
  Particle p2=new Particle(0.5,0,0,0.15);
  Particle p3=new Particle(0.5,0.10,0,0.20);
  AxialSpring[] springs=new AxialSpring[10];
  for (int i=0; i < springs.length; i++) {
    springs[i]=new AxialSpring(0.50,0.20,0.10);
  }
  mech.particles().addNumbered(p1,4);
  mech.particles().addNumbered(p2,0);
  mech.attachAxialSpring(p1,p2,springs[2]);
}

Fixed version (ground truth):
protected void addSpringMesh(MechModel mech){
  Particle p0=new Particle(0.5,-0.10,0,0.20);
  p0.setDynamic(false);
  Particle p1=new Particle(0.5,0,0,0.25);
  Particle p2=new Particle(0.5,0,0,0.15);
  Particle p3=new Particle(0.5,0.10,0,0.20);
  AxialSpring[] springs=new AxialSpring[10];
  for (int i=0; i < springs.length; i++) {
    springs[i]=new AxialSpring(0.50,0.20,0.10);
  }
  mech.particles().addNumbered(p1,4);
  mech.particles().addNumbered(p2,0);
  mech.attachAxialSpring(p2,p1,springs[2]);
}
Program: 70900
Project: 70900
Buggy source:
@Override public void build(String[] args) throws IOException {
  super.build(args);
  MechModel mech=new MechModel("String_Node_Str");
  addModel(mech);
  addSpringMesh(mech);
  for (  AxialSpring s : mech.axialSprings()) {
    s.setRenderProps(null);
  }
  RenderProps.setLineStyle(mech,LineStyle.CYLINDER);
  RenderProps.setLineRadius(mech,0.02);
}

Fixed version (ground truth):
@Override public void build(String[] args) throws IOException {
  super.build(args);
  MechModel mech=new MechModel("String_Node_Str");
  addModel(mech);
  addVerticalSprings(mech);
  for (  AxialSpring s : mech.axialSprings()) {
    s.setRenderProps(null);
  }
  RenderProps.setLineStyle(mech,LineStyle.CYLINDER);
  RenderProps.setLineRadius(mech,0.02);
}
Program: 70901
Project: 70901
Buggy source:
private static void addRodriguesLineRotation(StringBuilder fb){
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb);
}

Fixed version (ground truth):
private static void addRodriguesLineRotation(StringBuilder fb){
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb,"String_Node_Str");
  appendln(fb);
}
Program: 70903
Project: 70903
Buggy source:
private void drawEdges(GL2 gl,RenderProps props){
  ArrayList<float[]> colors=null;
  int[] colorIndices=null;
  int[] indexOffs=null;
  if (useVertexColouring && size() > 0) {
    MeshBase mesh=get(0).myMesh;
    colors=mesh.getColors();
    colorIndices=mesh.getColorIndices();
    indexOffs=mesh.getFeatureIndexOffsets();
  }
  gl.glBegin(GL2.GL_LINES);
  for (  FaceComponent fc : this) {
    if (fc.getRenderProps() == null) {
      Face face=fc.getFace();
      HalfEdge he=face.firstHalfEdge();
      int k=0;
      int faceOff=indexOffs[face.getIndex()];
      do {
        if (useVertexColouring) {
          int cidx=colorIndices[faceOff + k];
          if (cidx != -1) {
            float[] color=colors.get(cidx);
            gl.glColor4f(color[0],color[1],color[2],color[3]);
          }
        }
        Point3d pnt=he.head.myRenderPnt;
        gl.glVertex3d(pnt.x,pnt.y,pnt.z);
        pnt=he.tail.myRenderPnt;
        gl.glVertex3d(pnt.x,pnt.y,pnt.z);
        he=he.getNext();
        k++;
      }
 while (he != face.firstHalfEdge());
    }
  }
  gl.glEnd();
}

Fixed version (ground truth):
private void drawEdges(GL2 gl,RenderProps props){
  ArrayList<float[]> colors=null;
  int[] colorIndices=null;
  int[] indexOffs=null;
  if (useVertexColouring && size() > 0) {
    MeshBase mesh=get(0).myMesh;
    colors=mesh.getColors();
    colorIndices=mesh.getColorIndices();
    indexOffs=mesh.getFeatureIndexOffsets();
  }
  gl.glBegin(GL2.GL_LINES);
  for (  FaceComponent fc : this) {
    if (fc.getRenderProps() == null) {
      Face face=fc.getFace();
      HalfEdge he=face.firstHalfEdge();
      int k=0;
      do {
        if (useVertexColouring) {
          int faceOff=indexOffs[face.getIndex()];
          int cidx=colorIndices[faceOff + k];
          if (cidx != -1) {
            float[] color=colors.get(cidx);
            gl.glColor4f(color[0],color[1],color[2],color[3]);
          }
        }
        Point3d pnt=he.head.myRenderPnt;
        gl.glVertex3d(pnt.x,pnt.y,pnt.z);
        pnt=he.tail.myRenderPnt;
        gl.glVertex3d(pnt.x,pnt.y,pnt.z);
        he=he.getNext();
        k++;
      }
 while (he != face.firstHalfEdge());
    }
  }
  gl.glEnd();
}
Program: 70906
Project: 70906
Buggy source:
public static void computeTriangleNormals(RenderObject r,int tgrp){
  int numt=r.numTriangles(tgrp);
  for (int i=0; i < numt; i++) {
    int[] idxs=r.getTriangle(tgrp,i);
    float[] p0=r.getVertexPosition(idxs[0]);
    float[] p1=r.getVertexPosition(idxs[1]);
    float[] p2=r.getVertexPosition(idxs[2]);
    float[] nrm=r.getVertexNormal(idxs[0]);
    float ax=p1[0] - p0[0];
    float ay=p1[1] - p0[1];
    float az=p1[2] - p0[2];
    float bx=p2[0] - p0[0];
    float by=p2[1] - p0[1];
    float bz=p2[2] - p0[2];
    float nx=ay * bz - az * by;
    float ny=az * bx - ax * bz;
    float nz=ax * by - ay * bx;
    float mag=(float)Math.sqrt(nx * nx + ny * ny + nz * nz);
    if (mag > 0) {
      nx/=mag;
      ny/=mag;
      nz/=mag;
    }
    nrm[0]=nx;
    nrm[1]=ny;
    nrm[2]=nz;
  }
}

Fixed version (ground truth):
public static void computeTriangleNormals(RenderObject r,int tgrp){
  int numt=r.numTriangles(tgrp);
  for (int i=0; i < numt; i++) {
    int[] idxs=r.getTriangle(tgrp,i);
    float[] p0=r.getVertexPosition(idxs[0]);
    float[] p1=r.getVertexPosition(idxs[1]);
    float[] p2=r.getVertexPosition(idxs[2]);
    float[] nrm=r.getVertexNormal(idxs[0]);
    float ax=p1[0] - p0[0];
    float ay=p1[1] - p0[1];
    float az=p1[2] - p0[2];
    float bx=p2[0] - p0[0];
    float by=p2[1] - p0[1];
    float bz=p2[2] - p0[2];
    float nx=ay * bz - az * by;
    float ny=az * bx - ax * bz;
    float nz=ax * by - ay * bx;
    float mag=(float)Math.sqrt(nx * nx + ny * ny + nz * nz);
    if (mag > 0) {
      nx/=mag;
      ny/=mag;
      nz/=mag;
    }
    nrm[0]=nx;
    nrm[1]=ny;
    nrm[2]=nz;
  }
  r.notifyNormalsModified();
}
Program: 70907
Project: 70907
Buggy source:
void render(Renderer renderer,FemElement3d elem,RenderProps props){
  RenderObject r=myRob;
  updatePositions(r,elem);
  renderer.setLightingEnabled(false);
  renderer.setLineWidth(props.getLineWidth());
  renderer.setColor(props.getLineColorArray(),elem.isSelected());
  renderer.drawLines(r);
  renderer.setLineWidth(1);
  renderer.setLightingEnabled(true);
  double s=elem.getElementWidgetSize();
  if (s > 0) {
    updateNormals(r,elem);
    if (!renderer.isSelecting()) {
      Material mat=props.getFaceMaterial();
      if (elem.isInverted()) {
        mat=FemModel3d.myInvertedMaterial;
      }
      renderer.setMaterial(mat,elem.isSelected());
    }
    if (s != 1.0) {
      float cx=0;
      float cy=0;
      float cz=0;
      FemNode[] nodes=elem.getNodes();
      int nnodes=nodes.length;
      for (int i=0; i < nnodes; i++) {
        FemNode n=nodes[i];
        cx+=n.myRenderCoords[0];
        cy+=n.myRenderCoords[1];
        cz+=n.myRenderCoords[2];
      }
      cx/=nnodes;
      cy/=nnodes;
      cz/=nnodes;
      renderer.pushModelMatrix();
      renderer.translateModelMatrix(cx * (1 - s),cy * (1 - s),cz * (1 - s));
      renderer.scaleModelMatrix(s);
      renderer.drawTriangles(r);
      renderer.popModelMatrix();
    }
 else {
      renderer.drawTriangles(r);
    }
  }
}

Fixed version (ground truth):
void render(Renderer renderer,FemElement3d elem,RenderProps props){
  RenderObject r=myRob;
  updatePositions(r,elem);
  renderer.setLightingEnabled(false);
  renderer.setLineWidth(props.getLineWidth());
  renderer.setColor(props.getLineColorArray(),elem.isSelected());
  renderer.drawLines(r);
  renderer.setLineWidth(1);
  renderer.setLightingEnabled(true);
  Shading shading=props.getShading();
  boolean restoreLighting=false;
  if (shading == Shading.NONE) {
    renderer.setLightingEnabled(false);
    restoreLighting=true;
  }
  double s=elem.getElementWidgetSize();
  if (s > 0) {
    updateNormals(r,elem);
    if (!renderer.isSelecting()) {
      Material mat=props.getFaceMaterial();
      if (elem.isInverted()) {
        mat=FemModel3d.myInvertedMaterial;
      }
      renderer.setMaterial(mat,elem.isSelected());
    }
    if (s != 1.0) {
      float cx=0;
      float cy=0;
      float cz=0;
      FemNode[] nodes=elem.getNodes();
      int nnodes=nodes.length;
      for (int i=0; i < nnodes; i++) {
        FemNode n=nodes[i];
        cx+=n.myRenderCoords[0];
        cy+=n.myRenderCoords[1];
        cz+=n.myRenderCoords[2];
      }
      cx/=nnodes;
      cy/=nnodes;
      cz/=nnodes;
      renderer.pushModelMatrix();
      renderer.translateModelMatrix(cx * (1 - s),cy * (1 - s),cz * (1 - s));
      renderer.scaleModelMatrix(s);
      renderer.drawTriangles(r);
      renderer.popModelMatrix();
    }
 else {
      renderer.drawTriangles(r);
    }
  }
  if (restoreLighting) {
    renderer.setLightingEnabled(true);
  }
}
Program: 70909
Project: 70909
Buggy source:
public static void main(String[] args){
  MultiViewer rot=new MultiViewer();
  rot.addGL2Viewer("String_Node_Str",30,30,640,480);
  rot.addGL3Viewer("String_Node_Str",670,30,640,480);
  rot.syncViews();
  addRenderObjects(rot);
  rot.setWindowSizes(640,480);
  rot.autoFitViewers();
}

Fixed version (ground truth):
public static void main(String[] args){
  GL2vsGL3Tester tester=new GL2vsGL3Tester();
  tester.run();
}
Program: 70910
Project: 70910
Buggy source:
public Object validateValue(ValueChangeEvent e,StringHolder errMsg){
  if (!attachedInputFileValid((String)e.getValue())) {
    if (errMsg != null) {
      errMsg.value="String_Node_Str";
    }
    return Property.IllegalValue;
  }
  if (errMsg != null) {
    errMsg.value=null;
  }
  return e.getValue();
}

Fixed version (ground truth):
public Object validateValue(ValueChangeEvent e,StringHolder errMsg){
  if (!attachedInputFileValid((String)e.getValue(),errMsg)) {
    return Property.IllegalValue;
  }
  if (errMsg != null) {
    errMsg.value=null;
  }
  return e.getValue();
}
Program: 70911
Project: 70911
Buggy source:
private boolean attachedInputFileValid(String path){
  if (path != null && !path.equals("String_Node_Str")) {
    if (!filePathExists(getFullPath(path))) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean attachedInputFileValid(String path,StringHolder errMsg){
  if (path != null && !path.equals("String_Node_Str")) {
    String fullPath=getFullPath(path);
    if (!filePathExists(fullPath)) {
      if (errMsg != null) {
        errMsg.value="String_Node_Str";
      }
      return false;
    }
 else {
      File file=new File(fullPath);
      if (file.isDirectory()) {
        if (errMsg != null) {
          errMsg.value="String_Node_Str";
        }
        return false;
      }
    }
  }
  return true;
}
Program: 70913
Project: 70913
Buggy source:
/** 
 * returns the full path according to a relative path and the working directory
 * @param relativePath relative path
 * @return full path
 */
protected String getFullPath(String relativePath){
  return ArtisynthPath.getWorkingDirPath() + File.separator + relativePath;
}

Fixed version (ground truth):
/** 
 * returns the full path according to a relative path and the working directory
 * @param relativePath relative path
 * @return full path
 */
protected String getFullPath(String relativePath){
  File f=new File(relativePath);
  if (f.isAbsolute()) {
    return f.getAbsolutePath();
  }
  return ArtisynthPath.getWorkingDirPath() + File.separator + relativePath;
}
Program: 70914
Project: 70914
Buggy source:
private boolean attachedOutputFileValid(String path){
  if (path != null && !path.equals("String_Node_Str")) {
    if (!filePathExists(getFullPath(path))) {
      File file=new File(getFullPath(path));
      File dir=file.getParentFile();
      if (dir == null || !dir.isDirectory()) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean attachedOutputFileValid(String path,StringHolder errMsg){
  if (path != null && !path.equals("String_Node_Str")) {
    String fullPath=getFullPath(path);
    if (!filePathExists(fullPath)) {
      File file=new File(fullPath);
      if (file.isDirectory()) {
        if (errMsg != null) {
          errMsg.value="String_Node_Str";
        }
        return false;
      }
      File dir=file.getParentFile();
      if (dir == null || !dir.isDirectory()) {
        if (errMsg != null) {
          errMsg.value="String_Node_Str";
        }
        return false;
      }
    }
  }
  return true;
}
Program: 70915
Project: 70915
Buggy source:
public Object validateValue(ValueChangeEvent e,StringHolder errMsg){
  if (!attachedOutputFileValid((String)e.getValue())) {
    if (errMsg != null) {
      errMsg.value="String_Node_Str";
    }
    return Property.IllegalValue;
  }
  if (errMsg != null) {
    errMsg.value=null;
  }
  return e.getValue();
}

Fixed version (ground truth):
public Object validateValue(ValueChangeEvent e,StringHolder errMsg){
  if (!attachedOutputFileValid((String)e.getValue(),errMsg)) {
    return Property.IllegalValue;
  }
  if (errMsg != null) {
    errMsg.value=null;
  }
  return e.getValue();
}
Program: 70916
Project: 70916
Buggy source:
public void valueChange(ValueChangeEvent v){
  if (v.getSource() == attachedFileField) {
    String newPath=attachedFileField.getStringValue();
    if (newPath == originalFilePath) {
      return;
    }
    originalFilePath=newPath;
    String fullPath=ArtisynthPath.getWorkingDirPath() + File.separator + newPath;
    File tmpFile=new File(fullPath);
    if (tmpFile.exists()) {
    }
 else {
      if (tmpFile.getParentFile().exists()) {
        try {
          boolean ok=tmpFile.createNewFile();
        }
 catch (        Exception e) {
          System.out.println(e.getMessage());
        }
      }
 else {
        if (JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
          System.out.println("String_Node_Str");
          tmpFile.getParentFile().mkdirs();
          try {
            tmpFile.createNewFile();
          }
 catch (          Exception e) {
            System.out.println(e.getMessage());
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void valueChange(ValueChangeEvent v){
  if (v.getSource() == attachedFileField) {
    String newPath=attachedFileField.getStringValue();
    if (newPath == originalFilePath) {
      return;
    }
    File newFile=new File(newPath);
    originalFilePath=newPath;
    String fullPath=newPath;
    if (!newFile.isAbsolute()) {
      fullPath=ArtisynthPath.getWorkingDirPath() + File.separator + newPath;
    }
    File tmpFile=new File(fullPath);
    if (tmpFile.exists()) {
      if (tmpFile.isDirectory()) {
      }
    }
 else {
      if (tmpFile.getParentFile().exists()) {
        try {
          boolean ok=tmpFile.createNewFile();
        }
 catch (        Exception e) {
          System.out.println(e.getMessage());
        }
      }
 else {
        if (JOptionPane.showConfirmDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
          System.out.println("String_Node_Str");
          tmpFile.getParentFile().mkdirs();
          try {
            tmpFile.createNewFile();
          }
 catch (          Exception e) {
            System.out.println(e.getMessage());
          }
        }
      }
    }
  }
}
Program: 70917
Project: 70917
Buggy source:
/** 
 * Override to account for property selector
 */
protected void updateDisplay(boolean forceUpdate){
  String[] newText=null;
  Object value=getInternalValue();
  BooleanHolder corrected=new BooleanHolder();
  if (value == Property.VoidValue) {
    newText=new String[]{"String_Node_Str","String_Node_Str"};
  }
 else {
    Object textValue=textToValue(getText(),corrected,null);
    if (forceUpdate || textValue == Property.IllegalValue || corrected.value || !valuesEqual(textValue,value)) {
      newText=valueToTextArray(value);
    }
  }
  if (newText != null) {
    myLastText=newText[0];
    myTextField.setText(newText[0]);
    if (myPropertySelector != null) {
      myLastPropName=newText[1];
      if ("String_Node_Str".equals(newText[1])) {
        myPropertySelector.setValue(nullString);
      }
 else {
        myPropertySelector.setValue(newText[1]);
      }
    }
 else {
      if (newText[1] != null && !"String_Node_Str".equals(newText[1])) {
        myLastText=newText[0] + "String_Node_Str" + newText[1];
        myTextField.setText(myLastText);
      }
    }
  }
 else {
    myLastText=myTextField.getText();
    if (myPropertySelector != null) {
      String propValue=(String)(myPropertySelector.getValue());
      myLastPropName=propValue;
    }
  }
  setReverseTextBackground(false);
}

Fixed version (ground truth):
/** 
 * Override to account for property selector
 */
protected void updateDisplay(boolean forceUpdate){
  String[] newText=null;
  Object value=getInternalValue();
  BooleanHolder corrected=new BooleanHolder();
  if (value == Property.VoidValue) {
    newText=new String[]{"String_Node_Str","String_Node_Str"};
  }
 else {
    Object textValue=textToValue(getText(),corrected,null);
    if (forceUpdate || textValue == Property.IllegalValue || corrected.value || !valuesEqual(textValue,value)) {
      newText=valueToTextArray(value);
    }
  }
  if (newText != null) {
    myLastText=newText[0];
    myTextField.setText(newText[0]);
    if (myPropertiesAllowed) {
      myPropertyMask=true;
      myLastPropName=newText[1];
      if ("String_Node_Str".equals(newText[1])) {
        myPropertySelector.setValue(nullString);
      }
 else {
        myPropertySelector.setValue(newText[1]);
      }
      myPropertyMask=false;
    }
 else {
      if (newText[1] != null && !"String_Node_Str".equals(newText[1])) {
        myLastText=newText[0] + "String_Node_Str" + newText[1];
        myTextField.setText(myLastText);
      }
    }
  }
 else {
    myLastText=myTextField.getText();
    if (myPropertySelector != null) {
      String propValue=(String)(myPropertySelector.getValue());
      myLastPropName=propValue;
    }
  }
  setReverseTextBackground(false);
}
Program: 70918
Project: 70918
Buggy source:
private void setValueFromPropertySelector(){
  String propName=(String)myPropertySelector.getValue();
  HasProperties host=getHost();
  if (propName.equals(nullString)) {
    Object value=getValueForHost();
    System.out.println("String_Node_Str");
    updateValueAndDisplay(value);
    return;
  }
  if (host == null) {
    throw new InternalErrorException("String_Node_Str");
  }
  Property prop=host.getProperty(propName);
  if (prop == null) {
    throw new InternalErrorException("String_Node_Str" + propName);
  }
  updateValueAndDisplay(prop);
}

Fixed version (ground truth):
private void setValueFromPropertySelector(){
  if (!myPropertyMask) {
    String propName=(String)myPropertySelector.getValue();
    HasProperties host=getHost();
    if (propName.equals(nullString)) {
      Object value=getValueForHost();
      System.out.println("String_Node_Str");
      updateValueAndDisplay(value);
      return;
    }
    if (host == null) {
      throw new InternalErrorException("String_Node_Str");
    }
    Property prop=host.getProperty(propName);
    if (prop == null) {
      throw new InternalErrorException("String_Node_Str" + propName);
    }
    updateValueAndDisplay(prop);
  }
}
Program: 70919
Project: 70919
Buggy source:
protected String valueToText(Object value){
  ModelComponent comp=getComponent(value);
  RootModel root=myMain.getRootModel();
  if (root == null || comp == null) {
    return "String_Node_Str";
  }
  if (value instanceof ModelComponent) {
    return ComponentUtils.getPathName(root,comp);
  }
 else   if (value instanceof Property) {
    Property prop=(Property)value;
    boolean excludeLeaf=(myPropertySelector != null && !(prop.get() instanceof CompositeProperty));
    String path=ComponentUtils.getPropertyPathName(prop,root,excludeLeaf);
    if (!path.contains("String_Node_Str")) {
      path="String_Node_Str" + path;
    }
    return path;
  }
 else {
    throw new InternalErrorException("String_Node_Str" + value.getClass());
  }
}

Fixed version (ground truth):
protected String valueToText(Object value){
  ModelComponent comp=getComponent(value);
  RootModel root=myMain.getRootModel();
  if (root == null || comp == null) {
    return "String_Node_Str";
  }
  if (value instanceof ModelComponent) {
    return ComponentUtils.getPathName(root,comp);
  }
 else   if (value instanceof Property) {
    Property prop=(Property)value;
    boolean excludeLeaf=(myPropertySelector != null && !(prop.get() instanceof CompositeProperty));
    String path=ComponentUtils.getPropertyPathName(prop,root,false);
    if (!path.contains("String_Node_Str")) {
      path="String_Node_Str" + path;
    }
    return path;
  }
 else {
    throw new InternalErrorException("String_Node_Str" + value.getClass());
  }
}
Program: 70920
Project: 70920
Buggy source:
protected String[] valueToTextArray(Object value){
  ModelComponent comp=getComponent(value);
  RootModel root=myMain.getRootModel();
  String compStr="String_Node_Str";
  String propStr="String_Node_Str";
  if (root == null || comp == null) {
    return new String[]{"String_Node_Str","String_Node_Str"};
  }
  if (value instanceof ModelComponent) {
    compStr=ComponentUtils.getPathName(root,comp);
  }
 else   if (value instanceof Property) {
    Property prop=(Property)value;
    boolean excludeLeaf=(myPropertySelector != null && !(prop.get() instanceof CompositeProperty));
    String path=ComponentUtils.getPropertyPathName(prop,root,excludeLeaf);
    int idx=path.indexOf(':');
    propStr=path;
    if (idx >= 0) {
      compStr=path.substring(0,idx);
      if (idx < path.length() - 1) {
        propStr=path.substring(idx + 1);
      }
    }
  }
 else {
    throw new InternalErrorException("String_Node_Str" + value.getClass());
  }
  return new String[]{compStr,propStr};
}

Fixed version (ground truth):
protected String[] valueToTextArray(Object value){
  ModelComponent comp=getComponent(value);
  RootModel root=myMain.getRootModel();
  String compStr="String_Node_Str";
  String propStr="String_Node_Str";
  if (root == null || comp == null) {
    return new String[]{"String_Node_Str","String_Node_Str"};
  }
  if (value instanceof ModelComponent) {
    compStr=ComponentUtils.getPathName(root,comp);
  }
 else   if (value instanceof Property) {
    Property prop=(Property)value;
    boolean excludeLeaf=(myPropertySelector != null && !(prop.get() instanceof CompositeProperty));
    String path=ComponentUtils.getPropertyPathName(prop,root,false);
    int idx=path.indexOf(':');
    propStr=path;
    if (idx >= 0) {
      compStr=path.substring(0,idx);
      if (idx < path.length() - 1) {
        propStr=path.substring(idx + 1);
      }
    }
  }
 else {
    throw new InternalErrorException("String_Node_Str" + value.getClass());
  }
  return new String[]{compStr,propStr};
}
Program: 70921
Project: 70921
Buggy source:
private void setValueFromDisplay(){
  if (myAlwaysParseText || !myLastText.equals(myTextField.getText())) {
    StringHolder errMsg=new StringHolder();
    BooleanHolder corrected=new BooleanHolder();
    Object value=textToValue(myTextField.getText(),corrected,errMsg);
    if (value != Property.IllegalValue) {
      value=validateValue(value,errMsg);
    }
    if (value == Property.IllegalValue) {
      focusListenerMasked=true;
      JOptionPane.showMessageDialog(LabeledTextField.this,errMsg.value,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      focusListenerMasked=false;
      myTextField.setText(myLastText);
      updateDisplay();
      myLastEntryAccepted=false;
      return;
    }
    updateValue(value);
    updateDisplay();
  }
 else {
    setReverseTextBackground(false);
  }
  myLastEntryAccepted=true;
}

Fixed version (ground truth):
protected void setValueFromDisplay(){
  if (myAlwaysParseText || !myLastText.equals(myTextField.getText())) {
    StringHolder errMsg=new StringHolder();
    BooleanHolder corrected=new BooleanHolder();
    Object value=textToValue(myTextField.getText(),corrected,errMsg);
    if (value != Property.IllegalValue) {
      value=validateValue(value,errMsg);
    }
    if (value == Property.IllegalValue) {
      focusListenerMasked=true;
      JOptionPane.showMessageDialog(LabeledTextField.this,errMsg.value,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      focusListenerMasked=false;
      myTextField.setText(myLastText);
      updateDisplay();
      myLastEntryAccepted=false;
      return;
    }
    updateValue(value);
    updateDisplay();
  }
 else {
    setReverseTextBackground(false);
  }
  myLastEntryAccepted=true;
}
Program: 70922
Project: 70922
Buggy source:
@Override public int hashCode(){
  return mesh.hashCode() + version + style.hashCode() * 17 + sphereDL * 7 + Double.hashCode(r) * 83 + shading.hashCode() * 41 + (useVertexColors ? 11 : 17) + (useTextures ? 19 : 23);
}

Fixed version (ground truth):
@Override public int hashCode(){
  return mesh.hashCode() + version + style.hashCode() * 17 + sphereDL * 7 + GLSupport.hashCode(r) * 83 + shading.hashCode() * 41 + (useVertexColors ? 11 : 17) + (useTextures ? 19 : 23);
}
Program: 70923
Project: 70923
Buggy source:
@Override public int hashCode(){
  return mesh.hashCode() + version + style.hashCode() * 17 + +slices * 3 + Double.hashCode(r) * 83 + shading.hashCode() * 41 + (useVertexColors ? 11 : 17) + (useTextures ? 19 : 23);
}

Fixed version (ground truth):
@Override public int hashCode(){
  return mesh.hashCode() + version + style.hashCode() * 17 + +slices * 3 + GLSupport.hashCode(r) * 83 + shading.hashCode() * 41 + (useVertexColors ? 11 : 17) + (useTextures ? 19 : 23);
}
Program: 70924
Project: 70924
Buggy source:
public void getCurrentVel(Vector3d vel,Vector3d dvel){
  if (myNodes != null) {
    double[] coords=myCoords.getBuffer();
    vel.setZero();
    for (int i=0; i < myNodes.length; i++) {
      vel.scaledAdd(coords[i],myNodes[i].getPosition(),vel);
    }
    if (dvel != null) {
      computeVelDerivative(dvel);
    }
  }
 else {
    vel.setZero();
    if (dvel != null) {
      dvel.setZero();
    }
  }
}

Fixed version (ground truth):
public void getCurrentVel(Vector3d vel,Vector3d dvel){
  if (myNodes != null) {
    double[] coords=myCoords.getBuffer();
    vel.setZero();
    for (int i=0; i < myNodes.length; i++) {
      vel.scaledAdd(coords[i],myNodes[i].getVelocity(),vel);
    }
    if (dvel != null) {
      computeVelDerivative(dvel);
    }
  }
 else {
    vel.setZero();
    if (dvel != null) {
      dvel.setZero();
    }
  }
}
Program: 70925
Project: 70925
Buggy source:
private void clearAll(GL3 gl){
  dynamicMask=0;
  dynamicVertexSize=0;
  staticMask=0;
  staticVertexSize=0;
  nVertices=0;
  positionInfo=null;
  normalInfo=null;
  colorInfo=null;
  textureInfo=null;
  lineInfo=null;
  headInfo=null;
  if (lglos != null) {
    for (    GL3Object glo : lglos) {
      glo.release(gl);
    }
  }
  lglos=null;
  if (hglos != null) {
    for (    GL3Object glo : hglos) {
      glo.release(gl);
    }
  }
  hglos=null;
  gloInfo=null;
  if (vbos != null) {
    for (    BufferObject vbo : vbos) {
      vbo.release(gl);
    }
  }
  vbos=null;
  positionPutter=null;
  normalPutter=null;
  colorPutter=null;
  texturePutter=null;
  lastVersionInfo=null;
  lastLineObject=null;
  lastLineRadius=-1;
  lastHeadObject=null;
  lastHeadRadius=-1;
  lastHeadLength=-1;
}

Fixed version (ground truth):
private void clearAll(GL3 gl){
  dynamicMask=0;
  dynamicVertexSize=0;
  staticMask=0;
  staticVertexSize=0;
  nVertices=0;
  positionInfo=null;
  normalInfo=null;
  colorInfo=null;
  textureInfo=null;
  lineInfo=null;
  headInfo=null;
  lineGroupOffsets=null;
  if (lglos != null) {
    for (    GL3Object glo : lglos) {
      glo.release(gl);
    }
  }
  lglos=null;
  if (hglos != null) {
    for (    GL3Object glo : hglos) {
      glo.release(gl);
    }
  }
  hglos=null;
  gloInfo=null;
  if (vbos != null) {
    for (    BufferObject vbo : vbos) {
      vbo.release(gl);
    }
  }
  vbos=null;
  positionPutter=null;
  normalPutter=null;
  colorPutter=null;
  texturePutter=null;
  lastVersionInfo=null;
  lastLineObject=null;
  lastLineRadius=-1;
  lastHeadObject=null;
  lastHeadRadius=-1;
  lastHeadLength=-1;
}
Program: 70926
Project: 70926
Buggy source:
public GL3RenderObjectLines(RenderObject r){
  this.roId=r.getIdentifier();
  this.roState=r.getStateInfo();
  vbos=null;
  lglos=null;
  hglos=null;
  gloInfo=null;
  positionInfo=null;
  normalInfo=null;
  colorInfo=null;
  textureInfo=null;
  lastVersionInfo=null;
  lastLineObject=null;
  lastLineRadius=-1;
  lastHeadObject=null;
  lastHeadRadius=-1;
  lastHeadLength=-1;
  staticVertexSize=0;
  staticMask=0;
  dynamicVertexSize=0;
  dynamicMask=0;
  nVertices=0;
}

Fixed version (ground truth):
public GL3RenderObjectLines(RenderObject r){
  this.roId=r.getIdentifier();
  this.roState=r.getStateInfo();
  vbos=null;
  lglos=null;
  hglos=null;
  gloInfo=null;
  positionInfo=null;
  normalInfo=null;
  colorInfo=null;
  textureInfo=null;
  lineGroupOffsets=null;
  lastVersionInfo=null;
  lastLineObject=null;
  lastLineRadius=-1;
  lastHeadObject=null;
  lastHeadRadius=-1;
  lastHeadLength=-1;
  staticVertexSize=0;
  staticMask=0;
  dynamicVertexSize=0;
  dynamicMask=0;
  nVertices=0;
}
Program: 70930
Project: 70930
Buggy source:
public int add1DFrictionConstraints(SparseBlockMatrix DT,FrictionInfo[] finfo,double mu,int numf){
  Vector3d dir=new Vector3d();
  if (myMasters.size() > 0 && computeFrictionDir(dir) > 0) {
    finfo[numf].mu=mu;
    finfo[numf].contactIdx0=mySolveIndex;
    finfo[numf].contactIdx1=-1;
    finfo[numf].flags=FrictionInfo.BILATERAL;
    for (int i=0; i < myMasters.size(); i++) {
      ContactMaster cm=myMasters.get(i);
      int bi=cm.getSolveIndex();
      if (bi != -1) {
        MatrixBlock blk=cm.get1DFrictionBlock(dir);
        Vector3d tmp=new Vector3d();
        tmp.x=blk.get(0,0);
        tmp.y=blk.get(1,0);
        tmp.z=blk.get(2,0);
        DT.addBlock(bi,numf,blk);
      }
    }
    numf++;
  }
  return numf;
}

Fixed version (ground truth):
public int add1DFrictionConstraints(SparseBlockMatrix DT,FrictionInfo[] finfo,double mu,int numf){
  Vector3d dir=new Vector3d();
  if (myMasters.size() > 0 && computeFrictionDir(dir) > 0 && mu > 0) {
    finfo[numf].mu=mu;
    finfo[numf].contactIdx0=mySolveIndex;
    finfo[numf].contactIdx1=-1;
    finfo[numf].flags=FrictionInfo.BILATERAL;
    for (int i=0; i < myMasters.size(); i++) {
      ContactMaster cm=myMasters.get(i);
      int bi=cm.getSolveIndex();
      if (bi != -1) {
        MatrixBlock blk=cm.get1DFrictionBlock(dir);
        Vector3d tmp=new Vector3d();
        tmp.x=blk.get(0,0);
        tmp.y=blk.get(1,0);
        tmp.z=blk.get(2,0);
        DT.addBlock(bi,numf,blk);
      }
    }
    numf++;
  }
  return numf;
}