nus-yam/ex-repair huggingface dataset:
Program: 163806
Project: 163806
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: 163808
Project: 163808
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: 163809
Project: 163809
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: 163810
Project: 163810
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: 163811
Project: 163811
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: 163812
Project: 163812
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: 163813
Project: 163813
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: 163814
Project: 163814
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: 163815
Project: 163815
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: 163816
Project: 163816
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: 163817
Project: 163817
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: 163818
Project: 163818
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: 163820
Project: 163820
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: 163821
Project: 163821
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: 163822
Project: 163822
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: 163823
Project: 163823
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: 163825
Project: 163825
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: 163827
Project: 163827
Buggy source:
public Optional<String> getCurrentUserPrincipal() throws DavException, IOException {
  if (currentUserPrincipal.isPresent())   return currentUserPrincipal;
  DavPropertyNameSet props=new DavPropertyNameSet();
  props.add(WebDavConstants.PROPERTY_NAME_CURRENT_USER_PRINCIPAL);
  String propFindUri=getHostHREF().concat(getWellKnownUri());
  PropFindMethod propFindMethod=new PropFindMethod(propFindUri,props,PropFindMethod.DEPTH_0);
  try {
    getClient().execute(propFindMethod);
    return getCurrentUserPrincipalFromMultiStatus(propFindMethod.getResponseBodyAsMultiStatus());
  }
 catch (  DavException e) {
    if (e.getErrorCode() == DavServletResponse.SC_MOVED_PERMANENTLY) {
      Header locationHeader=propFindMethod.getResponseHeader("String_Node_Str");
      if (locationHeader.getValue() != null) {
        currentUserPrincipal=getCurrentUserPrincipal(locationHeader.getValue());
        return currentUserPrincipal;
      }
    }
 else     throw e;
  }
 finally {
    propFindMethod.releaseConnection();
  }
  return Optional.absent();
}

Fixed version (ground truth):
public Optional<String> getCurrentUserPrincipal() throws DavException, IOException {
  if (currentUserPrincipal.isPresent())   return currentUserPrincipal;
  DavPropertyNameSet props=new DavPropertyNameSet();
  props.add(WebDavConstants.PROPERTY_NAME_CURRENT_USER_PRINCIPAL);
  String propFindUri=getHostHREF().concat(getWellKnownUri());
  PropFindMethod propFindMethod=new PropFindMethod(propFindUri,props,PropFindMethod.DEPTH_0);
  try {
    getClient().execute(propFindMethod);
    return getCurrentUserPrincipalFromMultiStatus(propFindMethod.getResponseBodyAsMultiStatus());
  }
 catch (  DavException e) {
    if (e.getErrorCode() == DavServletResponse.SC_MOVED_PERMANENTLY || e.getErrorCode() == DavServletResponse.SC_MOVED_TEMPORARILY || e.getErrorCode() == DavServletResponse.SC_SEE_OTHER || e.getErrorCode() == DavServletResponse.SC_USE_PROXY || e.getErrorCode() == DavServletResponse.SC_TEMPORARY_REDIRECT) {
      Header locationHeader=propFindMethod.getResponseHeader("String_Node_Str");
      if (locationHeader.getValue() != null) {
        currentUserPrincipal=getCurrentUserPrincipal(locationHeader.getValue());
        return currentUserPrincipal;
      }
    }
 else     throw e;
  }
 finally {
    propFindMethod.releaseConnection();
  }
  return Optional.absent();
}
Program: 163828
Project: 163828
Buggy source:
public MockMasterCipher(){
  super(null,null);
}

