nus-yam/ex-repair huggingface dataset:
Program: 109303
Project: 109303
Buggy source:
public void render(int gr0,int gr1){
  int texTarget=GL11.GL_TEXTURE_2D;
  GLTexture tex;
  float pointSize;
  gl.glLineWidth(a3d.strokeWeight);
  pointSize=PApplet.min(a3d.strokeWeight,a3d.maxPointSize);
  gl.glPointSize(pointSize);
  gl.glEnableClientState(GL11.GL_NORMAL_ARRAY);
  gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glNormalBufferID[0]);
  gl.glNormalPointer(GL11.GL_FLOAT,0,0);
  gl.glEnableClientState(GL11.GL_COLOR_ARRAY);
  gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glColorBufferID[0]);
  gl.glColorPointer(4,GL11.GL_FLOAT,0,0);
  gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
  gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glVertexBufferID[0]);
  gl.glVertexPointer(3,GL11.GL_FLOAT,0,0);
  VertexGroup group;
  for (int i=gr0; i <= gr1; i++) {
    group=(VertexGroup)groups.get(i);
    tex=group.texture;
    if (tex != null) {
      texTarget=group.texture.getGLTarget();
      gl.glEnable(texTarget);
      gl.glActiveTexture(GL11.GL_TEXTURE0);
      gl.glBindTexture(GL11.GL_TEXTURE_2D,group.texture.getGLTextureID());
      if (pointSprites) {
        float quadratic[]={1.0f,0.0f,0.01f,1};
        ByteBuffer temp=ByteBuffer.allocateDirect(16);
        temp.order(ByteOrder.nativeOrder());
        gl.glPointParameterfv(GL11.GL_POINT_DISTANCE_ATTENUATION,(FloatBuffer)temp.asFloatBuffer().put(quadratic).flip());
        gl.glPointParameterf(GL11.GL_POINT_FADE_THRESHOLD_SIZE,0.6f * pointSize);
        gl.glPointParameterf(GL11.GL_POINT_SIZE_MIN,1.0f);
        gl.glPointParameterf(GL11.GL_POINT_SIZE_MAX,a3d.maxPointSize);
        gl.glTexEnvf(GL11.GL_POINT_SPRITE_OES,GL11.GL_COORD_REPLACE_OES,GL11.GL_TRUE);
        gl.glEnable(GL11.GL_POINT_SPRITE_OES);
      }
 else {
        gl.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
        gl.glClientActiveTexture(GL11.GL_TEXTURE0);
        gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glTexCoordBufferID[0]);
        gl.glTexCoordPointer(2,GL11.GL_FLOAT,0,0);
      }
    }
    gl.glPushMatrix();
    gl.glScalef(1,-1,1);
    gl.glDrawArrays(glMode,group.first,group.last - group.first + 1);
    gl.glPopMatrix();
    if (tex != null) {
      if (pointSprites) {
        gl.glDisable(GL11.GL_POINT_SPRITE_OES);
      }
 else {
        gl.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
      }
      gl.glDisable(texTarget);
    }
  }
  gl.glDisableClientState(GL11.GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL11.GL_COLOR_ARRAY);
  gl.glDisableClientState(GL11.GL_NORMAL_ARRAY);
}

Fixed version (ground truth):
public void render(int gr0,int gr1){
  int texTarget=GL11.GL_TEXTURE_2D;
  GLTexture tex;
  float pointSize;
  gl.glLineWidth(a3d.strokeWeight);
  pointSize=PApplet.min(a3d.strokeWeight,a3d.maxPointSize);
  gl.glPointSize(pointSize);
  gl.glEnableClientState(GL11.GL_NORMAL_ARRAY);
  gl.glBindBuffer(GL11.GL_ARRAY_BUFFER,glNormalBufferID[0]);
  gl.glNormalPointer(GL11.GL_FLOAT,0,0);
  gl.glDisableClientState(GL11.GL_NORMAL_ARRAY);
  System.out.println("String_Node_Str");
}
Program: 109305
Project: 109305
Buggy source:
protected void renderPoints(int start,int stop){
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  if (vertexBuffer.capacity() == stop - start) {
    expandBuffers();
  }
  vertexBuffer.rewind();
  colorBuffer.rewind();
  float sw=vertices[lines[start][VERTEX1]][SW];
  if (sw > 0) {
    gl.glPointSize(sw);
    for (int i=start; i < stop; i++) {
      float[] a=vertices[points[i][VERTEX1]];
      colorBuffer.put(toFixed16(a[SR]));
      colorBuffer.put(toFixed16(a[SG]));
      colorBuffer.put(toFixed16(a[SB]));
      colorBuffer.put(toFixed16(a[SA]));
      vertexBuffer.put(toFixed32(a[VX]));
      vertexBuffer.put(toFixed32(a[VY]));
      vertexBuffer.put(toFixed32(a[VZ]));
    }
    gl.glVertexPointer(3,GL10.GL_FIXED,0,vertexBuffer);
    gl.glColorPointer(4,GL10.GL_FIXED,0,colorBuffer);
    gl.glDrawArrays(GL10.GL_POINTS,start,stop - start);
  }
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
}

Fixed version (ground truth):
protected void renderPoints(int start,int stop){
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
  if (vertexBuffer.capacity() / 3 < 3 * (stop - start)) {
    expandBuffers();
  }
  vertexBuffer.rewind();
  colorBuffer.rewind();
  float sw=vertices[lines[start][VERTEX1]][SW];
  if (sw > 0) {
    gl.glPointSize(sw);
    for (int i=start; i < stop; i++) {
      float[] a=vertices[points[i][VERTEX1]];
      colorBuffer.put(toFixed16(a[SR]));
      colorBuffer.put(toFixed16(a[SG]));
      colorBuffer.put(toFixed16(a[SB]));
      colorBuffer.put(toFixed16(a[SA]));
      vertexBuffer.put(toFixed32(a[VX]));
      vertexBuffer.put(toFixed32(a[VY]));
      vertexBuffer.put(toFixed32(a[VZ]));
    }
    gl.glVertexPointer(3,GL10.GL_FIXED,0,vertexBuffer);
    gl.glColorPointer(4,GL10.GL_FIXED,0,colorBuffer);
    gl.glDrawArrays(GL10.GL_POINTS,start,stop - start);
  }
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
}
Program: 109307
Project: 109307
Buggy source:
/** 
 * Preferred method of creating new PImage objects, ensures that a reference to the parent PApplet is included, which makes save() work without needing an absolute path.
 */
