nus-yam/ex-repair huggingface dataset:
Program: 70659
Project: 70659
Buggy source:
private void takeScreenshot(){
  String movieFileName=filename.getText();
  if (movieFileName.equals("String_Node_Str")) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
    filename.requestFocusInWindow();
  }
 else {
    boolean stopEnabled=stopButton.isEnabled();
    boolean startEnabled=startButton.isEnabled();
    stopButton.setEnabled(false);
    startButton.setEnabled(false);
    tmpDirectory=ArtisynthPath.getTempDir().getAbsolutePath();
    File testdir=new File(tmpDirectory);
    if (!testdir.exists()) {
      System.out.println("String_Node_Str" + tmpDirectory);
      testdir.mkdir();
    }
 else     if (!testdir.isDirectory()) {
      System.err.println("String_Node_Str" + tmpDirectory + "String_Node_Str");
      filename.requestFocusInWindow();
      return;
    }
    setAreaSelectionFrame(null);
    showCaptureFrame.setSelected(false);
    try {
      myMovieMaker.grab(tmpDirectory + "String_Node_Str" + movieFileName);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    stopButton.setEnabled(stopEnabled);
    startButton.setEnabled(startEnabled);
  }
}

Fixed version (ground truth):
private void takeScreenshot(){
  String movieFileName=filename.getText();
  if (movieFileName.equals("String_Node_Str")) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
    filename.requestFocusInWindow();
  }
 else {
    boolean stopEnabled=stopButton.isEnabled();
    boolean startEnabled=startButton.isEnabled();
    stopButton.setEnabled(false);
    startButton.setEnabled(false);
    tmpDirectory=workingDirField.getText();
    File testdir=new File(tmpDirectory);
    if (!testdir.exists()) {
      System.out.println("String_Node_Str" + tmpDirectory);
      testdir.mkdir();
    }
 else     if (!testdir.isDirectory()) {
      System.err.println("String_Node_Str" + tmpDirectory + "String_Node_Str");
      filename.requestFocusInWindow();
      return;
    }
    setAreaSelectionFrame(null);
    showCaptureFrame.setSelected(false);
    try {
      myMovieMaker.grab(tmpDirectory + "String_Node_Str" + movieFileName);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
    stopButton.setEnabled(stopEnabled);
    startButton.setEnabled(startEnabled);
  }
}
Program: 70663
Project: 70663
Buggy source:
public void resetProbes(RootModel root,TrackingController controller){
  if (root != null) {
    findOrCreateProbes(root,controller);
    configureProbes(controller);
  }
}

Fixed version (ground truth):
public void resetProbes(RootModel root,TrackingController controller){
  if (root != null) {
    root.removeAllInputProbes();
    root.removeAllOutputProbes();
    findOrCreateProbes(root,controller);
    configureProbes(controller);
  }
}
Program: 70664
Project: 70664
Buggy source:
/** 
 * Returns <code>t0</code> modulo <code>t1</code>,  within the tolerance specified by   {@link #PRECISION}.
 * @return t0 % t1 within {@link #PRECISION}.
 */
public static double modulo(double t0,double t1){
  long l0=(long)Math.rint(t0 * PRECISION);
  long l1=(long)Math.rint(t1 * PRECISION);
  return (l0 % l1) / PRECISION;
}

Fixed version (ground truth):
/** 
 * Returns <code>t0</code> modulo <code>t1</code>,  within the tolerance specified by   {@link #PRECISION}.
 * @return t0 % t1 within {@link #PRECISION}.
 */
public static double modulo(double t0,double t1){
  long l0=(long)Math.round(t0 * PRECISION);
  long l1=(long)Math.round(t1 * PRECISION);
  return (l0 % l1) / PRECISION;
}
Program: 70665
Project: 70665
Buggy source:
public void transformGeometry(GeometryTransformer gt,RigidTransform3d TFW,RigidTransform3d TDW){
  if (doCouplingTransform) {
    for (int i=0; i < myPoints.size(); i++) {
      Point3d pnt=myPoints.get(i);
      pnt.transform(TDW);
      gt.transformPnt(pnt);
      pnt.inverseTransform(TDW);
    }
    makePlanesFromSegments(myPoints);
  }
}

Fixed version (ground truth):
public void transformGeometry(GeometryTransformer gt,RigidTransform3d TFW,RigidTransform3d TDW){
  if (doCouplingTransform) {
    RigidTransform3d TDWnew=new RigidTransform3d(TDW);
    gt.transform(TDWnew);
    Vector3d del0=new Vector3d();
    del0.set(myPoints.get(0));
    for (int i=0; i < myPoints.size(); i++) {
      Point3d pnt=myPoints.get(i);
      pnt.transform(TDW);
      gt.transformPnt(pnt);
      pnt.inverseTransform(TDWnew);
    }
    makePlanesFromSegments(myPoints);
  }
}
Program: 70666
Project: 70666
Buggy source:
protected void maybeUpdateMaterials(GL3 gl){
  if (isSelecting()) {
    if (mySelectingColorModified && myCommittedProgramInfo != null && myCommittedProgramInfo.isSelecting()) {
      myProgManager.setSelectionColor(gl,myCommittedProgram,mySelectingColor);
      mySelectingColorModified=false;
    }
  }
 else {
    if (myCurrentMaterial.getAlpha() != myHighlightColor[3]) {
      myHighlightColor[3]=myCurrentMaterial.getAlpha();
      myHighlightColorModified=true;
    }
    if (myCurrentMaterialModified || myHighlightColorModified || myCommittedColor != myActiveColor) {
      if (myActiveColor == ActiveColor.HIGHLIGHT) {
        myProgManager.setMaterials(gl,myCurrentMaterial,myHighlightColor,myCurrentMaterial,myHighlightColor);
        myHighlightColorModified=false;
      }
 else {
        myProgManager.setMaterials(gl,myCurrentMaterial,myCurrentMaterial.getDiffuse(),myCurrentMaterial,myBackColor);
      }
      myCurrentMaterialModified=false;
      myCommittedColor=myActiveColor;
    }
  }
}