Fixed version (ground truth):
public MockMasterCipher(){
  super(false,null,null);
}
Program: 163829
Project: 163829
Buggy source:
@Override public Optional<ComponentETagPair<Calendar>> getHiddenComponent(String uid) throws InvalidComponentException, DavException, InvalidMacException, GeneralSecurityException, IOException {
  Optional<ComponentETagPair<Calendar>> originalComponentPair=super.getComponent(uid);
  if (!originalComponentPair.isPresent())   return Optional.absent();
  Calendar exposedComponent=originalComponentPair.get().getComponent();
  XProperty protectedComponent=(XProperty)exposedComponent.getProperty(PROPERTY_NAME_FLOCK_HIDDEN_CALENDAR);
  if (protectedComponent == null)   return originalComponentPair;
  String recoveredComponentText=HidingUtil.decodeAndDecryptIfNecessary(masterCipher,protectedComponent.getValue());
  StringReader stringReader=new StringReader(recoveredComponentText.replace("String_Node_Str","String_Node_Str"));
  CalendarBuilder calendarBuilder=new CalendarBuilder();
  try {
    Calendar recoveredComponent=calendarBuilder.build(stringReader);
    return Optional.of(new ComponentETagPair<Calendar>(recoveredComponent,originalComponentPair.get().getETag()));
  }
 catch (  ParserException e) {
    Log.e(TAG,"String_Node_Str",e);
    throw new InvalidComponentException("String_Node_Str",true,CalDavConstants.CALDAV_NAMESPACE,getPath(),uid,e);
  }
}

Fixed version (ground truth):
@Override public Optional<ComponentETagPair<Calendar>> getHiddenComponent(String uid) throws InvalidComponentException, DavException, InvalidMacException, GeneralSecurityException, IOException {
  Optional<ComponentETagPair<Calendar>> originalComponentPair=super.getComponent(uid);
  if (!originalComponentPair.isPresent())   return Optional.absent();
  Calendar exposedComponent=originalComponentPair.get().getComponent();
  XProperty protectedComponent=(XProperty)exposedComponent.getProperty(PROPERTY_NAME_FLOCK_HIDDEN_CALENDAR);
  if (protectedComponent == null)   return originalComponentPair;
  String recoveredComponentText=HidingUtil.decodeAndDecryptIfNecessary(masterCipher,protectedComponent.getValue());
  StringReader stringReader=new StringReader(recoveredComponentText);
  CalendarBuilder calendarBuilder=new CalendarBuilder();
  try {
    Calendar recoveredComponent=calendarBuilder.build(stringReader);
    return Optional.of(new ComponentETagPair<Calendar>(recoveredComponent,originalComponentPair.get().getETag()));
  }
 catch (  ParserException e) {
    Log.e(TAG,"String_Node_Str",e);
    throw new InvalidComponentException("String_Node_Str",true,CalDavConstants.CALDAV_NAMESPACE,getPath(),uid,e);
  }
}
Program: 163830
Project: 163830
Buggy source:
@Override public List<ComponentETagPair<Calendar>> getHiddenComponents() throws InvalidComponentException, DavException, InvalidMacException, GeneralSecurityException, IOException {
  List<ComponentETagPair<Calendar>> exposedComponentPairs=super.getComponents();
  List<ComponentETagPair<Calendar>> recoveredComponentPairs=new LinkedList<ComponentETagPair<Calendar>>();
  for (  ComponentETagPair<Calendar> exposedComponentPair : exposedComponentPairs) {
    Calendar exposedComponent=exposedComponentPair.getComponent();
    XProperty protectedComponent=(XProperty)exposedComponent.getProperty(PROPERTY_NAME_FLOCK_HIDDEN_CALENDAR);
    if (protectedComponent == null)     recoveredComponentPairs.add(exposedComponentPair);
 else {
      String recoveredComponentText=HidingUtil.decodeAndDecryptIfNecessary(masterCipher,protectedComponent.getValue());
      StringReader stringReader=new StringReader(recoveredComponentText.replace("String_Node_Str","String_Node_Str"));
      CalendarBuilder calendarBuilder=new CalendarBuilder();
      try {
        Calendar recoveredComponent=calendarBuilder.build(stringReader);
        recoveredComponentPairs.add(new ComponentETagPair<Calendar>(recoveredComponent,exposedComponentPair.getETag()));
      }
 catch (      ParserException e) {
        Log.e(TAG,"String_Node_Str",e);
        throw new InvalidComponentException("String_Node_Str",true,CalDavConstants.CALDAV_NAMESPACE,getPath(),e);
      }
    }
  }
  return recoveredComponentPairs;
}