public PImage createImage(int wide,int high,int format){
  PImage image=new PImage(wide,high,format);
  image.parent=this;
  if (g instanceof PGraphicsAndroid3D) {
    image.format=ARGB;
    image.initTexture();
  }
  return image;
}

Fixed version (ground truth):
public PImage createImage(int wide,int high,GLTexture.Parameters params){
  PImage image=new PImage(wide,high,params.format);
  image.parent=this;
  if (g instanceof PGraphicsAndroid3D) {
    image.format=params.format;
    image.initTexture(params);
  }
  return image;
}
Program: 109308
Project: 109308
Buggy source:
protected void drawScreenTexture(){
  screenVertBuffer.position(0);
  screenTexCoordBuffer.position(0);
  gl.glColor4f(1.0f,1.0f,1.0f,1.0f);
  gl.glEnable(GL10.GL_TEXTURE_2D);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,screenTexID[0]);
  gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  gl.glVertexPointer(3,GL10.GL_FIXED,0,screenVertBuffer);
  gl.glTexCoordPointer(2,GL10.GL_FIXED,0,screenTexCoordBuffer);
  gl.glDrawArrays(GL10.GL_TRIANGLES,0,3 * 2);
  gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
  gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
}

Fixed version (ground truth):
protected void drawScreenTexture(){
  beginShape(QUADS);
  texture(screenTex);
  vertex(0,0,0,screenTex.height);
  vertex(width,0,screenTex.width,screenTex.height);
  vertex(width,height,screenTex.width,0);
  vertex(0,height,0,0);
  endShape();
}
Program: 109310
Project: 109310
Buggy source:
/** 
 * OpenGL cannot draw until a proper native peer is available, so this returns the value of PApplet.isDisplayable() (inherited from Component).
 */
public void beginDraw(){
  if (!settingsInited)   defaultSettings();
  resetMatrix();
  report("String_Node_Str");
  vertexBuffer.rewind();
  colorBuffer.rewind();
  texCoordBuffer.rewind();
  normalBuffer.rewind();
  textureImage=null;
  textureImagePrev=null;
  gl.glEnable(GL10.GL_BLEND);
  gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  if (hints[DISABLE_DEPTH_TEST]) {
    gl.glDisable(GL10.GL_DEPTH_TEST);
  }
 else {
    gl.glEnable(GL10.GL_DEPTH_TEST);
  }
  gl.glDepthFunc(GL10.GL_LEQUAL);
  gl.glFrontFace(GL10.GL_CW);
  gl.glViewport(0,0,width,height);
  camera();
  perspective();
  lightCount=0;
  lightFalloff(1,0,0);
  lightSpecular(0,0,0);
  gl.glEnable(GL10.GL_COLOR_MATERIAL);
  gl.glEnable(GL10.GL_NORMALIZE);
  gl.glEnable(GL10.GL_RESCALE_NORMAL);
  shapeFirst=0;
  if (screenTexID[0] == 0) {
    createScreenTexture();
  }
  tint(255);
  beginShape(QUADS);
  texture(screenTex);
  vertex(0,0,0,screenTex.height);
  vertex(width,0,screenTex.width,screenTex.height);
  vertex(width,height,screenTex.width,0);
  vertex(0,height,0,0);
  endShape();
  report("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * OpenGL cannot draw until a proper native peer is available, so this returns the value of PApplet.isDisplayable() (inherited from Component).
 */
public void beginDraw(){
  if (!settingsInited)   defaultSettings();
  resetMatrix();
  report("String_Node_Str");
  vertexBuffer.rewind();
  colorBuffer.rewind();
  texCoordBuffer.rewind();
  normalBuffer.rewind();
  textureImage=null;
  textureImagePrev=null;
  gl.glEnable(GL10.GL_BLEND);
  gl.glBlendFunc(GL10.GL_SRC_ALPHA,GL10.GL_ONE_MINUS_SRC_ALPHA);
  if (hints[DISABLE_DEPTH_TEST]) {
    gl.glDisable(GL10.GL_DEPTH_TEST);
  }
 else {
    gl.glEnable(GL10.GL_DEPTH_TEST);
  }
  gl.glDepthFunc(GL10.GL_LEQUAL);
  gl.glFrontFace(GL10.GL_CW);
  gl.glViewport(0,0,width,height);
  camera();
  perspective();
  lightCount=0;
  lightFalloff(1,0,0);
  lightSpecular(0,0,0);
  gl.glEnable(GL10.GL_COLOR_MATERIAL);
  gl.glEnable(GL10.GL_NORMALIZE);
  gl.glEnable(GL10.GL_RESCALE_NORMAL);
  shapeFirst=0;
  if (clear) {
    gl.glClearColor(0,0,0,0);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  }
 else {
    if (screenTex == null || screenTex.width != width || screenTex.height != height) {
      createScreenTexture();
    }
    drawScreenTexture();
  }
  report("String_Node_Str");
}
Program: 109311
Project: 109311
Buggy source:
public void endDraw(){
  copyFrameToScreenTexture();
  gl.glFlush();
  report("String_Node_Str");
}

Fixed version (ground truth):
public void endDraw(){
  if (!clear && screenTex != null) {
    copyFrameToScreenTexture();
  }
  gl.glFlush();
  report("String_Node_Str");
}
Program: 109312
Project: 109312
Buggy source:
public void setSize(int iwidth,int iheight){
  width=iwidth;
  height=iheight;
  width1=width - 1;
  height1=height - 1;
  allocate();
  reapplySettings();
  deleteScreenTexture();
  vertexCheck();
  cameraFOV=60 * DEG_TO_RAD;
  cameraX=width / 2.0f;
  cameraY=height / 2.0f;
  cameraZ=cameraY / ((float)Math.tan(cameraFOV / 2.0f));
  cameraNear=cameraZ / 10.0f;
  cameraFar=cameraZ * 10.0f;
  cameraAspect=(float)width / (float)height;
}

Fixed version (ground truth):
public void setSize(int iwidth,int iheight){
  width=iwidth;
  height=iheight;
  width1=width - 1;
  height1=height - 1;
  allocate();
  reapplySettings();
  vertexCheck();
  cameraFOV=60 * DEG_TO_RAD;
  cameraX=width / 2.0f;
  cameraY=height / 2.0f;
  cameraZ=cameraY / ((float)Math.tan(cameraFOV / 2.0f));
  cameraNear=cameraZ / 10.0f;
  cameraFar=cameraZ * 10.0f;
  cameraAspect=(float)width / (float)height;
}
Program: 109313
Project: 109313
Buggy source:
protected void createScreenTexture(){
  int[] pix=new int[width * height];
  for (int i=0; i < width * height; i++)   pix[i]=0xFF000000;
  gl.glGenTextures(1,screenTexID,0);
  gl.glBindTexture(GL10.GL_TEXTURE_2D,screenTexID[0]);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MIN_FILTER,GL10.GL_LINEAR);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_MAG_FILTER,GL10.GL_LINEAR);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_S,GL10.GL_CLAMP_TO_EDGE);
  gl.glTexParameterf(GL10.GL_TEXTURE_2D,GL10.GL_TEXTURE_WRAP_T,GL10.GL_CLAMP_TO_EDGE);
  gl.glTexImage2D(GL10.GL_TEXTURE_2D,0,GL10.GL_RGBA,width,height,0,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(pix));
  gl.glBindTexture(GL10.GL_TEXTURE_2D,0);
  int fw=toFixed32(width);
  int fh=toFixed32(height);
  int one=toFixed32(1.0f);
  int[] quadCoords={0,fh,0,0,0,0,fw,0,0,0,fh,0,fw,0,0,fw,fh,0};
  int[] quadTexCoords={0,one,0,0,one,0,0,one,one,0,one,one};
  screenVertBuffer.position(0);
  screenTexCoordBuffer.position(0);
  screenVertBuffer.put(quadCoords);
  screenTexCoordBuffer.put(quadTexCoords);
  screenTex=parent.createImage(width,height,ARGB);
  screenTex.getTexture().set(pix);
}

