nus-yam/ex-repair huggingface dataset:
Program: 82589
Project: 82589
Buggy source:
protected void closeOldReaders(String table){
  Set<String> shardsToServe=getShardsToServe(table);
  Map<String,IndexReader> tableReaders=readers.get(table);
  if (tableReaders == null) {
    return;
  }
  Set<String> shardsOpen=new HashSet<String>(tableReaders.keySet());
  shardsOpen.removeAll(shardsToServe);
  if (shardsOpen.isEmpty()) {
    return;
  }
  for (  String shard : shardsOpen) {
    LOG.info("String_Node_Str",table,shard);
    IndexReader indexReader=tableReaders.remove(shard);
    beforeClose(shard,indexReader);
    try {
      indexReader.close();
    }
 catch (    IOException e) {
      LOG.error("String_Node_Str",e,indexReader);
    }
    cleanupLocallyCachedIndexes(table,shard);
  }
}

Fixed version (ground truth):
protected void closeOldReaders(String table){
  Set<String> shardsToServe=getShardsToServe(table);
  Map<String,IndexReader> tableReaders=readers.get(table);
  if (tableReaders == null) {
    return;
  }
  Set<String> shardsOpen=new HashSet<String>(tableReaders.keySet());
  shardsOpen.removeAll(shardsToServe);
  if (shardsOpen.isEmpty()) {
    return;
  }
  for (  String shard : shardsOpen) {
    IndexReader indexReader=tableReaders.remove(shard);
    closeIndex(table,shard,indexReader);
  }
}
Program: 82590
Project: 82590
Buggy source:
@Override protected IndexReader openShard(String table,String shard) throws IOException {
  LOG.info("String_Node_Str",shard,table);
  Path tablePath=new Path(blurBasePath,table);
  if (!exists(tablePath)) {
    throw new FileNotFoundException(tablePath.toString());
  }
  Path hdfsDirPath=new Path(tablePath,shard);
  if (!exists(hdfsDirPath)) {
    throw new FileNotFoundException(hdfsDirPath.toString());
  }
  ReplicaHdfsDirectory directory=new ReplicaHdfsDirectory(table,shard,hdfsDirPath,fileSystem,localFileCache,lockFactory,new Progressable(){
    @Override public void progress(){
    }
  }
,replicationDaemon);
  touchFiles(directory,table,shard);
  return IndexReader.open(directory);
}

Fixed version (ground truth):
@Override protected IndexReader openShard(String table,String shard) throws IOException {
  LOG.info("String_Node_Str",shard,table);
  Path tablePath=new Path(blurBasePath,table);
  if (!exists(tablePath)) {
    throw new FileNotFoundException(tablePath.toString());
  }
  Path hdfsDirPath=new Path(tablePath,shard);
  if (!exists(hdfsDirPath)) {
    throw new FileNotFoundException(hdfsDirPath.toString());
  }
  ReplicaHdfsDirectory directory=new ReplicaHdfsDirectory(table,shard,hdfsDirPath,fileSystem,localFileCache,lockFactory,new Progressable(){
    @Override public void progress(){
    }
  }
,replicationDaemon);
  return warmUp(IndexReader.open(directory));
}
Program: 82591
Project: 82591
Buggy source:
@Override public List<String> getShardList(String table){
  List<String> result=new ArrayList<String>();
  try {
    FileStatus[] listStatus=fileSystem.listStatus(new Path(blurBasePath,table));
    for (    FileStatus status : listStatus) {
      if (status.isDir()) {
        result.add(status.getPath().getName());
      }
    }
    return result;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@Override public List<String> getShardList(String table){
  List<String> result=new ArrayList<String>();
  try {
    FileStatus[] listStatus=fileSystem.listStatus(new Path(blurBasePath,table));
    for (    FileStatus status : listStatus) {
      if (status.isDir()) {
        String name=status.getPath().getName();
        if (name.startsWith(SHARD_PREFIX)) {
          result.add(name);
        }
      }
    }
    return result;
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 82593
Project: 82593
Buggy source:
@Override public void update(long deltaTime){
  float delta=deltaTime / (float)1e9;
  float speed1=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 4f : 16) * delta;
  float speed2=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 11.25f : 45f) * delta;
  float speed3=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 5f : 20) * delta;
  if (Keyboard.isKeyDown(Keyboard.KEY_W))   camTarget.sub(0,0,speed1);
  if (Keyboard.isKeyDown(Keyboard.KEY_S))   camTarget.add(0,0,speed1);
  if (Keyboard.isKeyDown(Keyboard.KEY_D))   camTarget.add(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_A))   camTarget.sub(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_E))   camTarget.sub(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_Q))   camTarget.add(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_I))   sphereCamRelPos.sub(0,speed2,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_K))   sphereCamRelPos.add(0,speed2,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_J))   sphereCamRelPos.sub(speed2,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_L))   sphereCamRelPos.add(speed2,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_O))   sphereCamRelPos.sub(0,0,speed3);
  if (Keyboard.isKeyDown(Keyboard.KEY_U))   sphereCamRelPos.add(0,0,speed3);
  sphereCamRelPos.y(Utils.clamp(sphereCamRelPos.y(),-78.75f,-1));
  camTarget.y(camTarget.y() > 0 ? camTarget.y() : 0);
  sphereCamRelPos.z(sphereCamRelPos.z() > 5 ? sphereCamRelPos.z() : 5);
}

Fixed version (ground truth):
@Override public void update(long deltaTime){
  float delta=deltaTime / (float)1e9;
  float speed1=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 4f : 16) * delta;
  float speed2=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 11.25f : 45f) * delta;
  float speed3=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 5f : 20) * delta;
  if (Keyboard.isKeyDown(Keyboard.KEY_W))   camTarget.sub(0,0,speed1);
  if (Keyboard.isKeyDown(Keyboard.KEY_S))   camTarget.add(0,0,speed1);
  if (Keyboard.isKeyDown(Keyboard.KEY_D))   camTarget.add(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_A))   camTarget.sub(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_E))   camTarget.sub(0,speed1,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_Q))   camTarget.add(0,speed1,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_I))   sphereCamRelPos.sub(0,speed2,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_K))   sphereCamRelPos.add(0,speed2,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_J))   sphereCamRelPos.sub(speed2,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_L))   sphereCamRelPos.add(speed2,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_O))   sphereCamRelPos.sub(0,0,speed3);
  if (Keyboard.isKeyDown(Keyboard.KEY_U))   sphereCamRelPos.add(0,0,speed3);
  sphereCamRelPos.y(Utils.clamp(sphereCamRelPos.y(),-78.75f,-1));
  camTarget.y(camTarget.y() > 0 ? camTarget.y() : 0);
  sphereCamRelPos.z(sphereCamRelPos.z() > 5 ? sphereCamRelPos.z() : 5);
}
Program: 82594
Project: 82594
Buggy source:
@Override public void update(long deltaTime){
  float delta=deltaTime / (float)1e9;
  float speed1=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 4f : 16) * delta;
  float speed2=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 11.25f : 45f) * delta;
  float speed3=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 5f : 20) * delta;
  if (Keyboard.isKeyDown(Keyboard.KEY_W))   camTarget.sub(0,0,speed1);
  if (Keyboard.isKeyDown(Keyboard.KEY_S))   camTarget.add(0,0,speed1);
  if (Keyboard.isKeyDown(Keyboard.KEY_D))   camTarget.add(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_A))   camTarget.sub(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_E))   camTarget.sub(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_Q))   camTarget.add(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_I))   sphereCamRelPos.sub(0,speed2,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_K))   sphereCamRelPos.add(0,speed2,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_J))   sphereCamRelPos.sub(speed2,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_L))   sphereCamRelPos.add(speed2,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_O))   sphereCamRelPos.sub(0,0,speed3);
  if (Keyboard.isKeyDown(Keyboard.KEY_U))   sphereCamRelPos.add(0,0,speed3);
  sphereCamRelPos.y(Utils.clamp(sphereCamRelPos.y(),-78.75f,-1));
  camTarget.y(camTarget.y() > 0 ? camTarget.y() : 0);
  sphereCamRelPos.z(sphereCamRelPos.z() > 5 ? sphereCamRelPos.z() : 5);
}