Fixed version (ground truth):
@Override public List<ComponentETagPair<Calendar>> getHiddenComponents() throws InvalidComponentException, DavException, InvalidMacException, GeneralSecurityException, IOException {
  List<ComponentETagPair<Calendar>> exposedComponentPairs=super.getComponents();
  List<ComponentETagPair<Calendar>> recoveredComponentPairs=new LinkedList<ComponentETagPair<Calendar>>();
  for (  ComponentETagPair<Calendar> exposedComponentPair : exposedComponentPairs) {
    Calendar exposedComponent=exposedComponentPair.getComponent();
    XProperty protectedComponent=(XProperty)exposedComponent.getProperty(PROPERTY_NAME_FLOCK_HIDDEN_CALENDAR);
    if (protectedComponent == null)     recoveredComponentPairs.add(exposedComponentPair);
 else {
      String recoveredComponentText=HidingUtil.decodeAndDecryptIfNecessary(masterCipher,protectedComponent.getValue());
      StringReader stringReader=new StringReader(recoveredComponentText);
      CalendarBuilder calendarBuilder=new CalendarBuilder();
      try {
        Calendar recoveredComponent=calendarBuilder.build(stringReader);
        recoveredComponentPairs.add(new ComponentETagPair<Calendar>(recoveredComponent,exposedComponentPair.getETag()));
      }
 catch (      ParserException e) {
        Log.e(TAG,"String_Node_Str",e);
        throw new InvalidComponentException("String_Node_Str",true,CalDavConstants.CALDAV_NAMESPACE,getPath(),e);
      }
    }
  }
  return recoveredComponentPairs;
}
Program: 163838
Project: 163838
Buggy source:
@Override public void onDestroy(){
  Log.d(TAG,"String_Node_Str");
  if (countEventCopiesFailed == 0) {
    notificationBuilder.setProgress(0,0,false).setContentText(getString(R.string.notification_import_complete_copied) + "String_Node_Str" + countEventsCopied+ "String_Node_Str"+ getString(R.string.events)+ getString(R.string.period));
  }
 else {
    notificationBuilder.setProgress(0,0,false).setContentText(getString(R.string.notification_import_complete_copied) + "String_Node_Str" + countEventCopiesFailed+ "String_Node_Str"+ getString(R.string.events)+ "String_Node_Str"+ countEventCopiesFailed+ "String_Node_Str"+ getString(R.string.failed)+ getString(R.string.period));
  }
  notifyManager.notify(ID_CALENDAR_COPY_NOTIFICATION,notificationBuilder.build());
}