Fixed version (ground truth):
protected void createScreenTexture(){
  int[] pix=new int[width * height];
  for (int i=0; i < width * height; i++)   pix[i]=0xFF0000;
  screenTex=parent.createImage(width,height,ARGB,GLConstants.NEAREST);
  screenTex.getTexture().set(pix);
}
Program: 109314
Project: 109314
Buggy source:
public void initTexture(){
  texture=new GLTexture(parent,width,height,new GLTexture.Parameters(format));
  updateTexture();
}

Fixed version (ground truth):
public void initTexture(GLTexture.Parameters params){
  texture=new GLTexture(parent,width,height,params);
  updateTexture();
}
Program: 109315
Project: 109315
Buggy source:
public void skewX(float angle){
  apply(1,0,1,angle,0,0);
}

Fixed version (ground truth):
public void skewX(float angle){
  apply(1,0,1,tan(angle),0,0);
}
Program: 109316
Project: 109316
Buggy source:
public void skewY(float angle){
  apply(1,0,1,0,angle,0);
}

Fixed version (ground truth):
public void skewY(float angle){
  apply(1,0,1,0,tan(angle),0);
}
Program: 109317
Project: 109317
Buggy source:
protected boolean isWarped(){
  return ((m00 != 1) || (m01 != 0) && (m10 != 0) || (m11 != 1));
}

Fixed version (ground truth):
protected boolean isWarped(){
  return ((m00 != 1) || (m01 != 0) || (m10 != 0)|| (m11 != 1));
}
Program: 109318
Project: 109318
Buggy source:
public void requestDraw(){
  ((GLSurfaceView)parent.surfaceView).requestRender();
}

Fixed version (ground truth):
public void requestDraw(){
  if (parent.looping) {
    ((GLSurfaceView)parent.surfaceView).requestRender();
  }
}
Program: 109319
Project: 109319
Buggy source:
public AndroidSDK(final String sdkPath) throws BadSDKException, IOException {
  sdk=new File(sdkPath);
  if (!sdk.exists()) {
    throw new BadSDKException(sdk + "String_Node_Str");
  }
  tools=new File(sdk,"String_Node_Str");
  if (!tools.exists()) {
    throw new BadSDKException("String_Node_Str" + sdk);
  }
  androidTool=findAndroidTool(tools);
  final Platform p=Base.getPlatform();
  p.setenv("String_Node_Str",sdk.getCanonicalPath());
  p.setenv("String_Node_Str",tools.getCanonicalPath() + File.pathSeparator + p.getenv("String_Node_Str"));
}

Fixed version (ground truth):
public AndroidSDK(final String sdkPath) throws BadSDKException, IOException {
  sdk=new File(sdkPath);
  if (!sdk.exists()) {
    throw new BadSDKException(sdk + "String_Node_Str");
  }
  tools=new File(sdk,"String_Node_Str");
  if (!tools.exists()) {
    throw new BadSDKException("String_Node_Str" + sdk);
  }
  androidTool=findAndroidTool(tools);
  final Platform p=Base.getPlatform();
  String path=p.getenv("String_Node_Str");
  p.setenv("String_Node_Str",sdk.getCanonicalPath());
  path=tools.getCanonicalPath() + File.pathSeparator + path;
  final String javaHomeProp=System.getProperty("String_Node_Str");
  if (javaHomeProp == null) {
    throw new RuntimeException("String_Node_Str");
  }
  final File javaHome=new File(javaHomeProp).getCanonicalFile();
  p.setenv("String_Node_Str",javaHome.getCanonicalPath());
  path=new File(javaHome,"String_Node_Str").getCanonicalPath() + File.pathSeparator + path;
  p.setenv("String_Node_Str",path);
}
Program: 109320
Project: 109320
Buggy source:
public void set(int x,int y,PImage src){
  if (src.format == ALPHA) {
    throw new RuntimeException("String_Node_Str");
  }
  if (src.bitmap == null) {
    canvas.drawBitmap(src.pixels,0,src.width,x,y,src.width,src.height,false,null);
  }
 else {
    if (src.width != src.bitmap.getWidth() || src.height != src.bitmap.getHeight()) {
      src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
      src.modified=true;
    }
    if (src.modified) {
      if (!src.bitmap.isMutable()) {
        src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
      }
      src.bitmap.setPixels(src.pixels,0,src.width,0,0,src.width,src.height);
      src.modified=false;
    }
  }
  canvas.save(Canvas.MATRIX_SAVE_FLAG);
  canvas.setMatrix(null);
  canvas.drawBitmap(src.bitmap,x,y,null);
  canvas.restore();
}