Fixed version (ground truth):
protected void maybeUpdateMaterials(GL3 gl){
  if (isSelecting()) {
    if (mySelectingColorModified && myCommittedProgram != null && myCommittedProgramInfo.isSelecting()) {
      myProgManager.setSelectionColor(gl,myCommittedProgram,mySelectingColor);
      mySelectingColorModified=false;
    }
  }
 else {
    if (myCurrentMaterial.getAlpha() != myHighlightColor[3]) {
      myHighlightColor[3]=myCurrentMaterial.getAlpha();
      myHighlightColorModified=true;
    }
    if (myCurrentMaterialModified || myHighlightColorModified || myCommittedColor != myActiveColor) {
      if (myActiveColor == ActiveColor.HIGHLIGHT) {
        myProgManager.setMaterials(gl,myCurrentMaterial,myHighlightColor,myCurrentMaterial,myHighlightColor);
        myHighlightColorModified=false;
      }
 else {
        myProgManager.setMaterials(gl,myCurrentMaterial,myCurrentMaterial.getDiffuse(),myCurrentMaterial,myBackColor);
      }
      myCurrentMaterialModified=false;
      myCommittedColor=myActiveColor;
    }
  }
}
Program: 70667
Project: 70667
Buggy source:
private static void addVertexOutputs(StringBuilder hb,GLProgramInfo info){
  RenderingMode instanced=info.getMode();
  boolean hasColors=(!info.isSelecting()) && (info.getVertexColorMixing() != ColorMixing.NONE) && (info.hasVertexColors() || ((instanced == RenderingMode.INSTANCED_POINTS || instanced == RenderingMode.INSTANCED_FRAMES || instanced == RenderingMode.INSTANCED_AFFINES) && info.hasInstanceColors()) || (instanced == RenderingMode.INSTANCED_LINES && info.hasLineColors()));
  boolean hasTextures=!info.isSelecting() && info.hasVertexTextures() && info.hasTextureMap();
  if (hasColors) {
    appendln(hb,"String_Node_Str");
    appendln(hb,"String_Node_Str");
    if (info.getColorInterpolation() == ColorInterpolation.NONE) {
      appendln(hb,"String_Node_Str");
    }
 else {
      appendln(hb,"String_Node_Str");
    }
    appendln(hb,"String_Node_Str");
    appendln(hb);
  }
  if (hasTextures) {
    appendln(hb,"String_Node_Str");
    appendln(hb,"String_Node_Str");
    appendln(hb,"String_Node_Str");
    appendln(hb,"String_Node_Str");
    appendln(hb);
  }
}

Fixed version (ground truth):
private static void addVertexOutputs(StringBuilder hb,GLProgramInfo info){
  RenderingMode instanced=info.getMode();
  boolean hasColors=(!info.isSelecting()) && (info.getVertexColorMixing() != ColorMixing.NONE) && (info.hasVertexColors() || ((instanced == RenderingMode.INSTANCED_POINTS || instanced == RenderingMode.INSTANCED_FRAMES || instanced == RenderingMode.INSTANCED_AFFINES) && info.hasInstanceColors()) || (instanced == RenderingMode.INSTANCED_LINES && info.hasLineColors()));
  boolean hasTextures=hasTextures(info);
  if (hasColors) {
    appendln(hb,"String_Node_Str");
    appendln(hb,"String_Node_Str");
    if (info.getColorInterpolation() == ColorInterpolation.NONE) {
      appendln(hb,"String_Node_Str");
    }
 else {
      appendln(hb,"String_Node_Str");
    }
    appendln(hb,"String_Node_Str");
    appendln(hb);
  }
  if (hasTextures) {
    appendln(hb,"String_Node_Str");
    appendln(hb,"String_Node_Str");
    appendln(hb,"String_Node_Str");
    appendln(hb,"String_Node_Str");
    appendln(hb);
  }
}
Program: 70671
Project: 70671
Buggy source:
/** 
 * Checks each knot in this segment to see if it is intersecting any wrappables, and if so, computes the contact normal and distance. If a knot intersects multiple wrappables, then the one with the deepest penetration is used. <p>This method returns <code>true</code> if the contact configuration has changed.
 * @param getStiffness TODO
 */
boolean updateContacts(int[] contactCnts,boolean getStiffness){
  boolean changed=false;
  Vector3d nrml=new Vector3d();
  Matrix3d dnrm=getStiffness ? new Matrix3d() : null;
  if (contactCnts != null) {
    for (int i=0; i < contactCnts.length; i++) {
      contactCnts[i]=0;
    }
  }
  for (int k=0; k < myNumKnots; k++) {
    WrapKnot knot=myKnots[k];
    Wrappable lastWrappable=knot.getWrappable();
    knot.myPrevDist=knot.myDist;
    knot.myPrevWrappableIdx=knot.myWrappableIdx;
    knot.setWrappableIdx(-1);
    knot.myDist=Wrappable.OUTSIDE;
    for (int i=0; i < myWrappables.size(); i++) {
      Wrappable wrappable=myWrappables.get(i);
      double d=wrappable.penetrationDistance(nrml,dnrm,knot.myPos);
      if (d < knot.myDist) {
        knot.myDist=d;
        if (d < 0) {
          knot.setWrappableIdx(i);
          if (contactCnts != null) {
            contactCnts[i]++;
          }
          knot.myNrml.set(nrml);
          if (dnrm != null) {
            knot.myDnrm.set(dnrm);
          }
        }
      }
    }
    if (knot.getWrappable() != lastWrappable) {
      changed=true;
    }
  }
  return changed;
}

Fixed version (ground truth):
/** 
 * Checks each knot in this segment to see if it is intersecting any wrappables, and if so, computes the contact normal and distance. If a knot intersects multiple wrappables, then the one with the deepest penetration is used. <p>This method returns <code>true</code> if the contact configuration has changed.
 * @param getStiffness TODO
 */
boolean updateContacts(int[] contactCnts,boolean getStiffness){
  boolean changed=false;
  Vector3d nrml=new Vector3d();
  Matrix3d dnrm=getStiffness ? new Matrix3d() : null;
  if (contactCnts != null) {
    for (int i=0; i < contactCnts.length; i++) {
      contactCnts[i]=0;
    }
  }
  for (int k=0; k < myNumKnots; k++) {
    WrapKnot knot=myKnots[k];
    Wrappable lastWrappable=knot.getWrappable();
    if (contactCnts != null) {
      knot.myPrevDist=knot.myDist;
      knot.myPrevWrappableIdx=knot.myWrappableIdx;
    }
    knot.setWrappableIdx(-1);
    knot.myDist=Wrappable.OUTSIDE;
    for (int i=0; i < myWrappables.size(); i++) {
      Wrappable wrappable=myWrappables.get(i);
      double d=wrappable.penetrationDistance(nrml,dnrm,knot.myPos);
      if (d < knot.myDist) {
        knot.myDist=d;
        if (d < 0) {
          knot.setWrappableIdx(i);
          if (contactCnts != null) {
            contactCnts[i]++;
          }
          knot.myNrml.set(nrml);
          if (dnrm != null) {
            knot.myDnrm.set(dnrm);
          }
        }
      }
    }
    if (knot.getWrappable() != lastWrappable) {
      changed=true;
    }
  }
  return changed;
}
Program: 70673
Project: 70673
Buggy source:
void updateStiffnessNumerically(double dscale){
  double d=dscale * myWrapDamping / (myNumKnots * myNumKnots);
  MatrixNd KN=computeNumericStiffness();
  int numk=myNumKnots;
  Matrix3d B=new Matrix3d();
  for (int k=0; k < numk; k++) {
    KN.getSubMatrix(3 * k,3 * k,B);
    B.negate();
    B.m00+=d;
    B.m11+=d;
    B.m22+=d;
    myKnots[k].myBmat.set(B);
  }
}