Fixed version (ground truth):
@Override public void onDestroy(){
  Log.d(TAG,"String_Node_Str");
  if (countEventCopiesFailed == 0) {
    notificationBuilder.setProgress(0,0,false).setContentText(getString(R.string.notification_import_complete_copied) + "String_Node_Str" + countEventsCopied+ "String_Node_Str"+ getString(R.string.events)+ getString(R.string.period));
  }
 else {
    notificationBuilder.setProgress(0,0,false).setContentText(getString(R.string.notification_import_complete_copied) + "String_Node_Str" + countEventsCopied+ "String_Node_Str"+ getString(R.string.events)+ "String_Node_Str"+ countEventCopiesFailed+ "String_Node_Str"+ getString(R.string.failed)+ getString(R.string.period));
  }
  notifyManager.notify(ID_CALENDAR_COPY_NOTIFICATION,notificationBuilder.build());
}
Program: 163841
Project: 163841
Buggy source:
@SuppressWarnings("String_Node_Str") private byte[] readAll(InputStream in) throws IOException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  byte[] buffer=new byte[4096];
  int length;
  while ((length=in.read(buffer)) > 0) {
    baos.write(buffer,0,length);
  }
  return baos.toByteArray();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private byte[] readAll(InputStream in) throws IOException {
  if (in == null) {
    return new byte[0];
  }
 else {
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    byte[] buffer=new byte[4096];
    int length;
    while ((length=in.read(buffer)) > 0) {
      baos.write(buffer,0,length);
    }
    return baos.toByteArray();
  }
}
Program: 163842
Project: 163842
Buggy source:
private void updateMetrics(String name,GcInfo info){
  final Map<String,MemoryUsage> before=info.getMemoryUsageBeforeGc();
  final Map<String,MemoryUsage> after=info.getMemoryUsageAfterGc();
  if (oldGenPoolName != null) {
    final long oldBefore=before.get(oldGenPoolName).getUsed();
    final long oldAfter=after.get(oldGenPoolName).getUsed();
    final long delta=oldAfter - oldBefore;
    if (delta > 0L) {
      PROMOTION_RATE.increment(delta);
    }
    if (HelperFunctions.getGcType(name) == GcType.OLD) {
      LIVE_DATA_SIZE.set(oldAfter);
      final long oldMaxAfter=after.get(oldGenPoolName).getMax();
      MAX_DATA_SIZE.set(oldMaxAfter);
    }
  }
  if (youngGenPoolName != null) {
    final long youngBefore=before.get(youngGenPoolName).getUsed();
    final long youngAfter=after.get(youngGenPoolName).getUsed();
    final long delta=youngBefore - youngGenSizeAfter;
    youngGenSizeAfter=youngAfter;
    if (delta > 0L) {
      ALLOCATION_RATE.increment(delta);
    }
  }
}

Fixed version (ground truth):
private void updateMetrics(String name,GcInfo info){
  final Map<String,MemoryUsage> before=info.getMemoryUsageBeforeGc();
  final Map<String,MemoryUsage> after=info.getMemoryUsageAfterGc();
  if (oldGenPoolName != null) {
    final long oldBefore=before.get(oldGenPoolName).getUsed();
    final long oldAfter=after.get(oldGenPoolName).getUsed();
    final long delta=oldAfter - oldBefore;
    if (delta > 0L) {
      PROMOTION_RATE.increment(delta);
    }
    if (oldAfter < oldBefore || HelperFunctions.getGcType(name) == GcType.OLD) {
      LIVE_DATA_SIZE.set(oldAfter);
      final long oldMaxAfter=after.get(oldGenPoolName).getMax();
      MAX_DATA_SIZE.set(oldMaxAfter);
    }
  }
  if (youngGenPoolName != null) {
    final long youngBefore=before.get(youngGenPoolName).getUsed();
    final long youngAfter=after.get(youngGenPoolName).getUsed();
    final long delta=youngBefore - youngGenSizeAfter;
    youngGenSizeAfter=youngAfter;
    if (delta > 0L) {
      ALLOCATION_RATE.increment(delta);
    }
  }
}
Program: 163843
Project: 163843
Buggy source:
private static HashSet<Badge> restore(Bundle bundle){
  HashSet<Badge> badges=new HashSet<Badge>();
  if (bundle == null)   return badges;
  String[] names=bundle.getStringArray(BADGES);
  for (int i=0; i < names.length; i++) {
    try {
      if (!removedBadges.contains(names[i])) {
        badges.add(Badge.valueOf(names[i]));
      }
    }
 catch (    Exception e) {
      ShatteredPixelDungeon.reportException(e);
    }
  }
  return badges;
}