Fixed version (ground truth):
public void set(int x,int y,PImage src){
  if (src.format == ALPHA) {
    throw new RuntimeException("String_Node_Str");
  }
  if (src.bitmap == null) {
    canvas.drawBitmap(src.pixels,0,src.width,x,y,src.width,src.height,false,null);
  }
 else {
    if (src.width != src.bitmap.getWidth() || src.height != src.bitmap.getHeight()) {
      src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
      src.modified=true;
    }
    if (src.modified) {
      if (!src.bitmap.isMutable()) {
        src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
      }
      src.bitmap.setPixels(src.pixels,0,src.width,0,0,src.width,src.height);
      src.modified=false;
    }
    canvas.save(Canvas.MATRIX_SAVE_FLAG);
    canvas.setMatrix(null);
    canvas.drawBitmap(src.bitmap,x,y,null);
    canvas.restore();
  }
}
Program: 109321
Project: 109321
Buggy source:
/** 
 * Resize this image to a new width and height. Use 0 for wide or high to make that dimension scale proportionally.
 */
public void resize(int wide,int high){
  loadPixels();
  if (wide <= 0 && high <= 0) {
    width=0;
    height=0;
    pixels=new int[0];
  }
 else {
    if (wide == 0) {
      float diff=(float)high / (float)height;
      wide=(int)(width * diff);
    }
 else     if (high == 0) {
      float diff=(float)wide / (float)width;
      high=(int)(height * diff);
    }
    PImage temp=new PImage(wide,high,this.format);
    temp.copy(this,0,0,width,height,0,0,wide,high);
    this.width=wide;
    this.height=high;
    this.pixels=temp.pixels;
    this.bitmap=null;
  }
  updatePixels();
}

Fixed version (ground truth):
/** 
 * Resize this image to a new width and height. Use 0 for wide or high to make that dimension scale proportionally.
 */
public void resize(int wide,int high){
  loadPixels();
  if (wide <= 0 && high <= 0) {
    width=0;
    height=0;
    pixels=new int[0];
    bitmap=null;
  }
 else {
    if (wide == 0) {
      float diff=(float)high / (float)height;
      wide=(int)(width * diff);
    }
 else     if (high == 0) {
      float diff=(float)wide / (float)width;
      high=(int)(height * diff);
    }
    PImage temp=new PImage(wide,high,this.format);
    temp.copy(this,0,0,width,height,0,0,wide,high);
    this.width=wide;
    this.height=high;
    this.pixels=temp.pixels;
    this.bitmap=null;
  }
  updatePixels();
}
Program: 109322
Project: 109322
Buggy source:
/** 
 * Link to an external page without all the muss. <P> When run with an applet, uses the browser to open the url, for applications, attempts to launch a browser with the url. <P> Works on Mac OS X and Windows. For Linux, use: <PRE>open(new String[] { "firefox", url });</PRE> or whatever you want as your browser, since Linux doesn't yet have a standard method for launching URLs.
 */
public void link(String url,String frameTitle){
}

Fixed version (ground truth):
/** 
 * Link to an external page without all the muss. <P> When run with an applet, uses the browser to open the url, for applications, attempts to launch a browser with the url. <P> Works on Mac OS X and Windows. For Linux, use: <PRE>open(new String[] { "firefox", url });</PRE> or whatever you want as your browser, since Linux doesn't yet have a standard method for launching URLs.
 */
public void link(String url,String frameTitle){
  Intent viewIntent=new Intent("String_Node_Str",Uri.parse(url));
  startActivity(viewIntent);
}
Program: 109323
Project: 109323
Buggy source:
/** 
 * Handle renderer-specific image drawing.
 */
protected void imageImpl(PImage src,float x1,float y1,float x2,float y2,int u1,int v1,int u2,int v2){
  if (src.bitmap == null && src.format == ALPHA) {
    src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
    int[] px=new int[src.pixels.length];
    for (int i=0; i < px.length; i++) {
      px[i]=src.pixels[i] << 24 | 0xFFFFFF;
    }
    src.bitmap.setPixels(px,0,src.width,0,0,src.width,src.height);
    src.modified=false;
  }
  if (src.bitmap == null) {
    int offset=v1 * src.width + u1;
    canvas.drawBitmap(src.pixels,offset,src.width,x1,y1,u2 - u1,v2 - v1,src.format == ARGB,tint ? tintPaint : null);
  }
 else {
    if (src.width != src.bitmap.getWidth() || src.height != src.bitmap.getHeight()) {
      src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
      src.modified=true;
    }
    if (src.modified) {
      if (!src.bitmap.isMutable()) {
        src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
      }
      src.bitmap.setPixels(src.pixels,0,src.width,0,0,src.width,src.height);
      src.modified=false;
    }
    if (imageImplSrcRect == null) {
      imageImplSrcRect=new Rect(u1,v1,u2,v2);
      imageImplDstRect=new RectF(x1,y1,x2,y2);
    }
 else {
      imageImplSrcRect.set(u1,v1,u2,v2);
      imageImplDstRect.set(x1,y1,x2,y2);
    }
    canvas.drawBitmap(src.bitmap,imageImplSrcRect,imageImplDstRect,tint ? tintPaint : null);
  }
}

Fixed version (ground truth):
/** 
 * Handle renderer-specific image drawing.
 */