Fixed version (ground truth):
void updateStiffnessNumerically(double dscale){
  double d=dscale * getWrapDamping() / (myNumKnots * myNumKnots);
  MatrixNd KN=computeNumericStiffness();
  int numk=myNumKnots;
  Matrix3d B=new Matrix3d();
  for (int k=0; k < numk; k++) {
    KN.getSubMatrix(3 * k,3 * k,B);
    B.negate();
    B.m00+=d;
    B.m11+=d;
    B.m22+=d;
    myKnots[k].myBmat.set(B);
  }
}
Program: 70674
Project: 70674
Buggy source:
double factorAndSolve(){
  double c=-myWrapStiffness;
  double d=myWrapDamping / (myNumKnots * myNumKnots);
  WrapKnot knot=myKnots[0];
  addToDiagonal(knot.myBinv,knot.myBmat,d);
  knot.myBinv.invert();
  knot.myCinv.scale(c,knot.myBinv);
  for (int i=1; i < myNumKnots; i++) {
    knot=myKnots[i];
    Matrix3d Binv=knot.myBinv;
    addToDiagonal(Binv,knot.myBmat,d);
    Binv.scaledAdd(-c,myKnots[i - 1].myCinv);
    Binv.invert();
    if (i < myNumKnots - 1) {
      knot.myCinv.scale(c,Binv);
    }
  }
  Vector3d vec=new Vector3d();
  Vector3d tmp=new Vector3d();
  knot=myKnots[0];
  knot.myBinv.mul(knot.myDvec,knot.myForce);
  for (int i=1; i < myNumKnots; i++) {
    knot=myKnots[i];
    vec.set(knot.myForce);
    vec.scaledAdd(-c,myKnots[i - 1].myDvec);
    knot.myBinv.mul(knot.myDvec,vec);
  }
  int k=myNumKnots - 1;
  vec.set(myKnots[k].myDvec);
  double maxd=0;
  while (--k >= 0) {
    knot=myKnots[k];
    knot.myCinv.mul(tmp,vec);
    vec.sub(knot.myDvec,tmp);
    knot.myDvec.set(vec);
    double m=vec.infinityNorm();
    if (m > maxd) {
      maxd=m;
    }
  }
  double s=1.0;
  if (maxd > getMaxWrapDisplacement()) {
    s=getMaxWrapDisplacement() / maxd;
    for (int i=0; i < myNumKnots; i++) {
      myKnots[i].myDvec.scale(s);
    }
  }
  return s;
}

Fixed version (ground truth):
double factorAndSolve(){
  double c=-myWrapStiffness;
  double d=getWrapDamping() / (myNumKnots * myNumKnots);
  WrapKnot knot=myKnots[0];
  addToDiagonal(knot.myBinv,knot.myBmat,d);
  knot.myBinv.invert();
  knot.myCinv.scale(c,knot.myBinv);
  for (int i=1; i < myNumKnots; i++) {
    knot=myKnots[i];
    Matrix3d Binv=knot.myBinv;
    addToDiagonal(Binv,knot.myBmat,d);
    Binv.scaledAdd(-c,myKnots[i - 1].myCinv);
    Binv.invert();
    if (i < myNumKnots - 1) {
      knot.myCinv.scale(c,Binv);
    }
  }
  Vector3d vec=new Vector3d();
  Vector3d tmp=new Vector3d();
  knot=myKnots[0];
  knot.myBinv.mul(knot.myDvec,knot.myForce);
  for (int i=1; i < myNumKnots; i++) {
    knot=myKnots[i];
    vec.set(knot.myForce);
    vec.scaledAdd(-c,myKnots[i - 1].myDvec);
    knot.myBinv.mul(knot.myDvec,vec);
  }
  int k=myNumKnots - 1;
  vec.set(myKnots[k].myDvec);
  double maxd=0;
  while (--k >= 0) {
    knot=myKnots[k];
    knot.myCinv.mul(tmp,vec);
    vec.sub(knot.myDvec,tmp);
    knot.myDvec.set(vec);
    double m=vec.infinityNorm();
    if (m > maxd) {
      maxd=m;
    }
  }
  double s=1.0;
  if (maxd > getMaxWrapDisplacement()) {
    s=getMaxWrapDisplacement() / maxd;
    for (int i=0; i < myNumKnots; i++) {
      myKnots[i].myDvec.scale(s);
    }
  }
  return s;
}
Program: 70675
Project: 70675
Buggy source:
/** 
 * Updates the stiffness matrix terms associated with each knot point. These give the force derivatives with respect to changes in knot position. The stiffness matrix structure is block-tridiagonal, where the diagonal blocks account for self-motion and changes wrappable repulsion forces, while the off-diagonal blocks account for the coupling between adjacent blocks.
 */