Fixed version (ground truth):
private static HashSet<Badge> restore(Bundle bundle){
  HashSet<Badge> badges=new HashSet<Badge>();
  if (bundle == null)   return badges;
  String[] names=bundle.getStringArray(BADGES);
  for (int i=0; i < names.length; i++) {
    try {
      if (renamedBadges.containsKey(names[i])) {
        names[i]=renamedBadges.get(names[i]);
      }
      if (!removedBadges.contains(names[i])) {
        badges.add(Badge.valueOf(names[i]));
      }
    }
 catch (    Exception e) {
      ShatteredPixelDungeon.reportException(e);
    }
  }
  return badges;
}
Program: 163844
Project: 163844
Buggy source:
@SuppressWarnings("String_Node_Str") public static void switchLevel(final Level level,int pos){
  if (pos < 0 || pos >= level.length()) {
    pos=level.exit;
  }
  PathFinder.setMapSize(level.width(),level.height());
  Dungeon.level=level;
  DriedRose.restoreGhostHero(level,pos);
  Actor.init();
  Actor respawner=level.respawner();
  if (respawner != null) {
    Actor.add(level.respawner());
  }
  hero.pos=pos;
  Light light=hero.buff(Light.class);
  hero.viewDistance=light == null ? level.viewDistance : Math.max(Light.DISTANCE,level.viewDistance);
  hero.curAction=hero.lastAction=null;
  observe();
  try {
    saveAll();
  }
 catch (  IOException e) {
    ShatteredPixelDungeon.reportException(e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static void switchLevel(final Level level,int pos){
  if (pos < 0 || pos >= level.length()) {
    pos=level.exit;
  }
  PathFinder.setMapSize(level.width(),level.height());
  Dungeon.level=level;
  DriedRose.restoreGhostHero(level,pos);
  Actor.init();
  Actor respawner=level.respawner();
  if (respawner != null) {
    Actor.addDelayed(respawner,level.respawnTime());
  }
  hero.pos=pos;
  Light light=hero.buff(Light.class);
  hero.viewDistance=light == null ? level.viewDistance : Math.max(Light.DISTANCE,level.viewDistance);
  hero.curAction=hero.lastAction=null;
  observe();
  try {
    saveAll();
  }
 catch (  IOException e) {
    ShatteredPixelDungeon.reportException(e);
  }
}
Program: 163845
Project: 163845
Buggy source:
public static void spawn(CityLevel level){
  if (!spawned && Dungeon.depth > 16 && Random.Int(20 - Dungeon.depth) == 0) {
    Imp npc=new Imp();
    do {
      npc.pos=level.randomRespawnCell();
    }
 while (npc.pos == -1 || level.heaps.get(npc.pos) != null || level.findMob(npc.pos) != null || !(level.passable[npc.pos + PathFinder.CIRCLE4[0]] && level.passable[npc.pos + PathFinder.CIRCLE4[2]]) || !(level.passable[npc.pos + PathFinder.CIRCLE4[1]] && level.passable[npc.pos + PathFinder.CIRCLE4[3]]));
    level.mobs.add(npc);
    spawned=true;
    alternative=Random.Int(2) == 0;
    given=false;
    do {
      reward=(Ring)Generator.random(Generator.Category.RING);
    }
 while (reward.cursed);
    reward.upgrade(2);
    reward.cursed=true;
  }
}

Fixed version (ground truth):
public static void spawn(CityLevel level){
  if (!spawned && Dungeon.depth > 16 && Random.Int(20 - Dungeon.depth) == 0) {
    Imp npc=new Imp();
    do {
      npc.pos=level.randomRespawnCell();
    }
 while (npc.pos == -1 || level.heaps.get(npc.pos) != null || level.traps.get(npc.pos) != null || level.findMob(npc.pos) != null || !(level.passable[npc.pos + PathFinder.CIRCLE4[0]] && level.passable[npc.pos + PathFinder.CIRCLE4[2]]) || !(level.passable[npc.pos + PathFinder.CIRCLE4[1]] && level.passable[npc.pos + PathFinder.CIRCLE4[3]]));
    level.mobs.add(npc);
    spawned=true;
    alternative=Random.Int(2) == 0;
    given=false;
    do {
      reward=(Ring)Generator.random(Generator.Category.RING);
    }
 while (reward.cursed);
    reward.upgrade(2);
    reward.cursed=true;
  }
}
Program: 163846
Project: 163846
Buggy source:
@Override protected void onZap(Ballistica beam){
  Char ch=Actor.findChar(beam.collisionPos);
  if (ch != null) {
    processSoulMark(ch,chargesPerCast());
    affectTarget(ch);
  }
  affectMap(beam);
  if (Dungeon.level.viewDistance < 6) {
    if (Dungeon.isChallenged(Challenges.DARKNESS)) {
      Buff.prolong(curUser,Light.class,2f + level());
    }
 else {
      Buff.prolong(curUser,Light.class,10f + level() * 5);
    }
  }
}

Fixed version (ground truth):
@Override protected void onZap(Ballistica beam){
  affectMap(beam);
  if (Dungeon.level.viewDistance < 6) {
    if (Dungeon.isChallenged(Challenges.DARKNESS)) {
      Buff.prolong(curUser,Light.class,2f + level());
    }
 else {
      Buff.prolong(curUser,Light.class,10f + level() * 5);
    }
  }
  Char ch=Actor.findChar(beam.collisionPos);
  if (ch != null) {
    processSoulMark(ch,chargesPerCast());
    affectTarget(ch);
  }
}
Program: 163847
Project: 163847
Buggy source:
@Override protected boolean act(){
  int count=0;
  for (  Mob mob : mobs.toArray(new Mob[0])) {
    if (mob.alignment == Char.Alignment.ENEMY)     count++;
  }
  if (count < nMobs()) {
    Mob mob=createMob();
    mob.state=mob.WANDERING;
    mob.pos=randomRespawnCell();
    if (Dungeon.hero.isAlive() && mob.pos != -1 && distance(Dungeon.hero.pos,mob.pos) >= 4) {
      GameScene.add(mob);
      if (Statistics.amuletObtained) {
        mob.beckon(Dungeon.hero.pos);
      }
    }
  }
  if (Statistics.amuletObtained) {
    spend(TIME_TO_RESPAWN / 2f);
  }
 else   if (Dungeon.level.feeling == Feeling.DARK) {
    spend(2 * TIME_TO_RESPAWN / 3f);
  }
 else {
    spend(TIME_TO_RESPAWN);
  }
  return true;
}

Fixed version (ground truth):
@Override protected boolean act(){
  int count=0;
  for (  Mob mob : mobs.toArray(new Mob[0])) {
    if (mob.alignment == Char.Alignment.ENEMY)     count++;
  }
  if (count < nMobs()) {
    Mob mob=createMob();
    mob.state=mob.WANDERING;
    mob.pos=randomRespawnCell();
    if (Dungeon.hero.isAlive() && mob.pos != -1 && distance(Dungeon.hero.pos,mob.pos) >= 4) {
      GameScene.add(mob);
      if (Statistics.amuletObtained) {
        mob.beckon(Dungeon.hero.pos);
      }
    }
  }
  spend(respawnTime());
  return true;
}
Program: 163848
Project: 163848
Buggy source:
public Actor respawner(){
  return new Actor(){
{
      actPriority=BUFF_PRIO;
    }
    @Override protected boolean act(){
      int count=0;
      for (      Mob mob : mobs.toArray(new Mob[0])) {
        if (mob.alignment == Char.Alignment.ENEMY)         count++;
      }
      if (count < nMobs()) {
        Mob mob=createMob();
        mob.state=mob.WANDERING;
        mob.pos=randomRespawnCell();
        if (Dungeon.hero.isAlive() && mob.pos != -1 && distance(Dungeon.hero.pos,mob.pos) >= 4) {
          GameScene.add(mob);
          if (Statistics.amuletObtained) {
            mob.beckon(Dungeon.hero.pos);
          }
        }
      }
      if (Statistics.amuletObtained) {
        spend(TIME_TO_RESPAWN / 2f);
      }
 else       if (Dungeon.level.feeling == Feeling.DARK) {
        spend(2 * TIME_TO_RESPAWN / 3f);
      }
 else {
        spend(TIME_TO_RESPAWN);
      }
      return true;
    }
  }
;
}

Fixed version (ground truth):
public Actor respawner(){
  return new Actor(){
{
      actPriority=BUFF_PRIO;
    }
    @Override protected boolean act(){
      int count=0;
      for (      Mob mob : mobs.toArray(new Mob[0])) {
        if (mob.alignment == Char.Alignment.ENEMY)         count++;
      }
      if (count < nMobs()) {
        Mob mob=createMob();
        mob.state=mob.WANDERING;
        mob.pos=randomRespawnCell();
        if (Dungeon.hero.isAlive() && mob.pos != -1 && distance(Dungeon.hero.pos,mob.pos) >= 4) {
          GameScene.add(mob);
          if (Statistics.amuletObtained) {
            mob.beckon(Dungeon.hero.pos);
          }
        }
      }
      spend(respawnTime());
      return true;
    }
  }
;
}
Program: 163849
Project: 163849
Buggy source:
@Override public int drRoll(){
  int dr=0;
  Barkskin bark=buff(Barkskin.class);
  if (belongings.armor != null) {
    dr+=Random.NormalIntRange(belongings.armor.DRMin(),belongings.armor.DRMax());
    if (STR() < belongings.armor.STRReq()) {
      dr-=2 * (belongings.armor.STRReq() - STR());
      dr=Math.max(dr,0);
    }
  }
  if (belongings.weapon != null)   dr+=Random.NormalIntRange(0,belongings.weapon.defenseFactor(this));
  if (bark != null)   dr+=Random.NormalIntRange(0,bark.level());
  return dr;
}

Fixed version (ground truth):
@Override public int drRoll(){
  int dr=0;
  Barkskin bark=buff(Barkskin.class);
  if (belongings.armor != null) {
    int armDr=Random.NormalIntRange(belongings.armor.DRMin(),belongings.armor.DRMax());
    if (STR() < belongings.armor.STRReq()) {
      armDr-=2 * (belongings.armor.STRReq() - STR());
    }
    if (armDr > 0)     dr+=armDr;
  }
  if (belongings.weapon != null) {
    int wepDr=Random.NormalIntRange(0,belongings.weapon.defenseFactor(this));
    if (STR() < ((Weapon)belongings.weapon).STRReq()) {
      wepDr-=2 * (((Weapon)belongings.weapon).STRReq() - STR());
    }
    if (wepDr > 0)     dr+=wepDr;
  }
  if (bark != null)   dr+=Random.NormalIntRange(0,bark.level());
  return dr;
}
Program: 163850
Project: 163850
Buggy source:
@Override public int proc(Armor armor,Char attacker,Char defender,int damage){
  testing=true;
  float evasion=defender.defenseSkill(attacker);
  float accuracy=attacker.attackSkill(defender);
  testing=false;
  float hitChance;
  if (evasion >= accuracy) {
    hitChance=1f - (1f - (accuracy / evasion)) / 2f;
  }
 else {
    hitChance=1f - (evasion / accuracy) / 2f;
  }
  damage=(int)Math.ceil(damage * hitChance);
  return damage;
}

Fixed version (ground truth):
@Override public int proc(Armor armor,Char attacker,Char defender,int damage){
  testing=true;
  float evasion=defender.defenseSkill(attacker);
  float accuracy=attacker.attackSkill(defender);
  testing=false;
  float hitChance;
  if (evasion >= accuracy) {
    hitChance=1f - (1f - (accuracy / evasion)) / 2f;
  }
 else {
    hitChance=1f - (evasion / accuracy) / 2f;
  }
  hitChance=(2f + 3f * hitChance) / 5f;
  damage=(int)Math.ceil(damage * hitChance);
  return damage;
}