Fixed version (ground truth):
@Override public void update(long deltaTime){
  float delta=deltaTime / (float)1e9;
  float speed1=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 4f : 16) * delta;
  float speed2=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 11.25f : 45f) * delta;
  float speed3=(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 5f : 20) * delta;
  if (Keyboard.isKeyDown(Keyboard.KEY_W))   camTarget.sub(0,0,speed1);
  if (Keyboard.isKeyDown(Keyboard.KEY_S))   camTarget.add(0,0,speed1);
  if (Keyboard.isKeyDown(Keyboard.KEY_D))   camTarget.add(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_A))   camTarget.sub(speed1,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_E))   camTarget.sub(0,speed1,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_Q))   camTarget.add(0,speed1,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_I))   sphereCamRelPos.sub(0,speed2,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_K))   sphereCamRelPos.add(0,speed2,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_J))   sphereCamRelPos.sub(speed2,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_L))   sphereCamRelPos.add(speed2,0,0);
  if (Keyboard.isKeyDown(Keyboard.KEY_O))   sphereCamRelPos.sub(0,0,speed3);
  if (Keyboard.isKeyDown(Keyboard.KEY_U))   sphereCamRelPos.add(0,0,speed3);
  sphereCamRelPos.y(Utils.clamp(sphereCamRelPos.y(),-78.75f,-1));
  camTarget.y(camTarget.y() > 0 ? camTarget.y() : 0);
  sphereCamRelPos.z(sphereCamRelPos.z() > 5 ? sphereCamRelPos.z() : 5);
}
Program: 82595
Project: 82595
Buggy source:
private String[] clean(String[] data){
  ArrayList<String> clean=new ArrayList<>();
  for (  String s : data)   if (!(s=s.trim()).isEmpty())   clean.add(s);
  return clean.toArray(new String[0]);
}

Fixed version (ground truth):
private String[] clean(String[] data){
  ArrayList<String> clean=new ArrayList<>();
  for (  String s : data)   if (!(s=s.trim()).isEmpty())   clean.add(s);
  return clean.toArray(new String[clean.size()]);
}
Program: 82596
Project: 82596
Buggy source:
public static String[] split(String input,char delim){
  ArrayList<String> parts=new ArrayList<>();
  for (int index; (index=input.indexOf(delim)) != -1; ) {
    parts.add(input.substring(0,index));
    input=input.substring(index + 1);
  }
  parts.add(input);
  return parts.toArray(new String[0]);
}

Fixed version (ground truth):
public static String[] split(String input,char delim){
  ArrayList<String> parts=new ArrayList<>();
  for (int index; (index=input.indexOf(delim)) != -1; ) {
    parts.add(input.substring(0,index));
    input=input.substring(index + 1);
  }
  parts.add(input);
  return parts.toArray(new String[parts.size()]);
}
Program: 82597
Project: 82597
Buggy source:
public final void run(int major,int minor){
  try {
    Display.create(new PixelFormat(),new ContextAttribs(major,minor));
  }
 catch (  Exception exc) {
    exc.printStackTrace();
    System.exit(1);
  }
  gameLoop();
}

Fixed version (ground truth):
public final void run(PixelFormat format,ContextAttribs attribs){
  try {
    Display.create(format,attribs);
  }
 catch (  Exception exc) {
    exc.printStackTrace();
    System.exit(1);
  }
  gameLoop();
}
Program: 82598
Project: 82598
Buggy source:
public static void main(String[] args){
  new Example3_14().run();
}

Fixed version (ground truth):
public static void main(String[] args){
  new Example3_14().run(new PixelFormat(8,16,8));
}
Program: 82599
Project: 82599
Buggy source:
@Override public void resized(){
  super.resized();
  Matrix4 persMatrix=new Matrix4().clearToPerspectiveDeg(45,getWidth(),getHeight(),1,1000);
  glBindBuffer(GL_UNIFORM_BUFFER,projectionUniformBuffer);
  glBufferSubData(GL_UNIFORM_BUFFER,0,persMatrix.toBuffer());
  glBindBuffer(GL_UNIFORM_BUFFER,0);
  unprojectionData.clear();
  unprojectionData.asFloatBuffer().put(persMatrix.inverse().toBuffer());
  unprojectionData.asIntBuffer().put(getWidth()).put(getHeight());
  unprojectionData.flip();
  glBindBuffer(GL_UNIFORM_BUFFER,unprojectionUniformBuffer);
  glBufferSubData(GL_UNIFORM_BUFFER,0,unprojectionData);
  glBindBuffer(GL_UNIFORM_BUFFER,0);
}

Fixed version (ground truth):
@Override public void resized(){
  super.resized();
  Matrix4 persMatrix=new Matrix4().clearToPerspectiveDeg(45,getWidth(),getHeight(),1,1000);
  glBindBuffer(GL_UNIFORM_BUFFER,projectionUniformBuffer);
  glBufferSubData(GL_UNIFORM_BUFFER,0,persMatrix.toBuffer());
  glBindBuffer(GL_UNIFORM_BUFFER,0);
  unprojectionData.clear();
  unprojectionData.asFloatBuffer().put(persMatrix.inverse().toBuffer());
  unprojectionData.position(16 * 4);
  unprojectionData.asIntBuffer().put(getWidth()).put(getHeight());
  unprojectionData.position(18 * 4).flip();
  glBindBuffer(GL_UNIFORM_BUFFER,unprojectionUniformBuffer);
  glBufferSubData(GL_UNIFORM_BUFFER,0,unprojectionData);
  glBindBuffer(GL_UNIFORM_BUFFER,0);
}
Program: 82601
Project: 82601
Buggy source:
private Quaternion slerp(Quaternion q0,Quaternion q1,float alpha){
  q0=new Quaternion(q0);
  q1=new Quaternion(q1);
  float dot=q0.dot(q1);
  float DOT_THRESHOLD=0.9995f;
  if (dot > DOT_THRESHOLD)   return lerp(q0,q1,alpha);
  dot=clamp(dot,-1,1);
  float theta=(float)Math.cos(dot) * alpha;
  Quaternion q2=q1.sub(new Quaternion(q0).mult(dot)).normalize();
  return q0.mult((float)Math.cos(theta)).add(q2.mult((float)Math.sin(theta)));
}