protected void updateStiffness(double dnrmGain,double dscale){
  double stiffness=myWrapStiffness;
  double cstiffness=myContactStiffness;
  double d=dscale * myWrapDamping / (myNumKnots * myNumKnots);
  double cd=dscale * myContactDamping / (myNumKnots * myNumKnots);
  for (int k=0; k < myNumKnots; k++) {
    WrapKnot knot=myKnots[k];
    double s=2 * stiffness;
    knot.myBmat.setDiagonal(s,s,s);
    if (knot.myDist < 0) {
      if (knot.getWrappable() instanceof RigidMesh) {
        knot.myBmat.scaledAdd(cstiffness,knot.myDnrm);
      }
 else {
        knot.myBmat.addScaledOuterProduct(cd + cstiffness,knot.myNrml,knot.myNrml);
        if (dnrmGain != 0) {
          knot.myBmat.scaledAdd(dnrmGain * knot.myDist * cstiffness,knot.myDnrm);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates the stiffness matrix terms associated with each knot point. These give the force derivatives with respect to changes in knot position. The stiffness matrix structure is block-tridiagonal, where the diagonal blocks account for self-motion and changes wrappable repulsion forces, while the off-diagonal blocks account for the coupling between adjacent blocks.
 */
protected void updateStiffness(double dnrmGain,double dscale){
  double stiffness=myWrapStiffness;
  double cstiffness=myContactStiffness;
  double d=dscale * getWrapDamping() / (myNumKnots * myNumKnots);
  double cd=dscale * myContactDamping / (myNumKnots * myNumKnots);
  for (int k=0; k < myNumKnots; k++) {
    WrapKnot knot=myKnots[k];
    double s=2 * stiffness;
    knot.myBmat.setDiagonal(s,s,s);
    if (knot.myDist < 0) {
      if (knot.getWrappable() instanceof RigidMesh) {
        knot.myBmat.scaledAdd(cstiffness,knot.myDnrm);
      }
 else {
        knot.myBmat.addScaledOuterProduct(cd + cstiffness,knot.myNrml,knot.myNrml);
        if (dnrmGain != 0) {
          knot.myBmat.scaledAdd(dnrmGain * knot.myDist * cstiffness,knot.myDnrm);
        }
      }
    }
  }
}
Program: 70680
Project: 70680
Buggy source:
/** 
 * Apply a function to each instance, separating points, frames, and affines.  Each instance type is assigned an index corresponding to its position within its own group in order of appearance  (i.e. point index 0 is the first point, 1 the second point, ...,  frame index 0 is the first frame, ...). order.
 * @param consumer
 */
public void forEachInstance(RenderInstanceConsumer consumer){
  int idx=0;
  int[] buff=instances.getArray();
  InstanceTransformType[] types=InstanceTransformType.values();
  int pidx=0;
  int fidx=0;
  int aidx=0;
  for (int i=0; i < stateInfo.numInstances; ++i) {
    int type=buff[idx++];
    int tidx=buff[idx++];
    int sidx=buff[idx++];
    int cidx=buff[idx++];
    InstanceTransformType tt=types[type];
switch (tt) {
case POINT:
      consumer.point(pidx,getPoint(tidx),getScale(sidx),getColor(cidx));
    ++pidx;
  break;
case FRAME:
consumer.frame(fidx,getFrame(tidx),getScale(sidx),getColor(cidx));
++fidx;
break;
case AFFINE:
consumer.affine(aidx,getAffine(tidx),getScale(sidx),getColor(cidx));
++aidx;
break;
}
}
}

Fixed version (ground truth):
/** 
 * Apply a function to each instance, separating points, frames, and affines.  Each instance type is assigned an index corresponding to its position within its own group in order of appearance  (i.e. point index 0 is the first point, 1 the second point, ...,  frame index 0 is the first frame, ...). order.
 * @param consumer
 */
public void forEachInstance(RenderInstanceConsumer consumer){
  int idx=0;
  int[] buff=getInstances();
  InstanceTransformType[] types=InstanceTransformType.values();
  int pidx=0;
  int fidx=0;
  int aidx=0;
  for (int i=0; i < stateInfo.numInstances; ++i) {
    int type=buff[idx++];
    int tidx=buff[idx++];
    int sidx=buff[idx++];
    int cidx=buff[idx++];
    InstanceTransformType tt=types[type];
switch (tt) {
case POINT:
      consumer.point(pidx,getPoint(tidx),getScale(sidx),getColor(cidx));
    ++pidx;
  break;
case FRAME:
consumer.frame(fidx,getFrame(tidx),getScale(sidx),getColor(cidx));
++fidx;
break;
case AFFINE:
consumer.affine(aidx,getAffine(tidx),getScale(sidx),getColor(cidx));
++aidx;
break;
}
}
}
Program: 70681
Project: 70681
Buggy source:
/** 
 * Number of instances defined
 */
public int numInstances(){
  return stateInfo.numScales;
}

Fixed version (ground truth):
/** 
 * Number of instances defined
 */
public int numInstances(){
  return stateInfo.numInstances;
}
Program: 70682
Project: 70682
Buggy source:
public int[] getInstances(){
  return instances.getArray();
}

Fixed version (ground truth):
public int[] getInstances(){
  if (instances == null) {
    instances=new DynamicIntArray();
  }
  return instances.getArray();
}
Program: 70683
Project: 70683
Buggy source:
/** 
 * Gets the mass for this spatial inertia.
 * @return mass
 */
public double getMass(){
  return mass;
}

Fixed version (ground truth):
/** 
 * Gets the mass for this spatial inertia.
 * @return mass
 */
public double getMass(){
  if (componentUpdateNeeded) {
    updateComponents();
  }
  return mass;
}
Program: 70684
Project: 70684
Buggy source:
public void setFaceColoring(RenderProps props,float[] rgba,boolean highlight){
  if (rgba != null) {
    setFrontColor(rgba);
    if (rgba.length == 3) {
      setFrontAlpha((float)props.getAlpha());
    }
  }
 else {
    setFrontColor(props.getFaceColorF());
  }
  setBackColor(props.getBackColorF());
  setShininess(props.getShininess());
  setEmission(DEFAULT_MATERIAL_EMISSION);
  float[] specular=props.getSpecularF();
  setSpecular(specular != null ? specular : DEFAULT_MATERIAL_SPECULAR);
  setHighlighting(highlight);
}

Fixed version (ground truth):
public void setFaceColoring(RenderProps props,float[] rgba,boolean highlight){
  setFrontColor(rgba);
  if (rgba.length == 3) {
    setFrontAlpha((float)props.getAlpha());
  }
  setBackColor(props.getBackColorF());
  setShininess(props.getShininess());
  setEmission(DEFAULT_MATERIAL_EMISSION);
  float[] specular=props.getSpecularF();
  setSpecular(specular != null ? specular : DEFAULT_MATERIAL_SPECULAR);
  setHighlighting(highlight);
}
Program: 70685
Project: 70685
Buggy source:
private void useProgram(GL3 gl,GLShaderProgram prog){
  if (prog != myCommittedProgram) {
    prog.use(gl);
    if (isSelecting()) {
      myProgManager.setSelectionColor(gl,prog,mySelectingColor);
      mySelectingColorModified=false;
    }
    myCommittedProgram=prog;
    if (shaderOverride != null) {
      myCommittedProgramInfo=myProgramInfo.clone();
    }
 else {
      myCommittedProgramInfo=null;
    }
  }
  maybeBindTextures(gl,prog);
}

Fixed version (ground truth):
private void useProgram(GL3 gl,GLShaderProgram prog){
  if (prog != myCommittedProgram) {
    prog.use(gl);
    if (isSelecting()) {
      myProgManager.setSelectionColor(gl,prog,mySelectingColor);
      mySelectingColorModified=false;
    }
    myCommittedProgram=prog;
    if (shaderOverride == null) {
      myCommittedProgramInfo=myProgramInfo.clone();
    }
 else {
      myCommittedProgramInfo=null;
    }
  }
  maybeBindTextures(gl,prog);
}
Program: 70686
Project: 70686
Buggy source:
private void offscreenCapture(GLFrameCapture fc,int flags){
  boolean savedSelecting=selectEnabled;
  selectEnabled=false;
  gl.setSwapInterval(1);
  fc.activateFBO(gl);
  boolean autoResize=setAutoResizeEnabled(false);
  boolean autoViewport=setAutoViewportEnabled(false);
  doDisplay(drawable,flags);
  setAutoResizeEnabled(autoResize);
  setAutoViewportEnabled(autoViewport);
  fireRerenderListeners();
  fc.capture(gl);
  fc.deactivateFBO(gl);
  selectEnabled=savedSelecting;
}

Fixed version (ground truth):
private void offscreenCapture(GLFrameCapture fc,int flags){
  boolean savedSelecting=selectEnabled;
  selectEnabled=false;
  fc.activateFBO(gl);
  boolean autoResize=setAutoResizeEnabled(false);
  boolean autoViewport=setAutoViewportEnabled(false);
  doDisplay(drawable,flags);
  setAutoResizeEnabled(autoResize);
  setAutoViewportEnabled(autoViewport);
  fireRerenderListeners();
  fc.capture(gl);
  fc.deactivateFBO(gl);
  selectEnabled=savedSelecting;
}
Program: 70687
Project: 70687
Buggy source:
public void setContent(TextureContent content){
  setFileName(defaultFileName);
  myContent=content;
}

Fixed version (ground truth):
public void setContent(TextureContent content){
  setFileName(defaultFileName);
  myContent=content.acquire();
}
Program: 70688
Project: 70688
Buggy source:
@Override public long releaseAndCount(){
  long ac=acquireCount.decrementAndGet();
  if (ac == -1) {
    System.err.println("String_Node_Str");
  }
  return ac;
}

Fixed version (ground truth):
@Override public long releaseAndCount(){
  long ac=acquireCount.decrementAndGet();
  if (ac == -1) {
    System.err.println("String_Node_Str" + this.getClass() + "String_Node_Str");
  }
  return ac;
}
Program: 70689
Project: 70689
Buggy source:
public void set(ColorMapProps props){
  super.set(props);
  myColorMixing=props.myColorMixing;
  myColorMixingMode=props.myColorMixingMode;
  myDiffuseColoring=props.myDiffuseColoring;
  myDiffuseColoringMode=props.myDiffuseColoringMode;
  mySpecularColoring=props.mySpecularColoring;
  mySpecularColoringMode=props.mySpecularColoringMode;
}

Fixed version (ground truth):
public void set(ColorMapProps props){
  super.set(props);
  myColorMixing=props.myColorMixing;
  myColorMixingMode=props.myColorMixingMode;
  myDiffuseColoring=props.myDiffuseColoring;
  myDiffuseColoringMode=props.myDiffuseColoringMode;
  mySpecularColoring=props.mySpecularColoring;
  mySpecularColoringMode=props.mySpecularColoringMode;
  myEmissionColoring=props.myEmissionColoring;
  myEmissionColoringMode=props.myEmissionColoringMode;
}
Program: 70690
Project: 70690
Buggy source:
public ColorMapProps clone(){
  ColorMapProps props=(ColorMapProps)super.clone();
  myColorMixing=props.myColorMixing;
  myColorMixingMode=props.myColorMixingMode;
  myDiffuseColoring=props.myDiffuseColoring;
  myDiffuseColoringMode=props.myDiffuseColoringMode;
  mySpecularColoring=props.mySpecularColoring;
  mySpecularColoringMode=props.mySpecularColoringMode;
  return props;
}

Fixed version (ground truth):
public ColorMapProps clone(){
  ColorMapProps props=(ColorMapProps)super.clone();
  myColorMixing=props.myColorMixing;
  myColorMixingMode=props.myColorMixingMode;
  myDiffuseColoring=props.myDiffuseColoring;
  myDiffuseColoringMode=props.myDiffuseColoringMode;
  mySpecularColoring=props.mySpecularColoring;
  mySpecularColoringMode=props.mySpecularColoringMode;
  myEmissionColoring=props.myEmissionColoring;
  myEmissionColoringMode=props.myEmissionColoringMode;
  return props;
}
Program: 70691
Project: 70691
Buggy source:
public String toString(){
  return (super.toString() + "String_Node_Str" + myColorMixing+ "String_Node_Str"+ myDiffuseColoring+ "String_Node_Str"+ mySpecularColoring);
}

Fixed version (ground truth):
public String toString(){
  return (super.toString() + "String_Node_Str" + myColorMixing+ "String_Node_Str"+ myDiffuseColoring+ "String_Node_Str"+ mySpecularColoring+ "String_Node_Str"+ myEmissionColoring);
}
Program: 70692
Project: 70692
Buggy source:
@Override public boolean isValid(){
  return ibo.isValid();
}

Fixed version (ground truth):
@Override public boolean isValid(){
  if (ibo == null) {
    return false;
  }
  return ibo.isValid();
}
Program: 70693
Project: 70693
Buggy source:
public void display(GLAutoDrawable drawable,int flags){
  this.drawable=drawable;
  this.gl=drawable.getGL().getGL2();
  if (!myInternalRenderListValid) {
    buildInternalRenderList();
  }
  maybeUpdateState(gl);
  if (selectTrigger) {
    mySelector.setupSelection(gl);
    selectEnabled=true;
    selectTrigger=false;
  }
  drawable.setAutoSwapBufferMode(selectEnabled ? false : true);
  if (myProfiling) {
    myTimer.start();
    myGLColorCount=0;
  }
  doDisplay(drawable,flags);
  if (myProfiling) {
    myTimer.stop();
    System.out.printf("String_Node_Str",myTimer.getTimeUsec() / 1000.0,isSelecting() ? "String_Node_Str" : "String_Node_Str");
    Logger.getSystemLogger().debug("String_Node_Str" + myGLColorCount);
  }
  if (selectEnabled) {
    selectEnabled=false;
    mySelector.processSelection(gl);
  }
 else {
    fireRerenderListeners();
  }
  gl.glFlush();
  GLFrameCapture fc=frameCapture;
  if (fc != null) {
synchronized (fc) {
      if (grab) {
        offscreenCapture(fc,flags);
        grab=false;
      }
      if (grabWaitComplete) {
        fc.waitForCompletion();
        grabWaitComplete=false;
      }
      if (grabClose) {
        fc.waitForCompletion();
        fc.dispose(gl);
        frameCapture=null;
      }
    }
  }
  garbage(gl);
  this.drawable=null;
  this.gl=null;
}

Fixed version (ground truth):
public void display(GLAutoDrawable drawable,int flags){
  this.drawable=drawable;
  this.gl=drawable.getGL().getGL2();
  if (!myInternalRenderListValid) {
    buildInternalRenderList();
  }
  maybeUpdateState(gl);
  if (selectTrigger) {
    mySelector.setupSelection(gl);
    selectEnabled=true;
    selectTrigger=false;
  }
  drawable.setAutoSwapBufferMode(selectEnabled ? false : true);
  if (myProfiling) {
    myTimer.start();
    myGLColorCount=0;
  }
  doDisplay(drawable,flags);
  if (myProfiling) {
    myTimer.stop();
    System.out.printf("String_Node_Str",myTimer.getTimeUsec() / 1000.0,isSelecting() ? "String_Node_Str" : "String_Node_Str");
    Logger.getSystemLogger().debug("String_Node_Str" + myGLColorCount);
  }
  if (selectEnabled) {
    selectEnabled=false;
    mySelector.processSelection(gl);
  }
 else {
    fireRerenderListeners();
  }
  gl.glFlush();
  GLFrameCapture fc=frameCapture;
  if (fc != null && (grab || grabClose)) {
synchronized (fc) {
      if (grab) {
        offscreenCapture(fc,flags);
        fc.unlock();
        grab=false;
      }
      if (grabClose) {
        fc.waitForCompletion();
        fc.dispose(gl);
        frameCapture=null;
        grabClose=false;
      }
    }
  }
  garbage(gl);
  this.drawable=null;
  this.gl=null;
}
Program: 70694
Project: 70694
Buggy source:
public void awaitScreenShotCompletion(){
  if (frameCapture != null) {
    grabWaitComplete=true;
    repaint();
  }
}

Fixed version (ground truth):
public void awaitScreenShotCompletion(){
  if (frameCapture != null) {
    frameCapture.waitForCompletion();
  }
}
Program: 70695
Project: 70695
Buggy source:
@Override public void display(GLAutoDrawable drawable,int flags){
  this.drawable=drawable;
  this.gl=drawable.getGL().getGL3();
  if (!myInternalRenderListValid) {
    buildInternalRenderList();
  }
  if (selectTrigger) {
    mySelector.setupSelection(gl);
    selectEnabled=true;
    selectTrigger=false;
  }
  drawable.setAutoSwapBufferMode(selectEnabled ? false : true);
  if (myProfiling) {
    myTimer.start();
  }
  doDisplay(drawable,flags);
  if (myProfiling) {
    myTimer.stop();
    System.out.printf("String_Node_Str",myTimer.getTimeUsec() / 1000.0,isSelecting() ? "String_Node_Str" : "String_Node_Str");
  }
  if (selectEnabled) {
    selectEnabled=false;
    mySelector.processSelection(gl);
  }
 else {
    fireRerenderListeners();
  }
  GLFrameCapture fc=frameCapture;
  if (fc != null) {
synchronized (fc) {
      if (grab) {
        offscreenCapture(fc,flags);
        grab=false;
      }
      if (grabWaitComplete) {
        fc.waitForCompletion();
        grabWaitComplete=false;
      }
      if (grabClose) {
        fc.waitForCompletion();
        fc.dispose(gl);
        frameCapture=null;
      }
    }
  }
  long time=System.currentTimeMillis();
  if (time - lastGarbageTime > myGLResources.getGarbageCollectionInterval()) {
    garbage(gl);
  }
  myGLResources.maybeRunGarbageCollection(gl);
  this.drawable=null;
  this.gl=null;
}

Fixed version (ground truth):
@Override public void display(GLAutoDrawable drawable,int flags){
  this.drawable=drawable;
  this.gl=drawable.getGL().getGL3();
  if (!myInternalRenderListValid) {
    buildInternalRenderList();
  }
  if (selectTrigger) {
    mySelector.setupSelection(gl);
    selectEnabled=true;
    selectTrigger=false;
  }
  drawable.setAutoSwapBufferMode(selectEnabled ? false : true);
  if (myProfiling) {
    myTimer.start();
  }
  doDisplay(drawable,flags);
  if (myProfiling) {
    myTimer.stop();
    System.out.printf("String_Node_Str",myTimer.getTimeUsec() / 1000.0,isSelecting() ? "String_Node_Str" : "String_Node_Str");
  }
  if (selectEnabled) {
    selectEnabled=false;
    mySelector.processSelection(gl);
  }
 else {
    fireRerenderListeners();
  }
  GLFrameCapture fc=frameCapture;
  if (fc != null && (grab || grabClose)) {
synchronized (fc) {
      if (grab) {
        offscreenCapture(fc,flags);
        fc.unlock();
        grab=false;
      }
      if (grabClose) {
        fc.waitForCompletion();
        fc.dispose(gl);
        frameCapture=null;
        grabClose=false;
      }
    }
  }
  long time=System.currentTimeMillis();
  if (time - lastGarbageTime > myGLResources.getGarbageCollectionInterval()) {
    garbage(gl);
  }
  myGLResources.maybeRunGarbageCollection(gl);
  this.drawable=null;
  this.gl=null;
}
Program: 70696
Project: 70696
Buggy source:
private void offscreenCapture(GLFrameCapture fc,int flags){
  boolean savedSelecting=selectEnabled;
  selectEnabled=false;
  gl.setSwapInterval(1);
  fc.activateFBO(gl);
  boolean autoResize=setAutoResizeEnabled(false);
  boolean autoViewport=setAutoViewportEnabled(false);
  doDisplay(drawable,flags);
  setAutoResizeEnabled(autoResize);
  setAutoViewportEnabled(autoViewport);
  fireRerenderListeners();
  fc.deactivateFBO(gl);
  fc.capture(gl);
  selectEnabled=savedSelecting;
}

Fixed version (ground truth):
private void offscreenCapture(GLFrameCapture fc,int flags){
  boolean savedSelecting=selectEnabled;
  selectEnabled=false;
  fc.activateFBO(gl);
  boolean autoResize=setAutoResizeEnabled(false);
  boolean autoViewport=setAutoViewportEnabled(false);
  doDisplay(drawable,flags);
  setAutoResizeEnabled(autoResize);
  setAutoViewportEnabled(autoViewport);
  fireRerenderListeners();
  fc.deactivateFBO(gl);
  fc.capture(gl);
  selectEnabled=savedSelecting;
}
Program: 70697
Project: 70697
Buggy source:
public void awaitScreenShotCompletion(){
  if (frameCapture != null) {
    grabWaitComplete=true;
    repaint();
  }
}

Fixed version (ground truth):
public void awaitScreenShotCompletion(){
  if (frameCapture != null) {
    frameCapture.waitForCompletion();
  }
}
Program: 70698
Project: 70698
Buggy source:
public GLFrameCapture(int x,int y,int w,int h,int nsamples,boolean gammaCorrected,File file,String format){
  this.file=file;
  this.format=format;
  fbo=new FrameBufferObject(x,y,w,h,nsamples,gammaCorrected);
}

Fixed version (ground truth):
public GLFrameCapture(int x,int y,int w,int h,int nsamples,boolean gammaCorrected,File file,String format){
  this.file=file;
  this.format=format;
  fbo=new FrameBufferObject(x,y,w,h,nsamples,gammaCorrected);
  lock=false;
}
Program: 70699
Project: 70699
Buggy source:
@Override public void run(){
  if (menuFile != null) {
    ArtisynthModelMenu generator=readDemoMenu(menuFile.getAbsolutePath());
    populateModelMenu(menu);
    File cachedMenu=getMenuCacheFile(menuFile);
    generator.write(cachedMenu);
    myModelsMenuGenerator=generator;
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (menuFilename != null) {
    ArtisynthModelMenu generator=readDemoMenu(menuFilename);
    populateModelMenu(menu);
    File cachedMenu=getMenuCacheFile(menuFilename);
    generator.write(cachedMenu);
    myModelsMenuGenerator=generator;
  }
}
Program: 70700
Project: 70700
Buggy source:
public BackgroundModelMenuThread(File file,JMenu menu){
  super("String_Node_Str");
  menuFile=file;
  this.menu=menu;
}

Fixed version (ground truth):
public BackgroundModelMenuThread(String filename,JMenu menu){
  super("String_Node_Str");
  menuFilename=filename;
  this.menu=menu;
}
Program: 70701
Project: 70701
Buggy source:
private File getMenuCacheFile(File file){
  String cacheFileName=ArtisynthPath.getHomeDir() + "String_Node_Str" + file.getName();
  File cachedMenu=new File(cacheFileName);
  return cachedMenu;
}

Fixed version (ground truth):
private File getMenuCacheFile(String menuFilename){
  String cacheFileName=ArtisynthPath.getHomeDir() + "String_Node_Str" + menuFilename;
  File cachedMenu=new File(cacheFileName);
  return cachedMenu;
}
Program: 70702
Project: 70702
Buggy source:
private void createDemosMenu(JMenu menu){
  myModelsMenuGenerator=null;
  String menuFilename=myMain.getDemosMenuFilename();
  File menuFile=new File(menuFilename);
  File cachedMenu=getMenuCacheFile(menuFile);
  if (cachedMenu.exists()) {
    myModelsMenuGenerator=readDemoMenu(cachedMenu.getAbsolutePath());
    populateModelMenu(menu);
    BackgroundModelMenuThread thread=new BackgroundModelMenuThread(menuFile,menu);
    thread.start();
  }
 else {
    myModelsMenuGenerator=readDemoMenu(menuFile.getAbsolutePath());
    populateModelMenu(menu);
    myModelsMenuGenerator.write(cachedMenu);
  }
}

Fixed version (ground truth):
private void createDemosMenu(JMenu menu){
  myModelsMenuGenerator=null;
  String menuFilename=myMain.getDemosMenuFilename();
  File menuFile=new File(menuFilename);
  File cachedMenu=getMenuCacheFile(menuFilename);
  if (cachedMenu.exists()) {
    myModelsMenuGenerator=readDemoMenu(menuFilename);
    populateModelMenu(menu);
    BackgroundModelMenuThread thread=new BackgroundModelMenuThread(menuFilename,menu);
    thread.start();
  }
 else {
    myModelsMenuGenerator=readDemoMenu(menuFilename);
    populateModelMenu(menu);
    myModelsMenuGenerator.write(cachedMenu);
  }
}
Program: 70703
Project: 70703
Buggy source:
/** 
 * Adds a weighted node-to-node stiffness to the matrix Kij via the formula <pre> Kij = Bi^T D Bj dv </pre> where gi and gj are the gradients for shape functions i and j, Bi and Bj are the B matrices formed from gi and gj, D is the linear stiffness relationship associated with Youngs modulus E and Poissons ratio nu, and dv is the weighting term.
 */
public static void addMaterialStiffness(Matrix3d K,Vector3d gi,double E,double nu,Vector3d gj,double dv){
  double s=E / (1 + nu);
  double dia=s * (1 - nu) / (1 - 2 * nu);
  double off=s * nu / (1 - 2 * nu);
  double di2=0.5 * s;
  double gjx=gj.x * dv;
  double gjy=gj.y * dv;
  double gjz=gj.z * dv;
  double dm00=dia * gjx;
  double dm01=off * gjy;
  double dm02=off * gjz;
  double dm10=off * gjx;
  double dm11=dia * gjy;
  double dm22=dia * gjz;
  double dm30=di2 * gjy;
  double dm31=di2 * gjx;
  double dm41=di2 * gjz;
  double gix=gi.x;
  double giy=gi.y;
  double giz=gi.z;
  double giy_dm30=giy * dm30;
  double gix_dm31=gix * dm31;
  double giz_dm22=giz * dm22;
  K.m00+=gix * dm00 + giy_dm30 + giz_dm22;
  K.m01+=gix * dm01 + giy * dm31;
  K.m02+=gix * dm02 + giz * dm31;
  K.m10+=giy * dm10 + gix * dm30;
  K.m11+=giy * dm11 + gix_dm31 + giz * dm41;
  K.m12+=giy * dm02 + giz * dm30;
  K.m20+=giz * dm10 + gix * dm22;
  K.m21+=giz * dm01 + giy * dm41;
  K.m22+=giz_dm22 + giy_dm30 + gix_dm31;
}

Fixed version (ground truth):
/** 
 * Adds a weighted node-to-node stiffness to the matrix Kij via the formula <pre> Kij = Bi^T D Bj dv </pre> where gi and gj are the gradients for shape functions i and j, Bi and Bj are the B matrices formed from gi and gj, D is the linear stiffness relationship associated with Youngs modulus E and Poissons ratio nu, and dv is the weighting term.
 */
public static void addMaterialStiffness(Matrix3d K,Vector3d gi,double E,double nu,Vector3d gj,double dv){
  double s=E / (1 + nu);
  double dia=s * (1 - nu) / (1 - 2 * nu);
  double off=s * nu / (1 - 2 * nu);
  double di2=0.5 * s;
  double gjx=gj.x * dv;
  double gjy=gj.y * dv;
  double gjz=gj.z * dv;
  double dgjx=dia * gjx;
  double dgjy=dia * gjy;
  double dgjz=dia * gjz;
  double ogjx=off * gjx;
  double ogjy=off * gjy;
  double ogjz=off * gjz;
  double d2gjx=di2 * gjx;
  double d2gjy=di2 * gjy;
  double d2gjz=di2 * gjz;
  double gix=gi.x;
  double giy=gi.y;
  double giz=gi.z;
  double gixd2gjx=gix * d2gjx;
  double giyd2gjy=giy * d2gjy;
  double gizd2gjz=giz * d2gjz;
  K.m00+=gix * dgjx + giyd2gjy + gizd2gjz;
  K.m01+=gix * ogjy + giy * d2gjx;
  K.m02+=gix * ogjz + giz * d2gjx;
  K.m10+=giy * ogjx + gix * d2gjy;
  K.m11+=giy * dgjy + gixd2gjx + gizd2gjz;
  K.m12+=giy * ogjz + giz * d2gjy;
  K.m20+=giz * ogjx + gix * d2gjz;
  K.m21+=giz * ogjy + giy * d2gjz;
  K.m22+=giz * dgjz + giyd2gjy + gixd2gjx;
}
Program: 70704
Project: 70704
Buggy source:
public void updateTargetForce(double t0,double t1){
  if (!isEnabled()) {
    return;
  }
  if (myTargetFor == null || myTargetFor.size() != myTargetForSize)   myTargetFor=new VectorNd(myTargetForSize);
  double[] buf=myTargetFor.getBuffer();
  int idx=0;
  for (int i=0; i < myForceTargets.size(); i++) {
    ForceTarget target=myForceTargets.get(i);
    VectorNd lambda=target.getTargetLambda();
    lambda.get(buf,idx);
  }
}

Fixed version (ground truth):
public void updateTargetForce(double t0,double t1){
  if (!isEnabled()) {
    return;
  }
  if (myTargetFor == null || myTargetFor.size() != myTargetForSize)   myTargetFor=new VectorNd(myTargetForSize);
  double[] buf=myTargetFor.getBuffer();
  int idx=0;
  for (int i=0; i < myForceTargets.size(); i++) {
    ForceTarget target=myForceTargets.get(i);
    VectorNd lambda=target.getTargetLambda();
    lambda.get(buf,idx);
    idx+=lambda.size();
  }
}
Program: 70705
Project: 70705
Buggy source:
/** 
 * Solves the Quadratic Program of the form: min { x^T*Q*x + x^T*L }, subject to A*x &lt;= b, Aeq*x = beq
 * @return x
 */
public VectorNd solve(double t0,double t1){
  Q.setZero();
  P.setZero();
  for (  QPTerm term : myCostTerms) {
    term.getQP(Q,P,t0,t1);
  }
  int rowoff=0;
  for (  LeastSquaresTerm term : myInequalityTerms) {
    if (term.isEnabled())     term.getTerm(A,b,rowoff,t0,t1);
  }
  rowoff=0;
  for (  LeastSquaresTerm term : myEqualityTerms) {
    if (term.isEnabled())     term.getTerm(Aeq,beq,rowoff,t0,t1);
  }
  try {
    if (Aeq.rowSize() == 0 || beq.size() == 0) {
      mySolver.solve(x,Q,P,A,b);
    }
 else {
      Status qpStatus=mySolver.solve(x,Q,P,A,b,Aeq,beq);
      if (qpStatus != Status.SOLVED) {
        System.err.println("String_Node_Str" + qpStatus.toString());
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return x;
}

Fixed version (ground truth):
/** 
 * Solves the Quadratic Program of the form: min { x^T*Q*x + x^T*L }, subject to A*x &lt;= b, Aeq*x = beq
 * @return x
 */
public VectorNd solve(double t0,double t1){
  Q.setZero();
  P.setZero();
  for (  QPTerm term : myCostTerms) {
    term.getQP(Q,P,t0,t1);
  }
  int rowoff=0;
  for (  LeastSquaresTerm term : myInequalityTerms) {
    if (term.isEnabled())     rowoff=term.getTerm(A,b,rowoff,t0,t1);
  }
  rowoff=0;
  for (  LeastSquaresTerm term : myEqualityTerms) {
    if (term.isEnabled())     rowoff=term.getTerm(Aeq,beq,rowoff,t0,t1);
  }
  try {
    if (Aeq.rowSize() == 0 || beq.size() == 0) {
      mySolver.solve(x,Q,P,A,b);
    }
 else {
      Status qpStatus=mySolver.solve(x,Q,P,A,b,Aeq,beq);
      if (qpStatus != Status.SOLVED) {
        System.err.println("String_Node_Str" + qpStatus.toString());
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return x;
}
Program: 70707
Project: 70707
Buggy source:
private void maybeCreateMaster(){
  if (masterDrawable == null) {
    final GLProfile glp=glCapabilities.getGLProfile();
    masterDrawable=GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null,true,glCapabilities,null);
    masterDrawable.addGLEventListener(this);
    masterDrawable.addGLEventListener(garbageman);
    masterDrawable.display();
    if (garbageTimerEnabled) {
      masterRedrawThread=new MasterRedrawThread(masterDrawable,garbageCollectionInterval);
      masterRedrawThread.setName("String_Node_Str" + masterDrawable.getHandle());
      masterRedrawThread.start();
    }
  }
}

Fixed version (ground truth):
private void maybeCreateMaster(){
  if (masterDrawable == null) {
    final GLProfile glp=glCapabilities.getGLProfile();
    masterDrawable=GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null,true,glCapabilities,null);
    GLVersionListener glv=new GLVersionListener();
    masterDrawable.addGLEventListener(this);
    masterDrawable.addGLEventListener(garbageman);
    masterDrawable.addGLEventListener(glv);
    masterDrawable.display();
    while (!glv.isValid()) {
    }
    GLVersionInfo version=glv.getVersionInfo();
    System.out.println(version.getVersionString());
    masterDrawable.removeGLEventListener(glv);
    if (garbageTimerEnabled) {
      masterRedrawThread=new MasterRedrawThread(masterDrawable,garbageCollectionInterval);
      masterRedrawThread.setName("String_Node_Str" + masterDrawable.getHandle());
      masterRedrawThread.start();
    }
  }
}
Program: 70708
Project: 70708
Buggy source:
@Override public void init(GLAutoDrawable drawable){
  GL gl=drawable.getGL();
  String renderer=gl.glGetString(GL.GL_RENDERER);
  String version=gl.glGetString(GL.GL_VERSION);
  int[] buff=new int[2];
  gl.glGetIntegerv(GL3.GL_MAJOR_VERSION,buff,0);
  gl.glGetIntegerv(GL3.GL_MINOR_VERSION,buff,1);
  int major=buff[0];
  int minor=buff[1];
  vinfo=new GLVersionInfo(renderer,version,major,minor);
  valid=true;
}

Fixed version (ground truth):
@Override public void init(GLAutoDrawable drawable){
  GL gl=drawable.getGL();
  String renderer=gl.glGetString(GL.GL_RENDERER);
  GLSupport.checkAndPrintGLError(gl);
  String version=gl.glGetString(GL.GL_VERSION);
  GLSupport.checkAndPrintGLError(gl);
  Scanner scanf=new Scanner(version.trim().split("String_Node_Str",2)[0]);
  scanf.useDelimiter("String_Node_Str");
  int major=scanf.nextInt();
  int minor=scanf.nextInt();
  scanf.close();
  vinfo=new GLVersionInfo(renderer,version,major,minor);
  valid=true;
}
Program: 70709
Project: 70709
Buggy source:
public GLVersionInfo getVersionInfo(){
  return vinfo;
}

Fixed version (ground truth):
public static GLVersionInfo getVersionInfo(GLProfile glp){
  GLCapabilities glc=new GLCapabilities(glp);
  GLAutoDrawable dummy=GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null,true,glc,null);
  GLVersionListener listener=new GLVersionListener();
  dummy.addGLEventListener(listener);
  dummy.display();
  while (!listener.isValid()) {
  }
  GLVersionInfo vinfo=listener.getVersionInfo();
  dummy.disposeGLEventListener(listener,true);
  dummy.destroy();
  return vinfo;
}
Program: 70710
Project: 70710
Buggy source:
/** 
 * Called any time GL context is switched! e.g. moving window to new display
 */
public void init(GLAutoDrawable drawable){
  GL gl=drawable.getGL();
  String renderer=gl.glGetString(GL.GL_RENDERER);
  String version=gl.glGetString(GL.GL_VERSION);
  int[] buff=new int[2];
  gl.glGetIntegerv(GL3.GL_MAJOR_VERSION,buff,0);
  gl.glGetIntegerv(GL3.GL_MINOR_VERSION,buff,1);
  System.out.println("String_Node_Str" + renderer);
  System.out.println("String_Node_Str" + version + "String_Node_Str"+ buff[0]+ "String_Node_Str"+ buff[1]+ "String_Node_Str");
  setMultiSampleEnabled(true);
  myActiveColor=ActiveColor.DEFAULT;
}

Fixed version (ground truth):
/** 
 * Called any time GL context is switched! e.g. moving window to new display
 */
public void init(GLAutoDrawable drawable){
  GL gl=drawable.getGL();
  String renderer=gl.glGetString(GL.GL_RENDERER);
  String version=gl.glGetString(GL.GL_VERSION);
  System.out.println("String_Node_Str" + renderer);
  System.out.println("String_Node_Str" + version);
  setMultiSampleEnabled(true);
  myActiveColor=ActiveColor.DEFAULT;
}
Program: 70711
Project: 70711
Buggy source:
public void setRotationMode(RotationMode mode){
  myRotationMode=mode;
}

Fixed version (ground truth):
public void setRotationMode(RotationMode mode){
  if (myRotationMode != mode) {
    myRotationMode=mode;
    if (mode == RotationMode.DEFAULT) {
      setEyeToWorld(getEye(),myViewState.myCenter,getUpVector());
    }
  }
}
Program: 70712
Project: 70712
Buggy source:
/** 
 * Translate the eye position with respect to the x-y plane of the eye frame. The center point is translated by the same amount.
 * @param delx x translation amount
 * @param dely y translation amount
 */
protected void translate(double delx,double dely){
  Vector3d xCam=new Vector3d(), yCam=new Vector3d();
synchronized (viewMatrix) {
    viewMatrix.R.getRow(0,xCam);
    viewMatrix.R.getRow(1,yCam);
  }
  Vector3d offset=new Vector3d();
  offset.scale(-delx,xCam);
  offset.scaledAdd(-dely,yCam,offset);
  myViewState.myCenter.add(offset);
  Point3d eye=getEye();
  eye.add(offset);
  setEye(eye);
  repaint();
}

Fixed version (ground truth):
/** 
 * Translate the eye position with respect to the x-y plane of the eye frame. The center point is translated by the same amount.
 * @param delx x translation amount
 * @param dely y translation amount
 */
protected void translate(double delx,double dely){
  Vector3d xCam=new Vector3d(), yCam=new Vector3d();
synchronized (viewMatrix) {
    viewMatrix.R.getRow(0,xCam);
    viewMatrix.R.getRow(1,yCam);
  }
  Vector3d offset=new Vector3d();
  offset.scale(-delx,xCam);
  offset.scaledAdd(-dely,yCam,offset);
  myViewState.myCenter.add(offset);
  Point3d eye=getEye();
  eye.add(offset);
  setEyeToWorld(eye,myViewState.myCenter,getActualUpVector());
  repaint();
}