nus-yam/ex-repair huggingface dataset:
Program: 70979
Project: 70979
Buggy source:
/** 
 * Write all waypoint state to the attached file if it exists.
 */
public void save(){
  File file=getAttachedFile();
  if (file != null) {
    try {
      if (isAttachedFileRelative()) {
        file.getParentFile().mkdirs();
      }
      System.out.println("String_Node_Str" + file.getName());
      DataOutputStream dos=new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
      dos.writeInt(numValid());
      for (      WayPoint way : myWayPoints) {
        if (way.getState() != null) {
          System.out.println("String_Node_Str" + way.getTime());
          dos.writeDouble(way.getTime());
          way.getState().writeBinary(dos);
        }
      }
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str" + file.getName());
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Write all waypoint state to the attached file if it exists.
 */
public void save(){
  File file=getAttachedFile();
  if (file != null) {
    try {
      if (isAttachedFileRelative()) {
        file.getParentFile().mkdirs();
      }
      System.out.println("String_Node_Str" + file.getName());
      DataOutputStream dos=new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
      dos.writeInt(numValid());
      for (      WayPoint way : myWayPoints) {
        if (way.getState() != null) {
          System.out.println("String_Node_Str" + way.getTime());
          dos.writeDouble(way.getTime());
          way.getState().writeBinary(dos);
        }
      }
      dos.close();
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str" + file.getName());
      e.printStackTrace();
    }
  }
}
Program: 70980
Project: 70980
Buggy source:
/** 
 * Load waypoint state data from the attached file.
 */
public void load(){
  invalidateAll();
  File file=getAttachedFile();
  if (file != null) {
    if (!file.exists()) {
      System.out.println("String_Node_Str" + file.getName() + "String_Node_Str");
    }
 else {
      try {
        DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
        ListIterator<WayPoint> li=myWayPoints.listIterator();
        int numvalid=dis.readInt();
        for (int i=0; i < numvalid; i++) {
          double time=dis.readDouble();
          WayPoint way=null;
          if (li.hasNext()) {
            while (li.hasNext()) {
              way=li.next();
              if (way.getTime() >= time) {
                break;
              }
            }
            if (TimeBase.equals(way.getTime(),time)) {
            }
 else             if (way.getTime() > time) {
              li.previous();
              way=new WayPoint(time);
              li.add(way);
            }
 else {
              way=new WayPoint(time);
              li.add(way);
            }
          }
 else {
            way=new WayPoint(time);
            li.add(way);
          }
          CompositeState cs=(CompositeState)myRootModel.createState(null);
          cs.readBinary(dis);
          way.setState(cs);
        }
      }
 catch (      IOException e) {
        System.err.println("String_Node_Str" + e.getMessage());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Load waypoint state data from the attached file.
 */
public void load(){
  invalidateAll();
  File file=getAttachedFile();
  if (file != null) {
    if (!file.exists()) {
      System.out.println("String_Node_Str" + file.getName() + "String_Node_Str");
    }
 else {
      try {
        DataInputStream dis=new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
        ListIterator<WayPoint> li=myWayPoints.listIterator();
        int numvalid=dis.readInt();
        for (int i=0; i < numvalid; i++) {
          double time=dis.readDouble();
          WayPoint way=null;
          if (li.hasNext()) {
            while (li.hasNext()) {
              way=li.next();
              if (way.getTime() >= time) {
                break;
              }
            }
            if (TimeBase.equals(way.getTime(),time)) {
            }
 else             if (way.getTime() > time) {
              li.previous();
              way=new WayPoint(time);
              li.add(way);
            }
 else {
              way=new WayPoint(time);
              li.add(way);
            }
          }
 else {
            way=new WayPoint(time);
            li.add(way);
          }
          CompositeState cs=(CompositeState)myRootModel.createState(null);
          cs.readBinary(dis);
          way.setState(cs);
        }
        dis.close();
      }
 catch (      IOException e) {
        System.err.println("String_Node_Str" + e.getMessage());
      }
    }
  }
}
Program: 70981
Project: 70981
Buggy source:
/** 
 * Return an iterator which iterates through 27 cells. Iterates through the 27 cells which include and are adjacent to the cell containing pos.
 * @param pos A position in the centre bin.
 * @return Iterator for 27 bins.
 */
public Iterator<List<T>> getCellsNear(Point3d pos){
  if (!myIndexListInitialized)   setupListsToNeighbours();
  int xIdx=(int)Math.round(pos.x / myGridSpacing);
  int yIdx=(int)Math.round(pos.y / myGridSpacing);
  int zIdx=(int)Math.round(pos.z / myGridSpacing);
  Iterator<List<T>> it=myIndexList.get(new Index(xIdx,yIdx,zIdx)).listIterator();
  return it;
}

Fixed version (ground truth):
/** 
 * Return an iterator which iterates through 27 cells. Iterates through the 27 cells which include and are adjacent to the cell containing pos.
 * @param pos A position in the centre bin.
 * @return Iterator for 27 bins.
 */
public Iterator<List<T>> getCellsNear(Point3d pos){
  if (!myIndexListInitialized)   setupListsToNeighbours();
  int xIdx=(int)Math.round(pos.x / myGridSpacing);
  int yIdx=(int)Math.round(pos.y / myGridSpacing);
  int zIdx=(int)Math.round(pos.z / myGridSpacing);
  List<List<T>> list=myIndexList.get(new Index(xIdx,yIdx,zIdx));
  if (list == null) {
    return getCellsNearOld(pos);
  }
  Iterator<List<T>> it=list.listIterator();
  return it;
}
Program: 70983
Project: 70983
Buggy source:
public static LinkedHashMap<Integer,ArrayList<Integer>> readElemFile(Reader elemReader,boolean useAnsysNum) throws IOException {
  LinkedHashMap<Integer,ArrayList<Integer>> elemPositions=new LinkedHashMap<Integer,ArrayList<Integer>>();
  int offset=useAnsysNum ? 0 : -1;
  int elemId=0;
  String line;
  int lineno=0;
  BufferedReader reader=new BufferedReader(elemReader);
  line=reader.readLine();
  ArrayList<Integer> widths=new ArrayList<Integer>(14);
  computeWidths(widths,line);
  while (line != null) {
    ArrayList<Integer> numbers=new ArrayList<Integer>();
    ArrayList<Integer> elemNumList;
    lineno++;
    int off=0;
    int nidx=0;
    while ((off=parseNumber(numbers,line,off,widths.get(nidx),lineno)) != -1) {
      nidx++;
    }
    if (numbers.size() == 14) {
      elemNumList=new ArrayList<Integer>();
      for (int i=0; i < 8; i++) {
        elemNumList.add(numbers.get(i) + offset);
      }
      for (int i=8; i < 13; i++) {
        elemNumList.add(0,numbers.get(i));
      }
      elemId=numbers.get(13);
    }
 else {
      elemNumList=elemPositions.get(elemId + offset);
      for (int i=0; i < numbers.size(); i++) {
        elemNumList.add(numbers.get(i) + offset);
      }
    }
    elemPositions.put(elemId + offset,elemNumList);
    line=reader.readLine();
  }
  return elemPositions;
}

Fixed version (ground truth):
public static LinkedHashMap<Integer,ArrayList<Integer>> readElemFile(Reader elemReader,boolean useAnsysNum) throws IOException {
  LinkedHashMap<Integer,ArrayList<Integer>> elemPositions=new LinkedHashMap<Integer,ArrayList<Integer>>();
  int offset=useAnsysNum ? 0 : -1;
  int elemId=0;
  String line;
  int lineno=0;
  BufferedReader reader=new BufferedReader(elemReader);
  line=reader.readLine();
  ArrayList<Integer> widths=new ArrayList<Integer>(14);
  computeWidths(widths,line);
  widths.add(0);
  while (line != null) {
    ArrayList<Integer> numbers=new ArrayList<Integer>();
    ArrayList<Integer> elemNumList;
    lineno++;
    int off=0;
    int nidx=0;
    while ((off=parseNumber(numbers,line,off,widths.get(nidx),lineno)) != -1) {
      nidx++;
      if (off >= line.length()) {
        break;
      }
    }
    if (numbers.size() == 14) {
      elemNumList=new ArrayList<Integer>();
      for (int i=0; i < 8; i++) {
        elemNumList.add(numbers.get(i) + offset);
      }
      for (int i=8; i < 13; i++) {
        elemNumList.add(0,numbers.get(i));
      }
      elemId=numbers.get(13);
    }
 else {
      elemNumList=elemPositions.get(elemId + offset);
      for (int i=0; i < numbers.size(); i++) {
        elemNumList.add(numbers.get(i) + offset);
      }
    }
    elemPositions.put(elemId + offset,elemNumList);
    line=reader.readLine();
  }
  return elemPositions;
}
Program: 70984
Project: 70984
Buggy source:
public void test(){
  testFit();
  testIntersectPlane();
}

Fixed version (ground truth):
public void test(){
  testFit();
  testIntersectPlane();
  testSet();
}
Program: 70985
Project: 70985
Buggy source:
public static void main(String[] args){
  PlaneTest tester=new PlaneTest();
  try {
    tester.test();
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(1);
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args){
  RandomGenerator.setSeed(0x1234);
  PlaneTest tester=new PlaneTest();
  try {
    tester.test();
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(1);
  }
  System.out.println("String_Node_Str");
}
Program: 70986
Project: 70986
Buggy source:
/** 
 * Sets this plane to pass through three non-colinear points arranged counter-clockwise around the normal.
 * @param p1 first point
 * @param p2 second point
 * @param p3 third point
 * @throws IllegalArgumentException if the points are colinear
 */
public void set(Point3d p1,Point3d p2,Point3d p3) throws IllegalArgumentException {
  double d1x=p2.x - p1.x;
  double d1y=p2.y - p1.y;
  double d1z=p2.z - p1.z;
  double d2x=p3.x - p1.x;
  double d2y=p3.y - p1.y;
  double d2z=p3.z - p1.z;
  normal.x=d1y * d2z - d1z * d2y;
  normal.y=d1z * d2x - d1x * d2z;
  normal.z=d1x * d2y - d1y * d2x;
  double mag=normal.norm();
  if (mag == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  normal.scale(1 / mag);
}

Fixed version (ground truth):
/** 
 * Sets this plane to pass through three non-colinear points arranged counter-clockwise around the normal.
 * @param p1 first point
 * @param p2 second point
 * @param p3 third point
 * @throws IllegalArgumentException if the points are colinear
 */
public void set(Point3d p1,Point3d p2,Point3d p3) throws IllegalArgumentException {
  double d1x=p2.x - p1.x;
  double d1y=p2.y - p1.y;
  double d1z=p2.z - p1.z;
  double d2x=p3.x - p1.x;
  double d2y=p3.y - p1.y;
  double d2z=p3.z - p1.z;
  normal.x=d1y * d2z - d1z * d2y;
  normal.y=d1z * d2x - d1x * d2z;
  normal.z=d1x * d2y - d1y * d2x;
  double mag=normal.norm();
  if (mag == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  normal.scale(1 / mag);
  offset=normal.dot(p1);
  offset+=normal.dot(p2);
  offset+=normal.dot(p3);
  offset/=3;
}
Program: 70987
Project: 70987
Buggy source:
/** 
 * Returns true if the specified character is a quote character.
 * @param ch character to be queried
 * @return true if <code>ch</code>ch is a quote character
 * @see #quoteChar
 */
public final boolean isQuoteChar(int ch){
  if (ch >= ctype.length) {
    return false;
  }
 else {
    return (ctype[ch] & C_QUOTE) != 0;
  }
}

Fixed version (ground truth):
/** 
 * Returns true if the specified character is a quote character.
 * @param ch character to be queried
 * @return true if <code>ch</code>ch is a quote character
 * @see #quoteChar
 */
public final boolean isQuoteChar(int ch){
  if (ch >= ctype.length) {
    return false;
  }
 else   if (ch < 0) {
    return false;
  }
 else {
    return (ctype[ch] & C_QUOTE) != 0;
  }
}
Program: 70988
Project: 70988
Buggy source:
/** 
 * Returns a List of cells (List<T>'s) that might intersect a bv tree.
 * @param bvtree
 */
public Map<List<T>,ArrayList<BVNode>> getCellsIntersecting(BVTree bvtree){
  Map<List<T>,ArrayList<BVNode>> potentials=new HashMap<>();
  Point3d cellCentre=new Point3d();
  double searchRad=myGridSpacing * Math.sqrt(0.5);
  searchRad=Math.sqrt(searchRad * searchRad + myGridSpacing * myGridSpacing / 4);
  searchRad+=myGridSpacing;
  double sphereRadius=Math.sqrt(2 * searchRad * searchRad);
  for (  Index index : myGrid.keySet()) {
    ArrayList<BVNode> nodes=new ArrayList<>();
    cellCentre.x=index.vals[0] * myGridSpacing;
    cellCentre.y=index.vals[1] * myGridSpacing;
    cellCentre.z=index.vals[2] * myGridSpacing;
    bvtree.intersectSphere(nodes,cellCentre,sphereRadius);
    if (nodes.size() > 0) {
      potentials.put(myGrid.get(index),nodes);
    }
  }
  return potentials;
}

Fixed version (ground truth):
/** 
 * Returns a List of cells (List<T>'s) that might intersect a bv tree.
 * @param bvtree
 */
public Map<List<T>,ArrayList<BVNode>> getCellsIntersecting(BVTree bvtree){
  Map<List<T>,ArrayList<BVNode>> potentials=new HashMap<List<T>,ArrayList<BVNode>>();
  Point3d cellCentre=new Point3d();
  double searchRad=myGridSpacing * Math.sqrt(0.5);
  searchRad=Math.sqrt(searchRad * searchRad + myGridSpacing * myGridSpacing / 4);
  searchRad+=myGridSpacing;
  double sphereRadius=Math.sqrt(2 * searchRad * searchRad);
  for (  Index index : myGrid.keySet()) {
    ArrayList<BVNode> nodes=new ArrayList<BVNode>();
    cellCentre.x=index.vals[0] * myGridSpacing;
    cellCentre.y=index.vals[1] * myGridSpacing;
    cellCentre.z=index.vals[2] * myGridSpacing;
    bvtree.intersectSphere(nodes,cellCentre,sphereRadius);
    if (nodes.size() > 0) {
      potentials.put(myGrid.get(index),nodes);
    }
  }
  return potentials;
}
Program: 70989
Project: 70989
Buggy source:
protected synchronized void setupListsToNeighbours(){
  if (myIndexListInitialized) {
    return;
  }
  myIndexList.clear();
  for (  Index index : myGrid.keySet()) {
    List<List<T>> list=new LinkedList<>();
    NearCellIter it=new NearCellIter(index.vals[0],index.vals[1],index.vals[2]);
    while (it.hasNext()) {
      List<T> cells=it.next();
      if (cells == null) {
        continue;
      }
      list.add(cells);
    }
    myIndexList.put(index,list);
  }
  myIndexListInitialized=true;
}

Fixed version (ground truth):
protected synchronized void setupListsToNeighbours(){
  if (myIndexListInitialized) {
    return;
  }
  myIndexList.clear();
  for (  Index index : myGrid.keySet()) {
    List<List<T>> list=new LinkedList<List<T>>();
    NearCellIter it=new NearCellIter(index.vals[0],index.vals[1],index.vals[2]);
    while (it.hasNext()) {
      List<T> cells=it.next();
      if (cells == null) {
        continue;
      }
      list.add(cells);
    }
    myIndexList.put(index,list);
  }
  myIndexListInitialized=true;
}
Program: 70991
Project: 70991
Buggy source:
private void drawEdgesRaw(GL2 gl,PolygonalMesh mesh,int flags){
  int[] shadingModel=new int[1];
  gl.glGetIntegerv(GL2.GL_SHADE_MODEL,shadingModel,0);
  boolean useRenderNormals=mesh.isRenderBuffered() && !mesh.isFixed();
  boolean useVertexColors=(flags & GLRenderer.VERTEX_COLORING) != 0;
  boolean useHSVInterpolation=(flags & GLRenderer.HSV_COLOR_INTERPOLATION) != 0;
  useHSVInterpolation=false;
  boolean mergeQuadTriangles=false;
  if (useVertexColors && useHSVInterpolation) {
    useHSVInterpolation=setupHSVInterpolation(gl);
  }
  ArrayList<Face> faceList=mesh.getFaces();
  for (int faceIdx=0; faceIdx < faceList.size(); faceIdx++) {
    faceIdx=unpackEdges(faceList,faceIdx,mergeQuadTriangles);
    gl.glBegin(GL2.GL_LINE_LOOP);
    for (int edgeIdx=0; edgeIdx < myEdgeCnt; edgeIdx++) {
      HalfEdge he=myEdges[edgeIdx];
      Vertex3d vtx=he.head;
      Point3d pnt=useRenderNormals ? vtx.myRenderPnt : vtx.pnt;
      if (useVertexColors) {
        setVertexColor(gl,vtx,useHSVInterpolation);
      }
      gl.glVertex3d(pnt.x,pnt.y,pnt.z);
    }
    gl.glEnd();
  }
  if (useVertexColors && useHSVInterpolation) {
    gl.glUseProgramObjectARB(0);
  }
}

Fixed version (ground truth):
private void drawEdgesRaw(GL2 gl,PolygonalMesh mesh,int flags){
  int[] shadingModel=new int[1];
  gl.glGetIntegerv(GL2.GL_SHADE_MODEL,shadingModel,0);
  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);
  }
  ArrayList<Face> faceList=mesh.getFaces();
  for (int faceIdx=0; faceIdx < faceList.size(); faceIdx++) {
    faceIdx=unpackEdges(faceList,faceIdx,mergeQuadTriangles);
    gl.glBegin(GL2.GL_LINE_LOOP);
    for (int edgeIdx=0; edgeIdx < myEdgeCnt; edgeIdx++) {
      HalfEdge he=myEdges[edgeIdx];
      Vertex3d vtx=he.head;
      Point3d pnt=useRenderNormals ? vtx.myRenderPnt : vtx.pnt;
      if (useVertexColors) {
        setVertexColor(gl,vtx,useHSVInterpolation);
      }
      gl.glVertex3d(pnt.x,pnt.y,pnt.z);
    }
    gl.glEnd();
  }
  if (useVertexColors && useHSVInterpolation) {
    gl.glUseProgramObjectARB(0);
  }
}
Program: 70993
Project: 70993
Buggy source:
private void setVertexColor(GL2 gl,Vertex3d vtx,boolean useHSV){
  float[] color=vtx.getColorArray();
  if (color != null) {
    if (useHSV) {
      GLSupport.RGBtoHSV(myColorBuf,color);
      gl.glColor4f(myColorBuf[0],myColorBuf[1],myColorBuf[2],myColorBuf[3]);
    }
 else {
      gl.glColor4f(color[0],color[1],color[2],color[3]);
    }
  }
}

Fixed version (ground truth):
private void setVertexColor(GL2 gl,Vertex3d vtx,boolean useHSV){
  float[] color=vtx.getColorArray();
  if (color != null) {
    if (useHSV) {
      GLSupport.RGBtoHSV(myColorBuf,color);
      gl.glColor4f(myColorBuf[0],myColorBuf[1],myColorBuf[2],color[3]);
    }
 else {
      gl.glColor4f(color[0],color[1],color[2],color[3]);
    }
  }
}
Program: 70994
Project: 70994
Buggy source:
/** 
 * Returns true is a specified Frame is currently registered with this SkinMesh.
 * @param frame Frame to be queried
 */
public boolean hasFrame(Frame frame){
  return myFrameInfo.contains(frame);
}

Fixed version (ground truth):
/** 
 * Returns true is a specified Frame is currently registered with this SkinMesh.
 * @param frame Frame to be queried
 */
public boolean hasFrame(Frame frame){
  for (  FrameInfo fi : myFrameInfo) {
    if (fi.getFrame() == frame) {
      return true;
    }
  }
  return false;
}
Program: 70995
Project: 70995
Buggy source:
public synchronized void applyOutputProbes(List<Probe> list,double t1,ModelInfo info){
  double maxStep=info.model.getMaxStepSize();
  boolean coincidesWithStep=(maxStep != -1 && TimeBase.modulo(t1,maxStep) == 0);
  for (  Probe p : list) {
    if (p.isActive() && (p.isEventTime(t1) || (coincidesWithStep && p.getUpdateInterval() < 0))) {
      p.apply(t1);
    }
  }
}

Fixed version (ground truth):
public synchronized void applyOutputProbes(List<Probe> list,double t1,ModelInfo info){
  double maxStep=info.model.getMaxStepSize();
  boolean coincidesWithStep=(maxStep != -1 && TimeBase.modulo(t1,maxStep) == 0);
  for (  Probe p : list) {
    if (!p.isActive() || TimeBase.compare(t1,p.getStartTime()) < 0 || TimeBase.compare(t1,p.getStopTime()) > 0) {
      continue;
    }
    if (p.isEventTime(t1) || (coincidesWithStep && p.getUpdateInterval() < 0)) {
      p.apply(t1);
    }
  }
}
Program: 70997
Project: 70997
Buggy source:
public void drawPoint(RenderProps props,float[] coords,boolean selected){
switch (props.getPointStyle()) {
case POINT:
{
      setLightingEnabled(false);
      gl.glPointSize(props.getPointSize());
      setColor(props.getPointColorArray(),selected);
      gl.glBegin(GL2.GL_POINTS);
      gl.glVertex3fv(coords,0);
      gl.glEnd();
      gl.glPointSize(1);
      setLightingEnabled(true);
      break;
    }
case SPHERE:
{
    setMaterialAndShading(props,props.getPointMaterial(),selected);
    drawSphere(props,coords);
    restoreShading(props);
    break;
  }
}
}

Fixed version (ground truth):
public void drawPoint(RenderProps props,float[] coords,boolean selected){
switch (props.getPointStyle()) {
case POINT:
{
      int size=props.getPointSize();
      if (size > 0) {
        setLightingEnabled(false);
        gl.glPointSize(size);
        setColor(props.getPointColorArray(),selected);
        gl.glBegin(GL2.GL_POINTS);
        gl.glVertex3fv(coords,0);
        gl.glEnd();
        gl.glPointSize(1);
        setLightingEnabled(true);
      }
      break;
    }
case SPHERE:
{
    setMaterialAndShading(props,props.getPointMaterial(),selected);
    drawSphere(props,coords);
    restoreShading(props);
    break;
  }
}
}
Program: 71000
Project: 71000
Buggy source:
public static LinkedHashMap<Integer,ArrayList<Integer>> readElemFile(Reader elemReader,boolean useAnsysNum) throws IOException {
  LinkedHashMap<Integer,ArrayList<Integer>> elemPositions=new LinkedHashMap<Integer,ArrayList<Integer>>();
  ReaderTokenizer rtok=new ReaderTokenizer(new BufferedReader(elemReader));
  rtok.eolIsSignificant(true);
  int offset=useAnsysNum ? 0 : -1;
  int elemId=0;
  while (rtok.nextToken() != ReaderTokenizer.TT_EOF) {
    rtok.pushBack();
    ArrayList<Integer> curLine=new ArrayList<Integer>();
    ArrayList<Integer> elemNumList;
    int nextToken=rtok.nextToken();
    while (nextToken != ReaderTokenizer.TT_EOL && nextToken != ReaderTokenizer.TT_EOF) {
      curLine.add((int)rtok.nval);
      nextToken=rtok.nextToken();
    }
    if (curLine.size() == 14) {
      elemNumList=new ArrayList<Integer>();
      for (int i=0; i < 8; i++) {
        elemNumList.add(curLine.get(i) + offset);
      }
      for (int i=8; i < 13; i++) {
        elemNumList.add(0,curLine.get(i));
      }
      elemId=curLine.get(13);
    }
 else {
      elemNumList=elemPositions.get(elemId + offset);
      for (int i=0; i < curLine.size(); i++) {
        elemNumList.add(curLine.get(i) + offset);
      }
    }
    elemPositions.put(elemId + offset,elemNumList);
  }
  return elemPositions;
}

Fixed version (ground truth):
public static LinkedHashMap<Integer,ArrayList<Integer>> readElemFile(Reader elemReader,boolean useAnsysNum) throws IOException {
  LinkedHashMap<Integer,ArrayList<Integer>> elemPositions=new LinkedHashMap<Integer,ArrayList<Integer>>();
  int offset=useAnsysNum ? 0 : -1;
  int elemId=0;
  String line;
  int lineno=0;
  BufferedReader reader=new BufferedReader(elemReader);
  while ((line=reader.readLine()) != null) {
    ArrayList<Integer> numbers=new ArrayList<Integer>();
    ArrayList<Integer> elemNumList;
    lineno++;
    int off=0;
    while ((off=parseNumber(numbers,line,off,lineno)) != -1) {
    }
    if (numbers.size() == 14) {
      elemNumList=new ArrayList<Integer>();
      for (int i=0; i < 8; i++) {
        elemNumList.add(numbers.get(i) + offset);
      }
      for (int i=8; i < 13; i++) {
        elemNumList.add(0,numbers.get(i));
      }
      elemId=numbers.get(13);
    }
 else {
      elemNumList=elemPositions.get(elemId + offset);
      for (int i=0; i < numbers.size(); i++) {
        elemNumList.add(numbers.get(i) + offset);
      }
    }
    elemPositions.put(elemId + offset,elemNumList);
  }
  return elemPositions;
}
Program: 71001
Project: 71001
Buggy source:
public static void main(String args[]){
  StringReader nodeReader=new StringReader(testNodeStr);
  StringReader elemReader=new StringReader(testElemStr);
  FemModel3d fem=new FemModel3d();
  try {
    AnsysReader.read(fem,nodeReader,elemReader,1.0,null,0);
  }
 catch (  IOException e) {
    e.printStackTrace();
    System.exit(1);
  }
  StringWriter nodeWriter=new StringWriter();
  StringWriter elemWriter=new StringWriter();
  AnsysWriter.writeNodeFile(fem,new PrintWriter(nodeWriter));
  AnsysWriter.writeElemFile(fem,new PrintWriter(elemWriter));
  String nodeStr=nodeWriter.toString();
  String elemStr=elemWriter.toString();
  try {
    ReaderTokenizer rtok1=new ReaderTokenizer(new StringReader(testNodeStr));
    ReaderTokenizer rtok2=new ReaderTokenizer(new StringReader(nodeStr));
    rtok1.eolIsSignificant(true);
    rtok2.eolIsSignificant(true);
    while (rtok1.nextToken() != ReaderTokenizer.TT_EOF && rtok2.nextToken() != ReaderTokenizer.TT_EOF) {
      if (rtok1.ttype == ReaderTokenizer.TT_EOL && rtok2.ttype == ReaderTokenizer.TT_EOL) {
        continue;
      }
      if (rtok1.nval != rtok2.nval) {
        throw new Exception("String_Node_Str");
      }
    }
    rtok1=new ReaderTokenizer(new StringReader(testElemStr));
    rtok2=new ReaderTokenizer(new StringReader(elemStr));
    rtok1.eolIsSignificant(true);
    rtok2.eolIsSignificant(true);
    while (rtok1.nextToken() != ReaderTokenizer.TT_EOF && rtok2.nextToken() != ReaderTokenizer.TT_EOF) {
      if (rtok1.ttype == ReaderTokenizer.TT_EOL && rtok2.ttype == ReaderTokenizer.TT_EOL) {
        continue;
      }
      if (rtok1.nval != rtok2.nval) {
        throw new Exception("String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(1);
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String args[]){
  try {
    FemModel3d fem=new FemModel3d();
    AnsysReader.read(fem,new StringReader(testNodeStr),new StringReader(testElemStr),1.0,null,0);
    StringWriter nodeWriter=new StringWriter();
    StringWriter elemWriter=new StringWriter();
    AnsysWriter.writeNodeFile(fem,new PrintWriter(nodeWriter));
    AnsysWriter.writeElemFile(fem,new PrintWriter(elemWriter));
    String nodeStr=nodeWriter.toString();
    String elemStr=elemWriter.toString();
    checkStrings("String_Node_Str",nodeStr,testNodeStr);
    checkStrings("String_Node_Str",elemStr,testElemStr);
    fem=new FemModel3d();
    AnsysReader.read(fem,new StringReader(testNodeStr),new StringReader(reducedElemStr),1.0,null,0);
    nodeWriter=new StringWriter();
    elemWriter=new StringWriter();
    AnsysWriter.writeNodeFile(fem,new PrintWriter(nodeWriter));
    AnsysWriter.writeElemFile(fem,new PrintWriter(elemWriter));
    nodeStr=nodeWriter.toString();
    elemStr=elemWriter.toString();
    checkStrings("String_Node_Str",nodeStr,testNodeStr);
    checkStrings("String_Node_Str",elemStr,testElemStr);
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(1);
  }
  System.out.println("String_Node_Str");
}
Program: 71003
Project: 71003
Buggy source:
@Override public void connectToHierarchy(){
  if (myElement == null) {
    throw new InternalErrorException("String_Node_Str");
  }
  super.connectToHierarchy();
}

Fixed version (ground truth):
@Override public void connectToHierarchy(){
  if (myElement == null) {
    throw new InternalErrorException("String_Node_Str");
  }
  super.connectToHierarchy();
  FemNode nodes[]=myNodeAttachment.getMasters();
  if (nodes != null) {
    for (    FemNode node : nodes) {
      node.addMasterAttachment(myNodeAttachment);
    }
  }
}
Program: 71004
Project: 71004
Buggy source:
@Override public void disconnectFromHierarchy(){
  if (myElement == null) {
    throw new InternalErrorException("String_Node_Str");
  }
  super.disconnectFromHierarchy();
}

Fixed version (ground truth):
@Override public void disconnectFromHierarchy(){
  if (myElement == null) {
    throw new InternalErrorException("String_Node_Str");
  }
  super.disconnectFromHierarchy();
  FemNode nodes[]=myNodeAttachment.getMasters();
  if (nodes != null) {
    for (    FemNode node : nodes) {
      node.removeMasterAttachment(myNodeAttachment);
    }
  }
}
Program: 71005
Project: 71005
Buggy source:
public static ArrayList<DynamicAttachment> createOrderedList(List<DynamicAttachment> list){
  ArrayList<DynamicAttachment> result=new ArrayList<DynamicAttachment>();
  LinkedList<DynamicAttachment> queue=new LinkedList<DynamicAttachment>();
  for (  DynamicAttachment a : list) {
    a.attachedMasterCnt=0;
    for (    DynamicComponent m : a.getMasters()) {
      if (m.isAttached()) {
        a.attachedMasterCnt++;
      }
    }
    if (a.attachedMasterCnt == 0) {
      queue.offer(a);
    }
  }
  while (!queue.isEmpty()) {
    DynamicAttachment a=queue.poll();
    if (a.getSlave() != null) {
      LinkedList<DynamicAttachment> masterAttachments=a.getSlave().getMasterAttachments();
      if (masterAttachments != null) {
        for (        DynamicAttachment b : masterAttachments) {
          b.attachedMasterCnt--;
          if (b.attachedMasterCnt == 0) {
            queue.offer(b);
          }
        }
      }
    }
    result.add(a);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Orders a list of (possibly interdependent) attachments so that the masters of any given attachment do not depend on any attachments further along the list. This means that state can be updated correctly by starting at the beginning of the list and running through to the end.  It also implicitly requires that the attachment configuration does not contain loops.
 */
public static ArrayList<DynamicAttachment> createOrderedList(List<DynamicAttachment> list){
  ArrayList<DynamicAttachment> result=new ArrayList<DynamicAttachment>();
  LinkedList<DynamicAttachment> queue=new LinkedList<DynamicAttachment>();
  for (  DynamicAttachment a : list) {
    a.attachedMasterCnt=0;
    for (    DynamicComponent m : a.getMasters()) {
      if (m.isAttached()) {
        a.attachedMasterCnt++;
      }
    }
    if (a.attachedMasterCnt == 0) {
      queue.offer(a);
    }
  }
  while (!queue.isEmpty()) {
    DynamicAttachment a=queue.poll();
    if (a.getSlave() != null) {
      LinkedList<DynamicAttachment> masterAttachments=a.getSlave().getMasterAttachments();
      if (masterAttachments != null) {
        for (        DynamicAttachment b : masterAttachments) {
          b.attachedMasterCnt--;
          if (b.attachedMasterCnt == 0) {
            queue.offer(b);
          }
        }
      }
    }
    result.add(a);
  }
  return result;
}
Program: 71006
Project: 71006
Buggy source:
public MeshBase readMesh(MeshBase mesh) throws IOException {
  if (!myInputHasBeenParsed) {
    parse();
  }
  if (mesh == null) {
    if (myCurrentGroup.faceList.size() == 0) {
      mesh=new PointMesh();
    }
 else {
      mesh=new PolygonalMesh();
    }
  }
  if (mesh instanceof PolygonalMesh) {
    setMesh((PolygonalMesh)mesh);
  }
 else   if (mesh instanceof PolylineMesh) {
    setMesh((PolylineMesh)mesh);
  }
 else   if (mesh instanceof PointMesh) {
    setMesh((PointMesh)mesh);
  }
 else {
    throw new IllegalArgumentException("String_Node_Str" + mesh.getClass() + "String_Node_Str");
  }
  return mesh;
}

Fixed version (ground truth):
@Override public PolygonalMesh readMesh() throws IOException {
  return (PolygonalMesh)readMesh(new PolygonalMesh());
}
Program: 71010
Project: 71010
Buggy source:
public void checkAndPrintGLError();

Fixed version (ground truth):
public boolean checkAndPrintGLError();
Program: 71011
Project: 71011
Buggy source:
public void checkAndPrintGLError(){
  int err=gl.glGetError();
  if (err != GL.GL_NO_ERROR) {
    String msg=Error.gluErrorString(err);
    printErr(msg + "String_Node_Str" + err+ "String_Node_Str");
  }
}

Fixed version (ground truth):
public boolean checkAndPrintGLError(){
  int err=gl.glGetError();
  if (err != GL.GL_NO_ERROR) {
    String msg=Error.gluErrorString(err);
    printErr(msg + "String_Node_Str" + err+ "String_Node_Str");
    return false;
  }
  return true;
}
Program: 71012
Project: 71012
Buggy source:
private int renderList(GLRenderer renderer,SortedRenderableList list,int qid,int flags){
  GL2 gl=renderer.getGL2().getGL2();
  boolean selecting=renderer.isSelecting();
  for (int i=0; i < list.size(); i++) {
    GLRenderable r=list.get(i);
    if (selecting && r instanceof GLSelectable) {
      GLSelectable s=(GLSelectable)r;
      int numq=s.numSelectionQueriesNeeded();
      if (renderer.isSelectable(s)) {
        if (numq >= 0) {
          renderer.beginSubSelection(s,qid);
        }
 else {
          renderer.beginSelectionQuery(qid);
        }
        r.render(renderer,flags);
        if (numq >= 0) {
          renderer.endSubSelection();
        }
 else {
          renderer.endSelectionQuery();
        }
      }
      qid+=(numq >= 0 ? numq : 1);
    }
 else     if (selecting) {
    }
 else {
      r.render(renderer,flags);
    }
  }
  return qid;
}

Fixed version (ground truth):
private int renderList(GLRenderer renderer,SortedRenderableList list,int qid,int flags){
  GL2 gl=renderer.getGL2();
  boolean selecting=renderer.isSelecting();
  for (int i=0; i < list.size(); i++) {
    GLRenderable r=list.get(i);
    if (selecting && r instanceof GLSelectable) {
      GLSelectable s=(GLSelectable)r;
      int numq=s.numSelectionQueriesNeeded();
      if (renderer.isSelectable(s)) {
        if (numq >= 0) {
          renderer.beginSubSelection(s,qid);
        }
 else {
          renderer.beginSelectionQuery(qid);
        }
        r.render(renderer,flags);
        renderer.checkAndPrintGLError();
        if (numq >= 0) {
          renderer.endSubSelection();
        }
 else {
          renderer.endSelectionQuery();
        }
      }
      qid+=(numq >= 0 ? numq : 1);
    }
 else     if (selecting) {
    }
 else {
      r.render(renderer,flags);
      renderer.checkAndPrintGLError();
    }
  }
  return qid;
}
Program: 71014
Project: 71014
Buggy source:
/** 
 * Computes the norm of the residual <pre> M x - b </pre> for a given values of M, x, and b. The values of <code>M</code> are given in compressed row storage (CRS) format. 
 * @param rowOffs matrix row offsets (CRS format)
 * @param colIdxs non-zero element column indices (CRS format)
 * @param vals non-zero element value (CRS format)
 * @param x supplies the solution value
 * @param b supplies the right-hand-side
 * @throws IllegalArgumentException if the dimensions of <code>x</code> or<code>b</code> are incompatible with the matrix size.
 */
public double residual(int[] rowOffs,int[] colIdxs,double[] vals,double[] x,double[] b){
  if (x.length < mySize) {
    throw new IllegalArgumentException("String_Node_Str" + x.length + "String_Node_Str"+ mySize);
  }
 else   if (b.length < mySize) {
    throw new IllegalArgumentException("String_Node_Str" + b.length + "String_Node_Str"+ mySize);
  }
  System.out.println("String_Node_Str" + mySize + "String_Node_Str"+ myNumVals);
  double[] check=new double[mySize];
  for (int i=0; i < mySize; i++) {
    int end=(i < (mySize - 1) ? rowOffs[i + 1] - 1 : myNumVals);
    for (int k=rowOffs[i] - 1; k < end; k++) {
      check[i]+=vals[k] * x[colIdxs[k] - 1];
    }
  }
  double sum=0;
  for (int i=0; i < mySize; i++) {
    sum+=check[i] * check[i];
  }
  return Math.sqrt(sum);
}

Fixed version (ground truth):
/** 
 * Computes the norm of the residual <pre> M x - b </pre> for a given values of M, x, and b. The values of <code>M</code> are given in compressed row storage (CRS) format. 
 * @param rowOffs matrix row offsets (CRS format)
 * @param colIdxs non-zero element column indices (CRS format)
 * @param vals non-zero element value (CRS format)
 * @param x supplies the solution value
 * @param b supplies the right-hand-side
 * @param symmetric if <code>true</code>, assumes that the argumentsdefine only the upper triangular portion of a symmetric matrix.
 * @throws IllegalArgumentException if the dimensions of <code>x</code> or<code>b</code> are incompatible with the matrix size.
 */
public double residual(int[] rowOffs,int[] colIdxs,double[] vals,double[] x,double[] b,boolean symmetric){
  int size=rowOffs.length - 1;
  if (x.length < size) {
    throw new IllegalArgumentException("String_Node_Str" + x.length + "String_Node_Str"+ size);
  }
 else   if (b.length < size) {
    throw new IllegalArgumentException("String_Node_Str" + b.length + "String_Node_Str"+ size);
  }
  double[] check=new double[size];
  for (int i=0; i < size; i++) {
    int end=rowOffs[i + 1] - 1;
    for (int k=rowOffs[i] - 1; k < end; k++) {
      int j=colIdxs[k] - 1;
      check[i]+=vals[k] * x[j];
      if (symmetric && i != j) {
        check[j]+=vals[k] * x[i];
      }
    }
  }
  double sum=0;
  for (int i=0; i < size; i++) {
    sum+=(check[i] - b[i]) * (check[i] - b[i]);
  }
  return Math.sqrt(sum);
}
Program: 71015
Project: 71015
Buggy source:
public double computeF(double l,double ldot,double l0,double excitation){
  double lenOpt=myOptLength;
  double lenRat=1 / lenOpt;
  double lenUpperLim=1.6 * lenOpt;
  double lenLowerLim=0.4 * lenOpt;
  double fact=0;
  double fpas=0;
  double P1=myExpStressCoeff;
  double P2=myUncrimpingFactor;
  if (!myP3P4Valid) {
    myP3=P1 * P2 * Math.exp(P2 * (myMaxLength / lenOpt - 1));
    myP4=P1 * (Math.exp(P2 * (myMaxLength / lenOpt - 1)) - 1) - myP3 * myMaxLength / lenOpt;
    myP3P4Valid=true;
  }
  if (myZeroForceBelowLenOptP && l <= lenOpt) {
    fpas=0;
  }
 else   if (l <= myMaxLength) {
    fpas=P1 * (Math.exp(P2 * (lenRat - 1)) - 1);
  }
 else {
    fpas=myP3 * lenRat + myP4;
  }
  if (l <= 0.6 * lenOpt) {
    fact=9 * square(lenRat - 0.4);
  }
 else   if (l < 1.4 * lenOpt) {
    fact=1 - 4 * square(1 - lenRat);
  }
 else {
    fact=9 * square(lenRat - 1.6);
  }
  if (l < lenLowerLim || l > lenUpperLim) {
    fact=0;
  }
  return myMaxForce * (fpas + excitation * fact);
}

Fixed version (ground truth):
public double computeF(double l,double ldot,double l0,double excitation){
  double lenOpt=myOptLength;
  double lenRat=l / lenOpt;
  double lenUpperLim=1.6 * lenOpt;
  double lenLowerLim=0.4 * lenOpt;
  double fact=0;
  double fpas=0;
  double P1=myExpStressCoeff;
  double P2=myUncrimpingFactor;
  if (!myP3P4Valid) {
    myP3=P1 * P2 * Math.exp(P2 * (myMaxLength / lenOpt - 1));
    myP4=P1 * (Math.exp(P2 * (myMaxLength / lenOpt - 1)) - 1) - myP3 * myMaxLength / lenOpt;
    myP3P4Valid=true;
  }
  if (myZeroForceBelowLenOptP && l <= lenOpt) {
    fpas=0;
  }
 else   if (l <= myMaxLength) {
    fpas=P1 * (Math.exp(P2 * (lenRat - 1)) - 1);
  }
 else {
    fpas=myP3 * lenRat + myP4;
  }
  if (l <= 0.6 * lenOpt) {
    fact=9 * square(lenRat - 0.4);
  }
 else   if (l < 1.4 * lenOpt) {
    fact=1 - 4 * square(1 - lenRat);
  }
 else {
    fact=9 * square(lenRat - 1.6);
  }
  if (l < lenLowerLim || l > lenUpperLim) {
    fact=0;
  }
  return myMaxForce * (fpas + excitation * fact);
}
Program: 71016
Project: 71016
Buggy source:
/** 
 * Attempts to use preconditioned CGS iteration to solve M x = b for a given right-hand side <code>b</code>. Current numeric values for M are supplied by the argument <code>vals</code>. Otherwise this method behaves identically to  {@link #iterativeSolve(double[],double[],int)}.
 * @param vals supplied the current matrix values 
 * @param x returns the solution value
 * @param b supplies the right-hand side
 * @param tolExp exponent for the stopping criterion
 * @return number of iterations performed, negated if unsuccessful
 * @throws ImproperStateException if the matrix has not previously beenfactored.
 * @throws IllegalArgumentException if there are insufficient valuesspecified by <code>vals</code>, the dimensions of <code>x</code> or <code>b</code> are incompatible with the matrix size, or if <code>topExp</code> is negative.
 */
public synchronized int iterativeSolve(double[] vals,double[] x,double[] b,int tolExp){
  checkFactored();
  checkSolveArgs(x,b);
  if (vals.length < myNumVals) {
    throw new IllegalArgumentException("String_Node_Str" + vals.length + "String_Node_Str"+ myNumVals);
  }
 else   if (tolExp < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int rcode=doIterativeSolve(myHandle,vals,x,b,tolExp);
  if (rcode > 0) {
    myErrMsg=null;
    return rcode;
  }
 else {
    myErrMsg=getErrorMessage(rcode % 10 - 20);
    return -(rcode / 10);
  }
}

Fixed version (ground truth):
/** 
 * Attempts to use preconditioned CGS iteration to solve M x = b for a given right-hand side <code>b</code>. Current numeric values for M are supplied by the argument <code>vals</code>. Otherwise this method behaves identically to  {@link #iterativeSolve(double[],double[],int)}.
 * @param vals supplied the current matrix values 
 * @param x returns the solution value
 * @param b supplies the right-hand side
 * @param tolExp exponent for the stopping criterion
 * @return number of iterations performed, negated if unsuccessful
 * @throws ImproperStateException if the matrix has not previously beenfactored.
 * @throws IllegalArgumentException if there are insufficient valuesspecified by <code>vals</code>, the dimensions of <code>x</code> or <code>b</code> are incompatible with the matrix size, or if <code>topExp</code> is negative.
 */
public synchronized int iterativeSolve(double[] vals,double[] x,double[] b,int tolExp){
  checkFactored();
  checkSolveArgs(x,b);
  if (vals.length < myNumVals) {
    throw new IllegalArgumentException("String_Node_Str" + vals.length + "String_Node_Str"+ myNumVals);
  }
 else   if (tolExp < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  boolean rhs0=true;
  for (int i=0; i < b.length; i++) {
    if (b[i] != 0) {
      rhs0=false;
      break;
    }
  }
  int rcode=0;
  if (rhs0) {
    for (int i=0; i < x.length; i++) {
      x[i]=0;
    }
  }
 else {
    rcode=doIterativeSolve(myHandle,vals,x,b,tolExp);
  }
  if (rcode > 0) {
    myErrMsg=null;
    return rcode;
  }
 else {
    myErrMsg=getErrorMessage(rcode % 10 - 20);
    return -(rcode / 10);
  }
}
Program: 71017
Project: 71017
Buggy source:
private static RenderProps createDefaultRenderProps(){
  RenderProps mr=new MeshRenderProps();
  return mr;
}

Fixed version (ground truth):
private static RenderProps createDefaultRenderProps(){
  RenderProps mr=new RenderProps();
  return mr;
}
Program: 71018
Project: 71018
Buggy source:
public RenderProps createRenderProps(){
  MeshBase mesh=getMesh();
  if (mesh != null) {
    RenderProps props=mesh.createRenderProps(this);
    return props;
  }
 else {
    return RenderProps.createMeshProps(this);
  }
}

Fixed version (ground truth):
public RenderProps createRenderProps(){
  MeshBase mesh=getMesh();
  if (mesh != null) {
    RenderProps props=mesh.createRenderProps(this);
    return props;
  }
 else {
    return RenderProps.createRenderProps(this);
  }
}
Program: 71022
Project: 71022
Buggy source:
private int numModelEntries(Node<MenuEntry> node){
  int num=0;
  MenuEntry entry=node.getData();
switch (entry.getType()) {
case MENU:
{
      for (      Node<MenuEntry> child : node.getChildren()) {
        num+=numModelEntries(child);
      }
      break;
    }
case MODEL:
{
    if (entry instanceof DemoEntry) {
      num++;
    }
    break;
  }
}
return num;
}

Fixed version (ground truth):
private int numModelEntries(Node<MenuEntry> node){
  int num=0;
  MenuEntry entry=node.getData();
switch (entry.getType()) {
case MENU:
{
      for (      Node<MenuEntry> child : node.getChildren()) {
        num+=numModelEntries(child);
      }
      break;
    }
case MODEL:
{
    if (entry instanceof DemoEntry) {
      num++;
    }
    break;
  }
default :
break;
}
return num;
}
Program: 71023
Project: 71023
Buggy source:
private JMenu createDemosMenu(String menuTitle){
  JMenu menu=new JMenu(menuTitle);
  Tree<MenuEntry> menuTree=myMain.getDemoMenu();
  if (menuTree == null) {
    VerticalGridLayout menuGrid=new VerticalGridLayout(MAX_MENU_ROWS,0);
    menu.getPopupMenu().setLayout(menuGrid);
    String[] demoNames=myMain.getDemoNames();
    for (int i=0; i < demoNames.length; i++) {
      JMenuItem item=makeMenuItem(demoNames[i],demoNames[i]);
      item.setToolTipText(myMain.getDemoClassName(demoNames[i]));
      menu.add(item);
    }
  }
 else {
    if (menuTree.getRootElement().getChildren().size() > MAX_MENU_ROWS) {
      VerticalGridLayout menuGrid=new VerticalGridLayout(MAX_MENU_ROWS,0);
      menu.getPopupMenu().setLayout(menuGrid);
    }
    for (    Node<MenuEntry> node : menuTree.getRootElement().getChildren()) {
      if (numModelEntries(node) > 0) {
        buildMenu(menu,node);
      }
    }
  }
  return menu;
}

Fixed version (ground truth):
private JMenu createDemosMenu(String menuTitle){
  JMenu menu=new JMenu(menuTitle);
  Tree<MenuEntry> menuTree=myMain.getDemoMenu();
  if (menuTree == null) {
    VerticalGridLayout menuGrid=new VerticalGridLayout(MAX_MENU_ROWS,0);
    menu.getPopupMenu().setLayout(menuGrid);
    String[] demoNames=myMain.getDemoNames();
    for (int i=0; i < demoNames.length; i++) {
      JMenuItem item=makeMenuItem(demoNames[i],demoNames[i]);
      item.setToolTipText(myMain.getDemoClassName(demoNames[i]));
      menu.add(item);
    }
  }
 else {
    if (menuTree.getRootElement().getChildren().size() > MAX_MENU_ROWS) {
      VerticalGridLayout menuGrid=new VerticalGridLayout(MAX_MENU_ROWS,0);
      menu.getPopupMenu().setLayout(menuGrid);
    }
    for (    Node<MenuEntry> node : menuTree.getRootElement().getChildren()) {
      if (!isMenuEmpty(node)) {
        buildMenu(menu,node);
      }
    }
  }
  return menu;
}
Program: 71024
Project: 71024
Buggy source:
/** 
 * Attempts to load the native libraries needed for Pardiso.
 */
private static void doLoadLibraries(){
  try {
    NativeLibraryManager.setFlags(NativeLibraryManager.VERBOSE);
switch (NativeLibraryManager.getSystemType()) {
case Linux:
case Linux64:
{
        NativeLibraryManager.load("String_Node_Str");
        break;
      }
case Windows:
case Windows64:
{
      NativeLibraryManager.load("String_Node_Str");
      break;
    }
case MacOS:
{
    NativeLibraryManager.load("String_Node_Str");
    break;
  }
}
NativeLibraryManager.load("String_Node_Str");
myInitStatus=INIT_LIBRARIES_LOADED;
}
 catch (NativeLibraryException e) {
System.out.println(e.getMessage());
myInitStatus=ERR_CANT_LOAD_LIBRARIES;
}
}

Fixed version (ground truth):
/** 
 * Attempts to load the native libraries needed for Pardiso.
 */
private static void doLoadLibraries(){
  try {
    NativeLibraryManager.setFlags(NativeLibraryManager.VERBOSE);
switch (NativeLibraryManager.getSystemType()) {
case Linux:
case Linux64:
{
        NativeLibraryManager.load("String_Node_Str");
        break;
      }
case Windows:
case Windows64:
{
      NativeLibraryManager.load("String_Node_Str");
      break;
    }
case MacOS:
{
    break;
  }
}
NativeLibraryManager.load("String_Node_Str");
myInitStatus=INIT_LIBRARIES_LOADED;
}
 catch (NativeLibraryException e) {
System.out.println(e.getMessage());
myInitStatus=ERR_CANT_LOAD_LIBRARIES;
}
}
Program: 71025
Project: 71025
Buggy source:
private void throwIfInvalidConfigMakesClusterUnusable() throws ClusterConfigurationError {
  try {
    Logger.trace("String_Node_Str");
    final List<Node> nodes=seqAsJavaList(kafkaAdminClient.findAllBrokers());
    final List<String> advertisedListeners=new ArrayList<>();
    for (    Node node : nodes) {
      final String host1=node.host();
      final int port=node.port();
      final String advertisedListener=String.format("String_Node_Str",host1,port);
      Logger.debug("String_Node_Str" + advertisedListener);
      advertisedListeners.add(advertisedListener);
      Logger.trace(String.format("String_Node_Str",host1));
      if (HostnameUtils.isHostnameReachable(host1,ApplicationConstants.HOSTNAME_REACHABLE_TIMEOUT_MS)) {
        Logger.trace("String_Node_Str");
        return;
      }
      Logger.trace("String_Node_Str");
    }
    final String msg=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",advertisedListeners,APPLICATION_NAME);
    throw new ClusterConfigurationError(msg);
  }
 catch (  RuntimeException e) {
    Logger.trace(e);
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void throwIfInvalidConfigMakesClusterUnusable() throws ClusterConfigurationError {
  try {
    Logger.trace("String_Node_Str");
    final List<Node> nodes=seqAsJavaList(kafkaAdminClient.findAllBrokers());
    final List<String> advertisedListeners=new ArrayList<>();
    for (    Node node : nodes) {
      final String host1=node.host();
      final int port=node.port();
      final String advertisedListener=String.format("String_Node_Str",host1,port);
      Logger.debug("String_Node_Str" + advertisedListener);
      advertisedListeners.add(advertisedListener);
      Logger.trace(String.format("String_Node_Str",host1));
      if (HostnameUtils.isHostnameReachable(host1,ApplicationConstants.HOSTNAME_REACHABLE_TIMEOUT_MS)) {
        Logger.trace("String_Node_Str");
        return;
      }
      Logger.trace("String_Node_Str");
    }
    final String msg=String.format("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",advertisedListeners,APPLICATION_NAME);
    throw new ClusterConfigurationError(msg);
  }
 catch (  RuntimeException e) {
    Logger.trace(e);
    e.printStackTrace();
  }
}