Fixed version (ground truth):
private Quaternion slerp(Quaternion q0,Quaternion q1,float alpha){
  q0=new Quaternion(q0);
  q1=new Quaternion(q1);
  float dot=q0.dot(q1);
  float DOT_THRESHOLD=0.9995f;
  if (dot > DOT_THRESHOLD)   return lerp(q0,q1,alpha);
  dot=clamp(dot,-1,1);
  float theta=(float)Math.acos(dot) * alpha;
  Quaternion q2=q1.add(new Quaternion(q0).mult(-dot)).normalize();
  return q0.mult((float)Math.cos(theta)).add(q2.mult((float)Math.sin(theta)));
}
Program: 82602
Project: 82602
Buggy source:
public boolean update(long deltaTime){
  float currTime=deltaTime / (float)1e9;
  if (!hasUpdated) {
    absPrevTime=currTime;
    hasUpdated=true;
  }
  if (isPaused) {
    absPrevTime=currTime;
    return false;
  }
  float delta=currTime - absPrevTime;
  secAccumTime+=delta;
  absPrevTime=currTime;
  if (type == Type.SINGLE)   return secAccumTime > secDuration;
  return false;
}

Fixed version (ground truth):
public boolean update(long deltaTime){
  elapsedTime+=deltaTime;
  float currTime=elapsedTime / (float)1e9;
  if (!hasUpdated) {
    absPrevTime=currTime;
    hasUpdated=true;
  }
  if (isPaused) {
    absPrevTime=currTime;
    return false;
  }
  float delta=currTime - absPrevTime;
  secAccumTime+=delta;
  absPrevTime=currTime;
  if (type == Type.SINGLE)   return secAccumTime > secDuration;
  return false;
}
Program: 82603
Project: 82603
Buggy source:
private static TemplateDescriptor createInstance(Class<? extends TemplateDescriptor> templateDescriptor){
  try {
    return templateDescriptor.getConstructor().newInstance();
  }
 catch (  InstantiationException e) {
  }
catch (  IllegalAccessException e) {
  }
catch (  IllegalArgumentException e) {
  }
catch (  InvocationTargetException e) {
  }
catch (  NoSuchMethodException e) {
  }
catch (  SecurityException e) {
  }
  return null;
}

Fixed version (ground truth):
private static TemplateDescriptor createInstance(Class<? extends TemplateDescriptor> templateDescriptor){
  try {
    return templateDescriptor.getConstructor().newInstance();
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + templateDescriptor.getName() + "String_Node_Str",e);
  }
}
Program: 82604
Project: 82604
Buggy source:
/** 
 * This is the only way to create a new Edge
 * @param site0
 * @param site1
 * @return
 */
public static Edge createBisectingEdge(Site site0,Site site1){
  float a;
  float b;
  float c;
  float dx=site1.getX() - site0.getX();
  float dy=site1.getY() - site0.getY();
  float absdx=dx > 0 ? dx : -dx;
  float absdy=dy > 0 ? dy : -dy;
  c=site0.getX() * dx + site0.getY() * dy + (dx * dx + dy * dy) * 0.5f;
  if (absdx > absdy) {
    a=1.0f;
    b=dy / dx;
    c/=dx;
  }
 else {
    b=1.0f;
    a=dx / dy;
    c/=dy;
  }
  Edge edge=new Edge();
  edge.setLeftSite(site0);
  edge.setRightSite(site1);
  site0.addEdge(edge);
  site1.addEdge(edge);
  edge.leftVertex=null;
  edge.rightVertex=null;
  edge.set(a,b,c);
  return edge;
}

Fixed version (ground truth):
/** 
 * This is the only way to create a new Edge
 * @param site0
 * @param site1
 * @return
 */
public static Edge createBisectingEdge(Site site0,Site site1){
  float a;
  float b;
  float c;
  float dx=site1.getX() - site0.getX();
  float dy=site1.getY() - site0.getY();
  float absdx=dx > 0 ? dx : -dx;
  float absdy=dy > 0 ? dy : -dy;
  c=site0.getX() * dx + site0.getY() * dy + (dx * dx + dy * dy) * 0.5f;
  if (absdx > absdy) {
    a=1.0f;
    b=dy / dx;
    c/=dx;
  }
 else {
    b=1.0f;
    a=dx / dy;
    c/=dy;
  }
  Edge edge=new Edge();
  edge.setLeftSite(site0);
  edge.setRightSite(site1);
  site0.addEdge(edge);
  site1.addEdge(edge);
  edge.leftVertex=null;
  edge.rightVertex=null;
  edge.a=a;
  edge.b=b;
  edge.c=c;
  return edge;
}
Program: 82607
Project: 82607
Buggy source:
/** 
 * ensures that each corner is represented by only one corner object
 */
private Corner makeCorner(Map<BaseVector2f,Corner> pointCornerMap,Vector2f p){
  if (p == null) {
    return null;
  }
  for (  BaseVector2f oc : pointCornerMap.keySet()) {
    if (oc.distanceSquared(p) < 0.01f) {
      return pointCornerMap.get(oc);
    }
  }
  Corner c=new Corner(new ImmutableVector2f(p));
  corners.add(c);
  pointCornerMap.put(p,c);
  float diff=0.01f;
  boolean onLeft=closeEnough(p.getX(),realBounds.minX(),diff);
  boolean onTop=closeEnough(p.getY(),realBounds.minY(),diff);
  boolean onRight=closeEnough(p.getX(),realBounds.maxX(),diff);
  boolean onBottom=closeEnough(p.getY(),realBounds.maxY(),diff);
  if (onLeft || onTop || onRight|| onBottom) {
    c.setBorder(true);
  }
  return c;
}

Fixed version (ground truth):
/** 
 * ensures that each corner is represented by only one corner object
 */