protected void imageImpl(PImage src,float x1,float y1,float x2,float y2,int u1,int v1,int u2,int v2){
  if (src.bitmap == null && src.format == ALPHA) {
    src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
    int[] px=new int[src.pixels.length];
    for (int i=0; i < px.length; i++) {
      px[i]=src.pixels[i] << 24 | 0xFFFFFF;
    }
    src.bitmap.setPixels(px,0,src.width,0,0,src.width,src.height);
    src.modified=false;
  }
  if (src.bitmap == null || src.width != src.bitmap.getWidth() || src.height != src.bitmap.getHeight()) {
    src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
    src.modified=true;
  }
  if (src.modified) {
    if (!src.bitmap.isMutable()) {
      src.bitmap=Bitmap.createBitmap(src.width,src.height,Config.ARGB_8888);
    }
    src.bitmap.setPixels(src.pixels,0,src.width,0,0,src.width,src.height);
    src.modified=false;
  }
  if (imageImplSrcRect == null) {
    imageImplSrcRect=new Rect(u1,v1,u2,v2);
    imageImplDstRect=new RectF(x1,y1,x2,y2);
  }
 else {
    imageImplSrcRect.set(u1,v1,u2,v2);
    imageImplDstRect.set(x1,y1,x2,y2);
  }
  canvas.drawBitmap(src.bitmap,imageImplSrcRect,imageImplDstRect,tint ? tintPaint : null);
}
Program: 109324
Project: 109324
Buggy source:
public void pointLight(float r,float g,float b,float x,float y,float z){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=POINT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=0.0f;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightPosition(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  lightCount++;
}

Fixed version (ground truth):
public void pointLight(float r,float g,float b,float x,float y,float z){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=POINT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightPosition(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}
Program: 109326
Project: 109326
Buggy source:
public void directionalLight(float r,float g,float b,float nx,float ny,float nz){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=DIRECTIONAL;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightSpecular[lightCount][2]=currentLightSpecular[3];
  float invn=1.0f / PApplet.dist(0,0,0,nx,ny,nz);
  lightNormal[lightCount][0]=invn * nx;
  lightNormal[lightCount][1]=invn * ny;
  lightNormal[lightCount][2]=invn * nz;
  lightNormal[lightCount][3]=0.0f;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightDirection(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  lightCount++;
}

Fixed version (ground truth):
public void directionalLight(float r,float g,float b,float nx,float ny,float nz){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=DIRECTIONAL;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightSpecular[lightCount][0]=currentLightSpecular[0];
  lightSpecular[lightCount][1]=currentLightSpecular[1];
  lightSpecular[lightCount][2]=currentLightSpecular[2];
  lightSpecular[lightCount][2]=currentLightSpecular[3];
  float invn=1.0f / PApplet.dist(0,0,0,nx,ny,nz);
  lightNormal[lightCount][0]=invn * nx;
  lightNormal[lightCount][1]=invn * ny;
  lightNormal[lightCount][2]=invn * nz;
  lightNormal[lightCount][3]=0.0f;
  glLightEnable(lightCount);
  glLightNoAmbient(lightCount);
  glLightDirection(lightCount);
  glLightDiffuse(lightCount);
  glLightSpecular(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}
Program: 109327
Project: 109327
Buggy source:
/** 
 * Add an ambient light based on the current color mode. This version includes an (x, y, z) position for situations where the falloff distance is used.
 */
public void ambientLight(float r,float g,float b,float x,float y,float z){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=AMBIENT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=0.0f;
  glLightEnable(lightCount);
  glLightAmbient(lightCount);
  glLightPosition(lightCount);
  glLightFalloff(lightCount);
  lightCount++;
}

Fixed version (ground truth):
/** 
 * Add an ambient light based on the current color mode. This version includes an (x, y, z) position for situations where the falloff distance is used.
 */
public void ambientLight(float r,float g,float b,float x,float y,float z){
  if (lightCount == MAX_LIGHTS) {
    throw new RuntimeException("String_Node_Str" + MAX_LIGHTS + "String_Node_Str");
  }
  colorCalc(r,g,b);
  lightDiffuse[lightCount][0]=calcR;
  lightDiffuse[lightCount][1]=calcG;
  lightDiffuse[lightCount][2]=calcB;
  lightDiffuse[lightCount][3]=1.0f;
  lightType[lightCount]=AMBIENT;
  lightFalloffConstant[lightCount]=currentLightFalloffConstant;
  lightFalloffLinear[lightCount]=currentLightFalloffLinear;
  lightFalloffQuadratic[lightCount]=currentLightFalloffQuadratic;
  lightPosition[lightCount][0]=x;
  lightPosition[lightCount][1]=y;
  lightPosition[lightCount][2]=z;
  lightPosition[lightCount][3]=1.0f;
  glLightEnable(lightCount);
  glLightAmbient(lightCount);
  glLightPosition(lightCount);
  glLightFalloff(lightCount);
  glLightNoSpot(lightCount);
  lightCount++;
}
Program: 109328
Project: 109328
Buggy source:
public PImage loadImage(String filename){
  InputStream stream=createInput(filename);
  if (stream == null) {
    System.err.println("String_Node_Str" + filename + "String_Node_Str");
    return null;
  }
  long t=System.currentTimeMillis();
  Bitmap bitmap=null;
  try {
    bitmap=BitmapFactory.decodeStream(stream);
  }
  finally {
    try {
      stream.close();
      stream=null;
    }
 catch (    IOException e) {
    }
  }
  int much=(int)(System.currentTimeMillis() - t);
  println("String_Node_Str" + filename + "String_Node_Str"+ nfc(much));
  PImage image=new PImage(bitmap);
  image.parent=this;
  return image;
}

Fixed version (ground truth):
public PImage loadImage(String filename){
  InputStream stream=createInput(filename);
  if (stream == null) {
    System.err.println("String_Node_Str" + filename + "String_Node_Str");
    return null;
  }
  Bitmap bitmap=null;
  try {
    bitmap=BitmapFactory.decodeStream(stream);
  }
  finally {
    try {
      stream.close();
      stream=null;
    }
 catch (    IOException e) {
    }
  }
  PImage image=new PImage(bitmap);
  image.parent=this;
  return image;
}
Program: 109329
Project: 109329
Buggy source:
protected void textCharModelImpl(PImage glyph,float x1,float y1,float x2,float y2,int u2,int v2){
  boolean savedTint=tint;
  int savedTintColor=tintColor;
  float savedTintR=tintR;
  float savedTintG=tintG;
  float savedTintB=tintB;
  float savedTintA=tintA;
  boolean savedTintAlpha=tintAlpha;
  tint(fillColor);
  imageImpl(glyph,x1,y1,x2,y2,0,0,u2,v2);
  if (savedTint) {
    tint(tintColor);
  }
 else {
    noTint();
  }
}

Fixed version (ground truth):
protected void textCharModelImpl(PImage glyph,float x1,float y1,float x2,float y2,int u2,int v2){
  boolean savedTint=tint;
  int savedTintColor=tintColor;
  tint(fillColor);
  imageImpl(glyph,x1,y1,x2,y2,0,0,u2,v2);
  if (savedTint) {
    tint(savedTintColor);
  }
 else {
    noTint();
  }
}
Program: 109330
Project: 109330
Buggy source:
public void setTexCoord(ArrayList<PVector> data){
  if (updateElement != TEXTURES) {
    throw new RuntimeException("String_Node_Str");
  }
  firstUpdateIdx=0;
  lastUpdateIdx=numVertices - 1;
  PVector vec;
  for (int i=0; i < numVertices; i++) {
    vec=(PVector)data.get(i);
    if (a3d.imageMode == IMAGE) {
      if (vertGroup[i] != null && vertGroup[i].texture == null) {
        throw new RuntimeException("String_Node_Str");
      }
      updateTexCoordArray[2 * i + 0]=vec.x / vertGroup[i].texture.width;
      updateTexCoordArray[2 * i + 1]=vec.y / vertGroup[i].texture.height;
    }
 else {
      updateTexCoordArray[2 * i + 0]=vec.x;
      updateTexCoordArray[2 * i + 1]=vec.y;
    }
  }
}

Fixed version (ground truth):
public void setTexCoord(ArrayList<PVector> data){
  if (updateElement != TEXTURES) {
    throw new RuntimeException("String_Node_Str");
  }
  firstUpdateIdx=0;
  lastUpdateIdx=numVertices - 1;
  if (updateTexture != null) {
    for (int i=0; i < numVertices; i++)     if (vertGroup[i] != null) {
      vertGroup[i].texture=updateTexture;
    }
  }
  PVector vec;
  for (int i=0; i < numVertices; i++) {
    vec=(PVector)data.get(i);
    if (a3d.imageMode == IMAGE) {
      if (vertGroup[i] != null && vertGroup[i].texture == null) {
        throw new RuntimeException("String_Node_Str");
      }
      updateTexCoordArray[2 * i + 0]=vec.x / vertGroup[i].texture.width;
      updateTexCoordArray[2 * i + 1]=vec.y / vertGroup[i].texture.height;
    }
 else {
      updateTexCoordArray[2 * i + 0]=vec.x;
      updateTexCoordArray[2 * i + 1]=vec.y;
    }
  }
}
Program: 109331
Project: 109331
Buggy source:
public void setVertex(ArrayList<PVector> data){
  if (updateElement != VERTICES) {
    throw new RuntimeException("String_Node_Str");
  }
  firstUpdateIdx=0;
  lastUpdateIdx=numVertices - 1;
  PVector vec;
  for (int i=0; i < numVertices; i++) {
    vec=(PVector)data.get(i);
    updateVertexArray[3 * i + 0]=vec.x;
    updateVertexArray[3 * i + 1]=vec.y;
    updateVertexArray[3 * i + 2]=vec.z;
  }
}

Fixed version (ground truth):
public void setVertex(ArrayList<PVector> data){
  if (updateElement != VERTICES) {
    throw new RuntimeException("String_Node_Str");
  }
  firstUpdateIdx=0;
  lastUpdateIdx=numVertices - 1;
  if (creatingGroup) {
    grIdx0=0;
    grIdx1=numVertices - 1;
  }
  PVector vec;
  for (int i=0; i < numVertices; i++) {
    vec=(PVector)data.get(i);
    updateVertexArray[3 * i + 0]=vec.x;
    updateVertexArray[3 * i + 1]=vec.y;
    updateVertexArray[3 * i + 2]=vec.z;
  }
}
Program: 109332
Project: 109332
Buggy source:
protected void addNewFace(){
  if (faceCount == faceOffset.length) {
    faceOffset=PApplet.expand(faceOffset);
    faceLength=PApplet.expand(faceLength);
    faceTexture=PApplet.expand(faceTexture);
  }
  faceOffset[faceCount]=triangleCount;
  faceLength[faceCount]=1;
  faceTexture[faceCount]=textureImage;
  faceCount++;
}

Fixed version (ground truth):
protected void addNewFace(boolean firstFace){
  if (faceCount == faceOffset.length) {
    faceOffset=PApplet.expand(faceOffset);
    faceLength=PApplet.expand(faceLength);
    faceTexture=PApplet.expand(faceTexture);
  }
  faceOffset[faceCount]=firstFace ? 0 : triangleCount;
  faceLength[faceCount]=1;
  faceTexture[faceCount]=textureImage;
  faceCount++;
}
Program: 109334
Project: 109334
Buggy source:
/** 
 * Add the triangle.
 */
protected void addTriangle(int a,int b,int c){
  if (triangleCount == triangles.length) {
    int temp[][]=new int[triangleCount << 1][TRIANGLE_FIELD_COUNT];
    System.arraycopy(triangles,0,temp,0,triangleCount);
    triangles=temp;
  }
  triangles[triangleCount][VERTEX1]=a;
  triangles[triangleCount][VERTEX2]=b;
  triangles[triangleCount][VERTEX3]=c;
  triangleCount++;
  if (textureImage != textureImagePrev || triangleCount == 1) {
    addNewFace();
  }
 else {
    faceLength[faceCount - 1]++;
  }
  textureImagePrev=textureImage;
}

Fixed version (ground truth):
/** 
 * Add the triangle.
 */
protected void addTriangle(int a,int b,int c){
  if (triangleCount == triangles.length) {
    int temp[][]=new int[triangleCount << 1][TRIANGLE_FIELD_COUNT];
    System.arraycopy(triangles,0,temp,0,triangleCount);
    triangles=temp;
  }
  triangles[triangleCount][VERTEX1]=a;
  triangles[triangleCount][VERTEX2]=b;
  triangles[triangleCount][VERTEX3]=c;
  triangleCount++;
  boolean firstFace=triangleCount == 1;
  if (textureImage != textureImagePrev || firstFace) {
    addNewFace(firstFace);
  }
 else {
    faceLength[faceCount - 1]++;
  }
  textureImagePrev=textureImage;
}
Program: 109335
Project: 109335
Buggy source:
/** 
 * Copy pixels to texture. Involves main memory to video memory transfer (slow).
 */
void update(){
  set(this.pixels);
}

Fixed version (ground truth):
/** 
 * Copy pixels to texture. Involves main memory to video memory transfer (slow).
 */
void update(){
  set(this.pixels,this.format);
}
Program: 109336
Project: 109336
Buggy source:
public void set(int[] pixels,int format){
  if (pixels.length != width * height) {
    throw new RuntimeException("String_Node_Str");
  }
  if (glTextureID[0] == 0) {
    createTexture(width,height);
  }
  int[] convArray=pixels;
  int glFormat;
  if (format == ALPHA) {
    glFormat=GL10.GL_ALPHA;
  }
 else   if (format == RGB) {
    glFormat=GL10.GL_RGB;
  }
 else {
    glFormat=GL10.GL_RGBA;
  }
  convArray=convertToRGBA(pixels,format);
  gl.glBindTexture(glTarget,glTextureID[0]);
  if (usingMipmaps) {
    if (a3d.gl11 != null && a3d.mipmapSupported) {
      gl.glTexParameterf(GL11.GL_TEXTURE_2D,GL11.GL_GENERATE_MIPMAP,GL11.GL_TRUE);
    }
 else {
    }
  }
  gl.glTexSubImage2D(glTarget,0,0,0,glWidth,glHeight,glFormat,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(convArray));
  gl.glBindTexture(glTarget,0);
}

Fixed version (ground truth):
public void set(int[] intArray,int arrayFormat){
  if (intArray.length != width * height) {
    throw new RuntimeException("String_Node_Str");
  }
  if (glTextureID[0] == 0) {
    createTexture(width,height);
  }
  int[] convArray=convertToRGBA(intArray,arrayFormat);
  gl.glBindTexture(glTarget,glTextureID[0]);
  if (usingMipmaps) {
    if (a3d.gl11 != null && a3d.mipmapSupported) {
      gl.glTexParameterf(GL11.GL_TEXTURE_2D,GL11.GL_GENERATE_MIPMAP,GL11.GL_TRUE);
    }
 else {
    }
  }
  gl.glTexSubImage2D(glTarget,0,0,0,glWidth,glHeight,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,IntBuffer.wrap(convArray));
  gl.glBindTexture(glTarget,0);
}
Program: 109337
Project: 109337
Buggy source:
/** 
 * Creates an instance of GLTexture using image file filename as source and the specified texture parameters.
 * @param parent PApplet
 * @param filename String
 * @param params Parameters
 */
public GLTexture(PApplet parent,String filename,Parameters params){
  super(1,1,params.format);
  this.parent=parent;
  a3d=(PGraphicsAndroid3D)parent.g;
  gl=a3d.gl;
  PImage img=parent.loadImage(filename);
  set(img);
}

Fixed version (ground truth):
/** 
 * Creates an instance of GLTexture using image file filename as source and the specified texture parameters.
 * @param parent PApplet
 * @param filename String
 * @param params Parameters
 */
public GLTexture(PApplet parent,String filename,Parameters params){
  super(1,1,params.format);
  this.parent=parent;
  a3d=(PGraphicsAndroid3D)parent.g;
  gl=a3d.gl;
  PImage img=parent.loadImage(filename);
  setParameters(params);
  set(img);
}
Program: 109338
Project: 109338
Buggy source:
/** 
 * Handle renderer-specific image drawing.
 */
protected void imageImpl(PImage who,float x1,float y1,float x2,float y2,int u1,int v1,int u2,int v2){
  rect.set(x1,y1,x2,y2);
  if (who.bitmap == null || who.width != who.bitmap.getWidth() || who.height != who.bitmap.getHeight()) {
    who.bitmap=Bitmap.createBitmap(width,height,Config.ARGB_8888);
    who.modified=true;
  }
  if (who.modified) {
    who.bitmap.setPixels(who.pixels,0,who.width,0,0,who.width,who.height);
  }
  if (imageImplSrcRect == null) {
    imageImplSrcRect=new Rect(u1,v1,u2 - u1,v2 - v1);
    imageImplDstRect=new Rect((int)x1,(int)y1,(int)(x2 - x1),(int)(y2 - y1));
  }
 else {
    imageImplSrcRect.set(u1,v1,u2 - u1,v2 - v1);
    imageImplDstRect.set((int)x1,(int)y1,(int)(x2 - x1),(int)(y2 - y1));
  }
  canvas.drawBitmap(who.bitmap,imageImplSrcRect,imageImplDstRect,tint ? tintPaint : null);
}

Fixed version (ground truth):
/** 
 * Handle renderer-specific image drawing.
 */
protected void imageImpl(PImage who,float x1,float y1,float x2,float y2,int u1,int v1,int u2,int v2){
  rect.set(x1,y1,x2,y2);
  if (who.bitmap == null || who.width != who.bitmap.getWidth() || who.height != who.bitmap.getHeight()) {
    who.bitmap=Bitmap.createBitmap(who.width,who.height,Config.ARGB_8888);
    who.modified=true;
  }
  if (who.modified) {
    who.bitmap.setPixels(who.pixels,0,who.width,0,0,who.width,who.height);
  }
  if (imageImplSrcRect == null) {
    imageImplSrcRect=new Rect(u1,v1,u2 - u1,v2 - v1);
    imageImplDstRect=new Rect((int)x1,(int)y1,(int)(x2 - x1),(int)(y2 - y1));
  }
 else {
    imageImplSrcRect.set(u1,v1,u2 - u1,v2 - v1);
    imageImplDstRect.set((int)x1,(int)y1,(int)(x2 - x1),(int)(y2 - y1));
  }
  canvas.drawBitmap(who.bitmap,imageImplSrcRect,imageImplDstRect,tint ? tintPaint : null);
}
Program: 109341
Project: 109341
Buggy source:
private static void sortMembers(Node[][] map){
  for (  Node[] mapRow : map) {
    for (    Node node : mapRow) {
      Collections.sort(node.getAssignedIDs(),Collections.reverseOrder());
    }
  }
}

Fixed version (ground truth):
private static void sortMembers(Node[][] map){
  for (  Node[] mapRow : map) {
    for (    Node node : mapRow) {
      Collections.sort(node.getAssignedIDs(),new Comparator<Pair<Double,Long>>(){
        @Override public int compare(        Pair<Double,Long> a,        Pair<Double,Long> b){
          if (a.getFirst() > b.getFirst()) {
            return -1;
          }
          if (a.getFirst() < b.getFirst()) {
            return 1;
          }
          return 0;
        }
      }
);
    }
  }
}
Program: 109342
Project: 109342
Buggy source:
public static void main(String[] args) throws Exception {
  AUCEvaluator eval=new AUCEvaluator();
  EvaluationResult result=eval.evaluate(new File(args[0]));
  log.info(result.toString());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  EvaluationResult result=new AUCEvaluator().evaluate(new File(args[0]));
  log.info(String.valueOf(result));
}
Program: 109343
Project: 109343
Buggy source:
@Override public final EvaluationResult evaluate(File originalDataDir,double trainingPercentage,double evaluationPercentage,RescorerProvider provider) throws TasteException, IOException, InterruptedException {
  Preconditions.checkArgument(trainingPercentage > 0.0 && trainingPercentage < 1.0,"String_Node_Str",trainingPercentage);
  Preconditions.checkArgument(evaluationPercentage > 0.0 && evaluationPercentage <= 1.0,"String_Node_Str",evaluationPercentage);
  Preconditions.checkArgument(originalDataDir.exists() && originalDataDir.isDirectory(),"String_Node_Str",originalDataDir);
  File trainingDataDir=Files.createTempDir();
  trainingDataDir.deleteOnExit();
  File trainingFile=new File(trainingDataDir,"String_Node_Str");
  trainingFile.deleteOnExit();
  File trainingModelFile=new File(originalDataDir,"String_Node_Str");
  if (trainingModelFile.exists() && trainingModelFile.isFile()) {
    Files.copy(trainingModelFile,new File(trainingDataDir,trainingModelFile.getName()));
  }
  ServerRecommender recommender=null;
  try {
    Multimap<Long,RecommendedItem> testData=split(originalDataDir,trainingFile,trainingPercentage,evaluationPercentage,provider);
    recommender=new ServerRecommender(trainingDataDir);
    recommender.await();
    return evaluate(recommender,testData);
  }
  finally {
    recommender.close();
    IOUtils.deleteRecursively(trainingDataDir);
  }
}

Fixed version (ground truth):
@Override public final EvaluationResult evaluate(File originalDataDir,double trainingPercentage,double evaluationPercentage,RescorerProvider provider) throws TasteException, IOException, InterruptedException {
  Preconditions.checkArgument(trainingPercentage > 0.0 && trainingPercentage < 1.0,"String_Node_Str",trainingPercentage);
  Preconditions.checkArgument(evaluationPercentage > 0.0 && evaluationPercentage <= 1.0,"String_Node_Str",evaluationPercentage);
  Preconditions.checkArgument(originalDataDir.exists() && originalDataDir.isDirectory(),"String_Node_Str",originalDataDir);
  File trainingDataDir=Files.createTempDir();
  trainingDataDir.deleteOnExit();
  File trainingFile=new File(trainingDataDir,"String_Node_Str");
  trainingFile.deleteOnExit();
  File trainingModelFile=new File(originalDataDir,"String_Node_Str");
  if (trainingModelFile.exists() && trainingModelFile.isFile()) {
    Files.copy(trainingModelFile,new File(trainingDataDir,trainingModelFile.getName()));
  }
  ServerRecommender recommender=null;
  try {
    Multimap<Long,RecommendedItem> testData=split(originalDataDir,trainingFile,trainingPercentage,evaluationPercentage,provider);
    recommender=new ServerRecommender(trainingDataDir);
    recommender.await();
    return evaluate(recommender,testData);
  }
  finally {
    if (recommender != null) {
      recommender.close();
    }
    IOUtils.deleteRecursively(trainingDataDir);
  }
}
Program: 109344
Project: 109344
Buggy source:
public static void main(String[] args) throws Exception {
  EstimatedStrengthEvaluator eval=new EstimatedStrengthEvaluator();
  EvaluationResult result=eval.evaluate(new File(args[0]));
  log.info(result.toString());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  EvaluationResult result=new EstimatedStrengthEvaluator().evaluate(new File(args[0]));
  log.info(String.valueOf(result));
}
Program: 109345
Project: 109345
Buggy source:
@Override public Number call() throws IOException, TasteException, InterruptedException {
  PrecisionRecallEvaluator prEvaluator=new PrecisionRecallEvaluator();
  MyrrixIRStatistics stats=(MyrrixIRStatistics)prEvaluator.evaluate(dataDir,0.9,evaluationPercentage,null);
  return stats.getMeanAveragePrecision();
}

Fixed version (ground truth):
@Override public Number call() throws IOException, TasteException, InterruptedException {
  MyrrixIRStatistics stats=(MyrrixIRStatistics)new PrecisionRecallEvaluator().evaluate(dataDir,0.9,evaluationPercentage,null);
  return stats == null ? null : stats.getMeanAveragePrecision();
}
Program: 109348
Project: 109348
Buggy source:
public static void main(String[] args) throws Exception {
  PrecisionRecallEvaluator eval=new PrecisionRecallEvaluator();
  EvaluationResult result=eval.evaluate(new File(args[0]));
  log.info(result.toString());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  EvaluationResult result=new PrecisionRecallEvaluator().evaluate(new File(args[0]));
  log.info(String.valueOf(result));
}
Program: 109350
Project: 109350
Buggy source:
public static void main(String[] args) throws Exception {
  ReconstructionEvaluator eval=new ReconstructionEvaluator();
  EvaluationResult result=eval.evaluate(new File(args[0]));
  log.info(result.toString());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  EvaluationResult result=new ReconstructionEvaluator().evaluate(new File(args[0]));
  log.info(String.valueOf(result));
}
Program: 109351
Project: 109351
Buggy source:
@Test public void testEval() throws Exception {
  AUCEvaluator evaluator=new AUCEvaluator();
  EvaluationResult stats=evaluator.evaluate(new File("String_Node_Str"));
  log.info(stats.toString());
  assertTrue(stats.getScore() > 0.955);
}

Fixed version (ground truth):
@Test public void testEval() throws Exception {
  EvaluationResult stats=new AUCEvaluator().evaluate(new File("String_Node_Str"));
  log.info(String.valueOf(stats));
  assertTrue(stats.getScore() > 0.955);
}
Program: 109352
Project: 109352
Buggy source:
@Test public void testEval() throws Exception {
  EstimatedStrengthEvaluator evaluator=new EstimatedStrengthEvaluator();
  EvaluationResult stats=evaluator.evaluate(new File("String_Node_Str"));
  log.info(stats.toString());
  assertTrue(stats.getScore() < 0.77);
}

Fixed version (ground truth):
@Test public void testEval() throws Exception {
  EvaluationResult stats=new EstimatedStrengthEvaluator().evaluate(new File("String_Node_Str"));
  log.info(String.valueOf(stats));
  assertTrue(stats.getScore() < 0.77);
}
Program: 109353
Project: 109353
Buggy source:
@Override public Number call() throws IOException, TasteException, InterruptedException {
  PrecisionRecallEvaluator prEvaluator=new PrecisionRecallEvaluator();
  MyrrixIRStatistics stats=(MyrrixIRStatistics)prEvaluator.evaluate(new File("String_Node_Str"),0.9,0.5,null);
  return stats.getMeanAveragePrecision();
}

Fixed version (ground truth):
@Override public Number call() throws IOException, TasteException, InterruptedException {
  MyrrixIRStatistics stats=(MyrrixIRStatistics)new PrecisionRecallEvaluator().evaluate(new File("String_Node_Str"),0.9,0.5,null);
  return stats == null ? null : stats.getMeanAveragePrecision();
}