private Corner makeCorner(Map<BaseVector2f,Corner> pointCornerMap,Rect2f srcRc,BaseVector2f orgPt){
  Corner exist=pointCornerMap.get(orgPt);
  if (exist != null) {
    return exist;
  }
  Vector2f p=transform(srcRc,realBounds,orgPt);
  Corner c=new Corner(new ImmutableVector2f(p));
  corners.add(c);
  pointCornerMap.put(orgPt,c);
  float diff=0.01f;
  boolean onLeft=closeEnough(p.getX(),realBounds.minX(),diff);
  boolean onTop=closeEnough(p.getY(),realBounds.minY(),diff);
  boolean onRight=closeEnough(p.getX(),realBounds.maxX(),diff);
  boolean onBottom=closeEnough(p.getY(),realBounds.maxY(),diff);
  if (onLeft || onTop || onRight|| onBottom) {
    c.setBorder(true);
  }
  return c;
}
Program: 82608
Project: 82608
Buggy source:
private static Graph createVoronoiGraph(Rect2d bounds,long seed){
  double density=256;
  int numSites=DoubleMath.roundToInt(bounds.area() / density,RoundingMode.HALF_UP);
  final Random r=new Random(seed);
  List<Vector2d> points=Lists.newArrayListWithCapacity(numSites);
  for (int i=0; i < numSites; i++) {
    double px=bounds.minX() + r.nextDouble() * bounds.width();
    double py=bounds.minY() + r.nextDouble() * bounds.height();
    points.add(new Vector2d(px,py));
  }
  final Voronoi v=new Voronoi(points,bounds);
  final Graph graph=new VoronoiGraph(v,2,r);
  GraphEditor.improveCorners(graph.getCorners());
  return graph;
}

Fixed version (ground truth):
private static Graph createVoronoiGraph(Rect2d bounds,long seed){
  double density=256;
  int numSites=DoubleMath.roundToInt(bounds.area() / density,RoundingMode.HALF_UP);
  final Random r=new Random(seed);
  List<Vector2d> points=Lists.newArrayListWithCapacity(numSites);
  for (int i=0; i < numSites; i++) {
    double px=bounds.minX() + r.nextDouble() * bounds.width();
    double py=bounds.minY() + r.nextDouble() * bounds.height();
    points.add(new Vector2d(px,py));
  }
  final Voronoi v=new Voronoi(points,bounds);
  final Graph graph=new VoronoiGraph(v,2);
  GraphEditor.improveCorners(graph.getCorners());
  return graph;
}
Program: 82609
Project: 82609
Buggy source:
public Biome getBiome(Region region){
  double moisture=moistureModel.getMoisture(region);
  double elevation=elevationModel.getElevation(region);
  if (waterModel.isOcean(region)) {
    return Biome.OCEAN;
  }
 else   if (waterModel.isWater(region)) {
    if (elevation < 0.1) {
      return Biome.MARSH;
    }
    if (elevation > 0.8) {
      return Biome.ICE;
    }
    return Biome.LAKE;
  }
 else   if (waterModel.isCoast(region)) {
    return Biome.BEACH;
  }
 else   if (elevation > 0.8) {
    if (moisture > 0.50) {
      return Biome.SNOW;
    }
 else     if (moisture > 0.33) {
      return Biome.TUNDRA;
    }
 else     if (moisture > 0.16) {
      return Biome.BARE;
    }
 else {
      return Biome.SCORCHED;
    }
  }
 else   if (elevation > 0.6) {
    if (moisture > 0.66) {
      return Biome.TAIGA;
    }
 else     if (moisture > 0.33) {
      return Biome.SHRUBLAND;
    }
 else {
      return Biome.TEMPERATE_DESERT;
    }
  }
 else   if (elevation > 0.3) {
    if (moisture > 0.83) {
      return Biome.TEMPERATE_RAIN_FOREST;
    }
 else     if (moisture > 0.50) {
      return Biome.TEMPERATE_DECIDUOUS_FOREST;
    }
 else     if (moisture > 0.16) {
      return Biome.GRASSLAND;
    }
 else {
      return Biome.TEMPERATE_DESERT;
    }
  }
 else {
    if (moisture > 0.66) {
      return Biome.TROPICAL_RAIN_FOREST;
    }
 else     if (moisture > 0.33) {
      return Biome.TROPICAL_SEASONAL_FOREST;
    }
 else     if (moisture > 0.16) {
      return Biome.GRASSLAND;
    }
 else {
      return Biome.SUBTROPICAL_DESERT;
    }
  }
}

Fixed version (ground truth):
@Override public Biome getBiome(Region region){
  double moisture=moistureModel.getMoisture(region);
  double elevation=elevationModel.getElevation(region);
  if (waterModel.isOcean(region)) {
    return Biome.OCEAN;
  }
 else   if (waterModel.isWater(region)) {
    if (elevation < 0.1) {
      return Biome.MARSH;
    }
    if (elevation > 0.8) {
      return Biome.ICE;
    }
    return Biome.LAKE;
  }
 else   if (waterModel.isCoast(region)) {
    return Biome.BEACH;
  }
 else   if (elevation > 0.8) {
    if (moisture > 0.50) {
      return Biome.SNOW;
    }
 else     if (moisture > 0.33) {
      return Biome.TUNDRA;
    }
 else     if (moisture > 0.16) {
      return Biome.BARE;
    }
 else {
      return Biome.SCORCHED;
    }
  }
 else   if (elevation > 0.6) {
    if (moisture > 0.66) {
      return Biome.TAIGA;
    }
 else     if (moisture > 0.33) {
      return Biome.SHRUBLAND;
    }
 else {
      return Biome.TEMPERATE_DESERT;
    }
  }
 else   if (elevation > 0.3) {
    if (moisture > 0.83) {
      return Biome.TEMPERATE_RAIN_FOREST;
    }
 else     if (moisture > 0.50) {
      return Biome.TEMPERATE_DECIDUOUS_FOREST;
    }
 else     if (moisture > 0.16) {
      return Biome.GRASSLAND;
    }
 else {
      return Biome.TEMPERATE_DESERT;
    }
  }
 else {
    if (moisture > 0.66) {
      return Biome.TROPICAL_RAIN_FOREST;
    }
 else     if (moisture > 0.33) {
      return Biome.TROPICAL_SEASONAL_FOREST;
    }
 else     if (moisture > 0.16) {
      return Biome.GRASSLAND;
    }
 else {
      return Biome.SUBTROPICAL_DESERT;
    }
  }
}
Program: 82610
Project: 82610
Buggy source:
/** 
 * @param r the region
 * @return the
 */
public double getElevation(Region r);

Fixed version (ground truth):
/** 
 * @param r the region
 * @return the
 */
double getElevation(Region r);
Program: 82611
Project: 82611
Buggy source:
/** 
 * @param c the corner of interest
 * @return the neighbor corner with the lowest elevation
 */
public Corner getDownslope(Corner c);

Fixed version (ground truth):
/** 
 * @param c the corner of interest
 * @return the neighbor corner with the lowest elevation
 */
Corner getDownslope(Corner c);
Program: 82612
Project: 82612
Buggy source:
/** 
 * @param loc the loc to set
 */
public void setLocation(Vector2d loc){
  this.loc=loc;
}

Fixed version (ground truth):
/** 
 * @param nloc the loc to set
 */
public void setLocation(Vector2d nloc){
  this.loc=nloc;
}
Program: 82613
Project: 82613
Buggy source:
/** 
 * @return
 */
public List<Region> getRegions();

Fixed version (ground truth):
/** 
 * @return
 */
List<Region> getRegions();
Program: 82614
Project: 82614
Buggy source:
/** 
 * @return the corners
 */
public List<Corner> getCorners();

Fixed version (ground truth):
/** 
 * @return the corners
 */
List<Corner> getCorners();
Program: 82615
Project: 82615
Buggy source:
/** 
 * @return
 */
public List<Edge> getEdges();

Fixed version (ground truth):
/** 
 * @return
 */
List<Edge> getEdges();
Program: 82616
Project: 82616
Buggy source:
/** 
 * @return the bounds
 */
public Rect2d getBounds();

Fixed version (ground truth):
/** 
 * @return the bounds
 */
Rect2d getBounds();
Program: 82617
Project: 82617
Buggy source:
/** 
 * Moves all corners to a random position within a circle with r=maxDist around it
 * @param corners the set of corners
 * @param random the random number gen
 * @param maxDist the maximum moving distance
 */
public static void jitterCorners(Collection<Corner> corners,Random random,double maxDist){
  for (  Corner c : corners) {
    if (c.isBorder())     continue;
    Vector2d loc=c.getLocation();
    double ang=random.nextDouble(0,Math.PI * 2.0);
    double len=random.nextDouble(0,maxDist);
    double rx=Math.cos(ang) * len;
    double ry=Math.sin(ang) * len;
    loc.addX(rx);
    loc.addY(ry);
  }
}

Fixed version (ground truth):
/** 
 * Moves all corners to a random position within a circle with r=maxDist around it
 * @param corners the set of corners
 * @param random the random number gen
 * @param maxDist the maximum moving distance
 */
public static void jitterCorners(Collection<Corner> corners,Random random,double maxDist){
  for (  Corner c : corners) {
    if (c.isBorder()) {
      continue;
    }
    Vector2d loc=c.getLocation();
    double ang=random.nextDouble(0,Math.PI * 2.0);
    double len=random.nextDouble(0,maxDist);
    double rx=Math.cos(ang) * len;
    double ry=Math.sin(ang) * len;
    loc.addX(rx);
    loc.addY(ry);
  }
}
Program: 82618
Project: 82618
Buggy source:
private Corner getCorner(int r,int c){
  if (r < 0 || r > rows)   return null;
  if (c < 0 || c > cols)   return null;
  int idx=r * (cols + 1) + c;
  return corners.get(idx);
}

Fixed version (ground truth):
private Corner getCorner(int r,int c){
  if (r < 0 || r > rows) {
    return null;
  }
  if (c < 0 || c > cols) {
    return null;
  }
  int idx=r * (cols + 1) + c;
  return corners.get(idx);
}
Program: 82619
Project: 82619
Buggy source:
private Region getRegion(int r,int c){
  if (r < 0 || r >= rows)   return null;
  if (c < 0 || c >= cols)   return null;
  int idx=r * cols + c;
  return regions.get(idx);
}

Fixed version (ground truth):
private Region getRegion(int r,int c){
  if (r < 0 || r >= rows) {
    return null;
  }
  if (c < 0 || c >= cols) {
    return null;
  }
  int idx=r * cols + c;
  return regions.get(idx);
}
Program: 82621
Project: 82621
Buggy source:
public VoronoiGraph(Voronoi ov,int numLloydRelaxations,Random r){
  Voronoi v=ov;
  bounds=v.getPlotBounds();
  for (int i=0; i < numLloydRelaxations; i++) {
    List<Vector2d> points=v.siteCoords();
    for (    Vector2d p : points) {
      List<Vector2d> region=v.region(p);
      double x=0;
      double y=0;
      for (      Vector2d c : region) {
        x+=c.getX();
        y+=c.getY();
      }
      x/=region.size();
      y/=region.size();
      p.setX(x);
      p.setY(y);
    }
    v=new Voronoi(points,v.getPlotBounds());
  }
  buildGraph(v);
}

Fixed version (ground truth):
public VoronoiGraph(Voronoi ov,int numLloydRelaxations){
  Voronoi v=ov;
  bounds=v.getPlotBounds();
  for (int i=0; i < numLloydRelaxations; i++) {
    List<Vector2d> points=v.siteCoords();
    for (    Vector2d p : points) {
      List<Vector2d> region=v.region(p);
      double x=0;
      double y=0;
      for (      Vector2d c : region) {
        x+=c.getX();
        y+=c.getY();
      }
      x/=region.size();
      y/=region.size();
      p.setX(x);
      p.setY(y);
    }
    v=new Voronoi(points,v.getPlotBounds());
  }
  buildGraph(v);
}
Program: 82622
Project: 82622
Buggy source:
public void setVornoi(Corner v0,Corner v1){
  this.v0=v0;
  this.v1=v1;
  midpoint=new Vector2d((v0.loc.getX() + v1.loc.getX()) / 2,(v0.loc.getY() + v1.loc.getY()) / 2);
}

Fixed version (ground truth):
public void setVornoi(Corner nv0,Corner nv1){
  this.v0=nv0;
  this.v1=nv1;
  midpoint=new Vector2d((v0.loc.getX() + v1.loc.getX()) / 2,(v0.loc.getY() + v1.loc.getY()) / 2);
}
Program: 82624
Project: 82624
Buggy source:
private void assignCornerElevations(){
  LinkedList<Corner> queue=new LinkedList<>();
  for (  Corner c : corners) {
    c.water=isWater(c.loc);
    if (c.border) {
      c.elevation=0;
      queue.add(c);
    }
 else {
      c.elevation=Double.MAX_VALUE;
    }
  }
  while (!queue.isEmpty()) {
    Corner c=queue.pop();
    for (    Corner a : c.adjacent) {
      double newElevation=0.01 + c.elevation;
      if (!c.water && !a.water) {
        newElevation+=1;
      }
      if (newElevation < a.elevation) {
        a.elevation=newElevation;
        queue.add(a);
      }
    }
  }
}

Fixed version (ground truth):
private void assignCornerElevations(){
  Deque<Corner> queue=new LinkedList<>();
  for (  Corner c : corners) {
    c.water=isWater(c.loc);
    if (c.border) {
      c.elevation=0;
      queue.add(c);
    }
 else {
      c.elevation=Double.MAX_VALUE;
    }
  }
  while (!queue.isEmpty()) {
    Corner c=queue.pop();
    for (    Corner a : c.adjacent) {
      double newElevation=0.01 + c.elevation;
      if (!c.water && !a.water) {
        newElevation+=1;
      }
      if (newElevation < a.elevation) {
        a.elevation=newElevation;
        queue.add(a);
      }
    }
  }
}
Program: 82625
Project: 82625
Buggy source:
private void redistributeElevations(List<Corner> landCorners){
  Collections.sort(landCorners,new Comparator<Corner>(){
    @Override public int compare(    Corner o1,    Corner o2){
      if (o1.elevation > o2.elevation) {
        return 1;
      }
 else       if (o1.elevation < o2.elevation) {
        return -1;
      }
      return 0;
    }
  }
);
  final double SCALE_FACTOR=1.1;
  for (int i=0; i < landCorners.size(); i++) {
    double y=(double)i / landCorners.size();
    double x=Math.sqrt(SCALE_FACTOR) - Math.sqrt(SCALE_FACTOR * (1 - y));
    x=Math.min(x,1);
    landCorners.get(i).elevation=x;
  }
  for (  Corner c : corners) {
    if (c.ocean || c.coast) {
      c.elevation=0.0;
    }
  }
}

Fixed version (ground truth):
private void redistributeElevations(List<Corner> landCorners){
  Collections.sort(landCorners,new Comparator<Corner>(){
    @Override public int compare(    Corner o1,    Corner o2){
      if (o1.elevation > o2.elevation) {
        return 1;
      }
 else       if (o1.elevation < o2.elevation) {
        return -1;
      }
      return 0;
    }
  }
);
  final double scaleFactor=1.1;
  for (int i=0; i < landCorners.size(); i++) {
    double y=(double)i / landCorners.size();
    double x=Math.sqrt(scaleFactor) - Math.sqrt(scaleFactor * (1 - y));
    x=Math.min(x,1);
    landCorners.get(i).elevation=x;
  }
  for (  Corner c : corners) {
    if (c.ocean || c.coast) {
      c.elevation=0.0;
    }
  }
}
Program: 82626
Project: 82626
Buggy source:
abstract protected Biome getBiome(Center p);

Fixed version (ground truth):
protected abstract Biome getBiome(Center p);
Program: 82627
Project: 82627
Buggy source:
private static boolean liesOnAxes(Rect2d r,Vector2d p){
  return closeEnough(p.getX(),r.minX(),1) || closeEnough(p.getY(),r.minY(),1) || closeEnough(p.getX(),r.maxX(),1)|| closeEnough(p.getY(),r.maxY(),1);
}

Fixed version (ground truth):
private static boolean liesOnAxes(Rect2d r,Vector2d p){
  int diff=1;
  return closeEnough(p.getX(),r.minX(),diff) || closeEnough(p.getY(),r.minY(),diff) || closeEnough(p.getX(),r.maxX(),diff)|| closeEnough(p.getY(),r.maxY(),diff);
}
Program: 82628
Project: 82628
Buggy source:
private void assignOceanCoastAndLand(){
  LinkedList<Center> queue=new LinkedList<>();
  final double waterThreshold=.3;
  for (  final Center center : centers) {
    int numWater=0;
    for (    final Corner c : center.corners) {
      if (c.border) {
        center.border=center.water=center.ocean=true;
        queue.add(center);
      }
      if (c.water) {
        numWater++;
      }
    }
    center.water=center.ocean || ((double)numWater / center.corners.size() >= waterThreshold);
  }
  while (!queue.isEmpty()) {
    final Center center=queue.pop();
    for (    final Center n : center.neighbors) {
      if (n.water && !n.ocean) {
        n.ocean=true;
        queue.add(n);
      }
    }
  }
  for (  Center center : centers) {
    boolean oceanNeighbor=false;
    boolean landNeighbor=false;
    for (    Center n : center.neighbors) {
      oceanNeighbor|=n.ocean;
      landNeighbor|=!n.water;
    }
    center.coast=oceanNeighbor && landNeighbor;
  }
  for (  Corner c : corners) {
    int numOcean=0;
    int numLand=0;
    for (    Center center : c.touches) {
      numOcean+=center.ocean ? 1 : 0;
      numLand+=!center.water ? 1 : 0;
    }
    c.ocean=numOcean == c.touches.size();
    c.coast=numOcean > 0 && numLand > 0;
    c.water=c.border || ((numLand != c.touches.size()) && !c.coast);
  }
}

Fixed version (ground truth):
private void assignOceanCoastAndLand(){
  Deque<Center> queue=new LinkedList<>();
  final double waterThreshold=.3;
  for (  final Center center : centers) {
    int numWater=0;
    for (    final Corner c : center.corners) {
      if (c.border) {
        center.border=true;
        center.water=true;
        center.ocean=true;
        queue.add(center);
      }
      if (c.water) {
        numWater++;
      }
    }
    center.water=center.ocean || ((double)numWater / center.corners.size() >= waterThreshold);
  }
  while (!queue.isEmpty()) {
    final Center center=queue.pop();
    for (    final Center n : center.neighbors) {
      if (n.water && !n.ocean) {
        n.ocean=true;
        queue.add(n);
      }
    }
  }
  for (  Center center : centers) {
    boolean oceanNeighbor=false;
    boolean landNeighbor=false;
    for (    Center n : center.neighbors) {
      oceanNeighbor|=n.ocean;
      landNeighbor|=!n.water;
    }
    center.coast=oceanNeighbor && landNeighbor;
  }
  for (  Corner c : corners) {
    int numOcean=0;
    int numLand=0;
    for (    Center center : c.touches) {
      numOcean+=center.ocean ? 1 : 0;
      numLand+=!center.water ? 1 : 0;
    }
    c.ocean=numOcean == c.touches.size();
    c.coast=numOcean > 0 && numLand > 0;
    c.water=c.border || ((numLand != c.touches.size()) && !c.coast);
  }
}
Program: 82629
Project: 82629
Buggy source:
abstract protected Color getColor(Biome biome);

Fixed version (ground truth):
protected abstract Color getColor(Biome biome);
Program: 82630
Project: 82630
Buggy source:
public VoronoiGraph(Voronoi v,int numLloydRelaxations,Random r){
  this.r=r;
  bumps=r.nextInt(5) + 1;
  startAngle=r.nextDouble() * 2 * Math.PI;
  dipAngle=r.nextDouble() * 2 * Math.PI;
  dipWidth=r.nextDouble() * .5 + .2;
  bounds=v.getPlotBounds();
  for (int i=0; i < numLloydRelaxations; i++) {
    List<Vector2d> points=v.siteCoords();
    for (    Vector2d p : points) {
      List<Vector2d> region=v.region(p);
      double x=0;
      double y=0;
      for (      Vector2d c : region) {
        x+=c.getX();
        y+=c.getY();
      }
      x/=region.size();
      y/=region.size();
      p.setX(x);
      p.setY(y);
    }
    v=new Voronoi(points,v.getPlotBounds());
  }
  buildGraph(v);
  improveCorners();
  assignCornerElevations();
  assignOceanCoastAndLand();
  redistributeElevations(landCorners());
  assignPolygonElevations();
  calculateDownslopes();
  createRivers();
  assignCornerMoisture();
  redistributeMoisture(landCorners());
  assignPolygonMoisture();
  assignBiomes();
}

Fixed version (ground truth):
public VoronoiGraph(Voronoi ov,int numLloydRelaxations,Random r){
  this.r=r;
  bumps=r.nextInt(5) + 1;
  startAngle=r.nextDouble() * 2 * Math.PI;
  dipAngle=r.nextDouble() * 2 * Math.PI;
  dipWidth=r.nextDouble() * .5 + .2;
  Voronoi v=ov;
  bounds=v.getPlotBounds();
  for (int i=0; i < numLloydRelaxations; i++) {
    List<Vector2d> points=v.siteCoords();
    for (    Vector2d p : points) {
      List<Vector2d> region=v.region(p);
      double x=0;
      double y=0;
      for (      Vector2d c : region) {
        x+=c.getX();
        y+=c.getY();
      }
      x/=region.size();
      y/=region.size();
      p.setX(x);
      p.setY(y);
    }
    v=new Voronoi(points,v.getPlotBounds());
  }
  buildGraph(v);
  improveCorners();
  assignCornerElevations();
  assignOceanCoastAndLand();
  redistributeElevations(landCorners());
  assignPolygonElevations();
  calculateDownslopes();
  createRivers();
  assignCornerMoisture();
  redistributeMoisture(landCorners());
  assignPolygonMoisture();
  assignBiomes();
}
Program: 82631
Project: 82631
Buggy source:
private boolean isWater(Vector2d p){
  p=new Vector2d(2 * (p.getX() / bounds.width() - 0.5),2 * (p.getY() / bounds.height() - 0.5));
  double angle=Math.atan2(p.getY(),p.getX());
  double length=0.5 * (Math.max(Math.abs(p.getX()),Math.abs(p.getY())) + p.length());
  double r1=0.5 + 0.40 * Math.sin(startAngle + bumps * angle + Math.cos((bumps + 3) * angle));
  double r2=0.7 - 0.20 * Math.sin(startAngle + bumps * angle - Math.sin((bumps + 2) * angle));
  if (Math.abs(angle - dipAngle) < dipWidth || Math.abs(angle - dipAngle + 2 * Math.PI) < dipWidth || Math.abs(angle - dipAngle - 2 * Math.PI) < dipWidth) {
    r1=r2=0.2;
  }
  return !(length < r1 || (length > r1 * ISLAND_FACTOR && length < r2));
}

Fixed version (ground truth):
private boolean isWater(Vector2d p2){
  Vector2d p=new Vector2d(2 * (p2.getX() / bounds.width() - 0.5),2 * (p2.getY() / bounds.height() - 0.5));
  double angle=Math.atan2(p.getY(),p.getX());
  double length=0.5 * (Math.max(Math.abs(p.getX()),Math.abs(p.getY())) + p.length());
  double r1=0.5 + 0.40 * Math.sin(startAngle + bumps * angle + Math.cos((bumps + 3) * angle));
  double r2=0.7 - 0.20 * Math.sin(startAngle + bumps * angle - Math.sin((bumps + 2) * angle));
  if (Math.abs(angle - dipAngle) < dipWidth || Math.abs(angle - dipAngle + 2 * Math.PI) < dipWidth || Math.abs(angle - dipAngle - 2 * Math.PI) < dipWidth) {
    r1=0.2;
    r2=0.2;
  }
  return !(length < r1 || (length > r1 * ISLAND_FACTOR && length < r2));
}
Program: 82632
Project: 82632
Buggy source:
private void assignCornerMoisture(){
  LinkedList<Corner> queue=new LinkedList<>();
  for (  Corner c : corners) {
    if ((c.water || c.river > 0) && !c.ocean) {
      c.moisture=c.river > 0 ? Math.min(3.0,(0.2 * c.river)) : 1.0;
      queue.push(c);
    }
 else {
      c.moisture=0.0;
    }
  }
  while (!queue.isEmpty()) {
    Corner c=queue.pop();
    for (    Corner a : c.adjacent) {
      double newM=.9 * c.moisture;
      if (newM > a.moisture) {
        a.moisture=newM;
        queue.add(a);
      }
    }
  }
  for (  Corner c : corners) {
    if (c.ocean || c.coast) {
      c.moisture=1.0;
    }
  }
}

Fixed version (ground truth):
private void assignCornerMoisture(){
  Deque<Corner> queue=new LinkedList<>();
  for (  Corner c : corners) {
    if ((c.water || c.river > 0) && !c.ocean) {
      c.moisture=c.river > 0 ? Math.min(3.0,(0.2 * c.river)) : 1.0;
      queue.push(c);
    }
 else {
      c.moisture=0.0;
    }
  }
  while (!queue.isEmpty()) {
    Corner c=queue.pop();
    for (    Corner a : c.adjacent) {
      double newM=.9 * c.moisture;
      if (newM > a.moisture) {
        a.moisture=newM;
        queue.add(a);
      }
    }
  }
  for (  Corner c : corners) {
    if (c.ocean || c.coast) {
      c.moisture=1.0;
    }
  }
}
Program: 82633
Project: 82633
Buggy source:
@Override public void paint(Graphics g){
  g.drawImage(img,0,0,null);
}

Fixed version (ground truth):
@Override public void paint(Graphics g){
  g.drawImage(img,10,40,null);
}
Program: 82634
Project: 82634
Buggy source:
public static void main(String[] args){
  final int width=650;
  final int height=350;
  final int numSites=100;
  final long seed=System.nanoTime();
  final Random r=new Random();
  System.out.println("String_Node_Str" + seed);
  final Voronoi v=new Voronoi(numSites,width,height,r);
  final TestGraphImpl graph=new TestGraphImpl(v,2,r);
  final BufferedImage img=new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
  Graphics2D g2=img.createGraphics();
  g2.setColor(Color.PINK);
  g2.fillRect(0,0,width,height);
  graph.paint(g2);
  final JFrame frame=new JFrame(){
    private static final long serialVersionUID=-1290616722309726306L;
    @Override public void paint(    Graphics g){
      g.drawImage(img,0,0,null);
    }
  }
;
  frame.setTitle("String_Node_Str");
  frame.setVisible(true);
  frame.setSize(width + 50,height + 50);
  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}

Fixed version (ground truth):
public static void main(String[] args){
  final int width=1650;
  final int height=750;
  final int numSites=3000;
  final long seed=92070987606126L;
  final Random r=new Random(seed);
  System.out.println("String_Node_Str" + seed);
  final Voronoi v=new Voronoi(numSites,width,height,r);
  final TestGraphImpl graph=new TestGraphImpl(v,2,r);
  final BufferedImage img=new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
  Graphics2D g2=img.createGraphics();
  g2.setColor(Color.CYAN);
  g2.fillRect(0,0,width,height);
  graph.paint(g2);
  final JFrame frame=new JFrame(){
    private static final long serialVersionUID=-1290616722309726306L;
    @Override public void paint(    Graphics g){
      g.drawImage(img,10,40,null);
    }
  }
;
  frame.setTitle("String_Node_Str");
  frame.setVisible(true);
  frame.setSize(width + 50,height + 50);
  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
Program: 82635
Project: 82635
Buggy source:
private static Collection<Artifact> findArtifactsMatching(IncludeRule rule,Map<ArtifactId,Artifact> allArtifacts){
  Collection<Artifact> ret=new ArrayList<Artifact>();
  for (  Entry<ArtifactId,Artifact> entry : allArtifacts.entrySet()) {
    if (MatcherHelper.matches(rule.getMatcher(),rule.getId(),entry.getKey())) {
      ret.add(allArtifacts.get(entry.getValue()));
    }
  }
  return ret;
}

Fixed version (ground truth):
private static Collection<Artifact> findArtifactsMatching(IncludeRule rule,Map<ArtifactId,Artifact> allArtifacts){
  Collection<Artifact> ret=new ArrayList<Artifact>();
  for (  Entry<ArtifactId,Artifact> entry : allArtifacts.entrySet()) {
    if (MatcherHelper.matches(rule.getMatcher(),rule.getId(),entry.getKey())) {
      ret.add(entry.getValue());
    }
  }
  return ret;
}
Program: 82636
Project: 82636
Buggy source:
private void overwriteExtraInfoIfExists(String key,String value){
  boolean found=false;
  for (  ExtraInfoHolder extraInfoHolder : ivyModuleDescriptor.getExtraInfos()) {
    if (extraInfoHolder.getName().equals(key)) {
      extraInfoHolder.setContent(value);
      found=false;
    }
  }
  if (!found) {
    ivyModuleDescriptor.getExtraInfos().add(new ExtraInfoHolder(key,value));
  }
}

Fixed version (ground truth):
private void overwriteExtraInfoIfExists(String key,String value){
  boolean found=false;
  for (  ExtraInfoHolder extraInfoHolder : ivyModuleDescriptor.getExtraInfos()) {
    if (extraInfoHolder.getName().equals(key)) {
      extraInfoHolder.setContent(value);
      found=true;
    }
  }
  if (!found) {
    ivyModuleDescriptor.getExtraInfos().add(new ExtraInfoHolder(key,value));
  }
}
Program: 82637
Project: 82637
Buggy source:
protected URI buildBundleURI(Object location){
  try {
    return new URI(((File)location).toURL().toExternalForm());
  }
 catch (  MalformedURLException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  URISyntaxException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
protected URI buildBundleURI(Object location){
  try {
    return new URI(((File)location).toURI().toURL().toExternalForm());
  }
 catch (  MalformedURLException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
catch (  URISyntaxException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 82638
Project: 82638
Buggy source:
public void testMultipleInstances() throws Exception {
  MockMessageLogger mockLogger=new MockMessageLogger();
  Ivy ivy=Ivy.newInstance();
  ivy.getLoggerEngine().setDefaultLogger(mockLogger);
  ivy.configure(new File("String_Node_Str"));
  assertFalse("String_Node_Str",IvyContext.getContext().getIvy() == ivy);
  ResolveReport report=ivy.resolve(new File("String_Node_Str").toURL(),getResolveOptions(ivy,new String[]{"String_Node_Str"}));
  assertNotNull(report);
  assertFalse(report.hasError());
  mockLogger.assertLogContains("String_Node_Str");
  assertFalse("String_Node_Str",IvyContext.getContext().getIvy() == ivy);
  MockMessageLogger mockLogger2=new MockMessageLogger();
  Ivy ivy2=new Ivy();
  ivy2.getLoggerEngine().setDefaultLogger(mockLogger2);
  ivy2.configure(new File("String_Node_Str").toURL());
  report=ivy2.resolve(new File("String_Node_Str").toURL(),getResolveOptions(ivy2,new String[]{"String_Node_Str"}));
  assertNotNull(report);
  assertFalse(report.hasError());
  mockLogger2.assertLogContains("String_Node_Str");
  assertFalse("String_Node_Str",IvyContext.getContext().getIvy() == ivy2);
  report=ivy.resolve(new File("String_Node_Str").toURL(),getResolveOptions(ivy,new String[]{"String_Node_Str"}));
  assertNotNull(report);
  assertFalse(report.hasError());
  mockLogger.assertLogContains("String_Node_Str");
  assertFalse("String_Node_Str",IvyContext.getContext().getIvy() == ivy);
}

Fixed version (ground truth):
public void testMultipleInstances() throws Exception {
  MockMessageLogger mockLogger=new MockMessageLogger();
  Ivy ivy=Ivy.newInstance();
  ivy.getLoggerEngine().setDefaultLogger(mockLogger);
  ivy.configure(new File("String_Node_Str"));
  assertFalse("String_Node_Str",IvyContext.getContext().getIvy() == ivy);
  ResolveReport report=ivy.resolve(new File("String_Node_Str"),getResolveOptions(ivy,new String[]{"String_Node_Str"}));
  assertNotNull(report);
  assertFalse(report.hasError());
  mockLogger.assertLogContains("String_Node_Str");
  assertFalse("String_Node_Str",IvyContext.getContext().getIvy() == ivy);
  MockMessageLogger mockLogger2=new MockMessageLogger();
  Ivy ivy2=new Ivy();
  ivy2.getLoggerEngine().setDefaultLogger(mockLogger2);
  ivy2.configure(new File("String_Node_Str").toURI().toURL());
  report=ivy2.resolve(new File("String_Node_Str"),getResolveOptions(ivy2,new String[]{"String_Node_Str"}));
  assertNotNull(report);
  assertFalse(report.hasError());
  mockLogger2.assertLogContains("String_Node_Str");
  assertFalse("String_Node_Str",IvyContext.getContext().getIvy() == ivy2);
  report=ivy.resolve(new File("String_Node_Str"),getResolveOptions(ivy,new String[]{"String_Node_Str"}));
  assertNotNull(report);
  assertFalse(report.hasError());
  mockLogger.assertLogContains("String_Node_Str");
  assertFalse("String_Node_Str",IvyContext.getContext().getIvy() == ivy);
}
Program: 82639
Project: 82639
Buggy source:
public ResolveReport resolve(String mrid) throws MalformedURLException, ParseException, IOException {
  return ivy.resolve(getIvyFile(mrid).toURL(),TestHelper.newResolveOptions(getSettings()));
}

Fixed version (ground truth):
public ResolveReport resolve(String mrid) throws MalformedURLException, ParseException, IOException {
  return ivy.resolve(getIvyFile(mrid),TestHelper.newResolveOptions(getSettings()));
}