nus-yam/ex-repair huggingface dataset:
Program: 184151
Project: 184151
Buggy source:
/** 
 * Skips the input buffer ahead by large ranges.
 */
private void advanceInputFileToFirstLine(){
  int approxCharsPerLine=60;
  int numberOfLines=100000;
  while (true) {
    try {
      mInputFile.mark((approxCharsPerLine + 15) * numberOfLines);
      mInputFile.skip((approxCharsPerLine) * numberOfLines);
      mInputFile.readLine();
      String line=mInputFile.readLine();
      if (line == null)       return;
      long time=Long.parseLong(line.split("String_Node_Str")[0]) * 1000;
      mTempCalendar.setTimeInMillis(time);
      if (passesTimeFilters(time)) {
        mInputFile.reset();
        return;
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
      return;
    }
  }
}

Fixed version (ground truth):
/** 
 * Skips the input buffer ahead by large ranges.
 */
private void advanceInputFileToFirstLine(){
  int approxCharsPerLine=60;
  int numberOfLines=100000;
  while (true) {
    try {
      mInputFile.mark((approxCharsPerLine + 15) * numberOfLines);
      mInputFile.skip((approxCharsPerLine) * numberOfLines);
      mInputFile.readLine();
      String line=mInputFile.readLine();
      if (line == null)       return;
      long time=Long.parseLong(line.split("String_Node_Str")[0]) * 1000;
      mTempCalendar.setTimeInMillis(time);
      if (passesDayMonthYearTimeFilters(time)) {
        mInputFile.reset();
        return;
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
      return;
    }
  }
}
Program: 184152
Project: 184152
Buggy source:
private static void printImage(Environment r,int cycle){
  BufferedImage bi=r.getImage();
  StringBuilder name=new StringBuilder("String_Node_Str");
  if (cycle < 10)   name.append("String_Node_Str").append(cycle).append("String_Node_Str");
 else   if (cycle > 9 && cycle < 100)   name.append("String_Node_Str").append(cycle).append("String_Node_Str");
 else   name.append(cycle).append("String_Node_Str");
  try {
    File f=new File(name.toString());
    ImageIO.write(bi,"String_Node_Str",f);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private static void printImage(Environment r,int cycle){
  BufferedImage bi=r.getKvalueImage(K);
  StringBuilder name=new StringBuilder("String_Node_Str");
  if (cycle < 10)   name.append("String_Node_Str").append(cycle).append("String_Node_Str");
 else   if (cycle > 9 && cycle < 100)   name.append("String_Node_Str").append(cycle).append("String_Node_Str");
 else   name.append(cycle).append("String_Node_Str");
  try {
    File f=new File(name.toString());
    ImageIO.write(bi,"String_Node_Str",f);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 184154
Project: 184154
Buggy source:
private static String getFileName(){
  String filename="String_Node_Str" + K + "String_Node_Str";
  filename+=sliceUsed;
  filename+="String_Node_Str";
  filename+="String_Node_Str" + environXsize + "String_Node_Str"+ environYsize;
  if (dynamicCycleCount != -1)   filename+="String_Node_Str" + dynamicCycleCount + "String_Node_Str";
  filename+="String_Node_Str";
  return filename;
}

Fixed version (ground truth):
private static String getFileName(){
  String filename="String_Node_Str" + K + "String_Node_Str";
  filename+=sliceUsed;
  filename+="String_Node_Str";
  filename+="String_Node_Str" + environXsize + "String_Node_Str"+ environYsize;
  if (minimumCycleCount != -1)   filename+="String_Node_Str" + minimumCycleCount + "String_Node_Str";
  filename+="String_Node_Str";
  return filename;
}
Program: 184156
Project: 184156
Buggy source:
protected RectilinearPixelPoly(Collection<Point> initial,Regions manager){
  log.entering(getClass().getName(),"String_Node_Str");
  if (initial.size() == 0)   throw new IllegalArgumentException();
  mRegionManager=manager;
  mPoints.addAll(initial);
}

Fixed version (ground truth):
protected RectilinearPixelPoly(Collection<Point> initial,Regions manager){
  log.entering(getClass().getName(),"String_Node_Str");
  if (initial.size() == 0)   throw new IllegalArgumentException();
  mRegionManager=manager;
  mPoints.addAll(initial);
  assert(isContigious());
}
Program: 184158
Project: 184158
Buggy source:
/** 
 * Divides this one polygon into two
 * @param amountOfArea The amount of space that should be removed from this polygon and given to the new one
 */
public void split(int amountOfArea){
  log.entering(className,"String_Node_Str",amountOfArea);
  log.finest("String_Node_Str");
  Point edge=null;
  List<Point> innerBorder=getInnerBorder();
  for (  Point p : innerBorder) {
    log.finest("String_Node_Str" + p + "String_Node_Str");
    if (isConsumable(p.x,p.y,null)) {
      edge=p;
      break;
    }
  }
  if (edge == null) {
    log.fine("String_Node_Str");
    for (    Point p : getBorder()) {
      if (innerBorder.contains(p))       continue;
      if (isConsumable(p.x,p.y,null)) {
        edge=p;
        break;
      }
    }
    if (edge == null) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  log.fine("String_Node_Str" + edge);
  Collection<Point> points=consumeArea(amountOfArea,edge);
  if (log.isLoggable(Level.FINEST)) {
    log.finest("String_Node_Str" + points);
  }
  mRegionManager.createRegion(points);
}

Fixed version (ground truth):
/** 
 * Divides this one polygon into two
 * @param amountOfArea The amount of space that should be removed from this polygon and given to the new one
 */
public void split(int amountOfArea){
  log.entering(className,"String_Node_Str",amountOfArea);
  log.finest("String_Node_Str");
  Point edge=null;
  List<Point> innerBorder=getInnerBorder();
  for (  Point p : innerBorder) {
    log.finest("String_Node_Str" + p + "String_Node_Str");
    if (isConsumable(p.x,p.y,null)) {
      edge=p;
      break;
    }
  }
  if (edge == null) {
    log.fine("String_Node_Str");
    for (    Point p : getBorder()) {
      if (innerBorder.contains(p))       continue;
      if (isConsumable(p.x,p.y,null)) {
        edge=p;
        break;
      }
    }
    if (edge == null) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  log.fine("String_Node_Str" + edge);
  Collection<Point> points=consumeArea(amountOfArea,edge);
  if (log.isLoggable(Level.FINEST)) {
    log.finest("String_Node_Str" + points);
  }
  assert(isContigious());
  mRegionManager.createRegion(points);
}
Program: 184160
Project: 184160
Buggy source:
public void merge(Collection<Point> consumablePoints){
  mPoints.addAll(consumablePoints);
}

Fixed version (ground truth):
public void merge(Collection<Point> consumablePoints){
  mPoints.addAll(consumablePoints);
  assert(isContigious());
}
Program: 184161
Project: 184161
Buggy source:
public String readLine() throws IOException {
  if (isASCII && txt != null) {
    return txt.readLine();
  }
  if (!isASCII && bgzf != null) {
    String ans="String_Node_Str";
    char c;
    while ((c=(char)bgzf.read()) >= 0) {
      if (c != '\n')       ans+=c;
 else       return ans;
    }
  }
  return null;
}

Fixed version (ground truth):
public String readLine() throws IOException {
  if (isASCII && txt != null) {
    return txt.readLine();
  }
  if (!isASCII && bgzf != null) {
    String ans="String_Node_Str";
    char c;
    while ((c=(char)bgzf.read()) < 255) {
      if (c != '\n')       ans+=c;
 else       return ans;
    }
  }
  return null;
}
Program: 184162
Project: 184162
Buggy source:
public void renderType(RenderType $type){
  _renderType=$type;
  _renderTypeInt=renderTypeToInt(_renderType);
}

Fixed version (ground truth):
public void renderType(RenderType $type){
  _renderType=$type;
}
Program: 184165
Project: 184165
Buggy source:
public Light(){
  super(null);
  ambient=new Color4Managed(128,128,128,255,this);
  diffuse=new Color4Managed(255,255,255,255,this);
  specular=new Color4Managed(0,0,0,255,this);
  emissive=new Color4Managed(0,0,0,255,this);
  position=new Number3dManaged(0f,0f,5f,this);
  direction=new Number3dManaged(0,0,-1,this);
  _attenuation=new Number3dManaged(1f,0f,0f,this);
  _isVisible=new BooleanManaged(true,this);
  type(LightType.DIRECTIONAL);
  _positionAndTypeFloatBuffer=Utils.makeFloatBuffer4(0,0,0,0);
  setDirtyFlag();
}

Fixed version (ground truth):
public Light(){
  super(null);
  ambient=new Color4Managed(128,128,128,255,this);
  diffuse=new Color4Managed(255,255,255,255,this);
  specular=new Color4Managed(0,0,0,255,this);
  emissive=new Color4Managed(0,0,0,255,this);
  position=new Number3dManaged(0f,0f,5f,this);
  direction=new Number3dManaged(0f,0f,-1f,this);
  _attenuation=new Number3dManaged(1f,0f,0f,this);
  _isVisible=new BooleanManaged(true,this);
  type(LightType.DIRECTIONAL);
  _positionAndTypeFloatBuffer=Utils.makeFloatBuffer4(0,0,0,0);
  setDirtyFlag();
}
Program: 184166
Project: 184166
Buggy source:
/** 
 * Used by Renderer
 */
public void commitToFloatBuffer(){
  this.toFloatBuffer(_fb);
}

Fixed version (ground truth):
/** 
 * Used by Renderer
 */
public void commitToFloatBuffer(){
  toFloatBuffer(_fb);
}
Program: 184167
Project: 184167
Buggy source:
/** 
 * Convenience method
 */
public void toFloatBuffer(FloatBuffer $floatBuffer){
  $floatBuffer.position(0);
  $floatBuffer.put((float)_x / 255f);
  $floatBuffer.put((float)_y / 255f);
  $floatBuffer.put((float)_z / 255f);
  $floatBuffer.position(0);
}

Fixed version (ground truth):
/** 
 * Convenience method
 */
public void toFloatBuffer(FloatBuffer $floatBuffer){
  $floatBuffer.position(0);
  $floatBuffer.put(_x);
  $floatBuffer.put(_y);
  $floatBuffer.put(_z);
  $floatBuffer.position(0);
}
Program: 184168
Project: 184168
Buggy source:
/** 
 * Color used to render object, but only when colorsEnabled is false.
 */
public Color4 defaultColor(){
  return _defaultColor;
}

Fixed version (ground truth):
public void defaultColor(Color4 color){
  _defaultColor=color;
}
Program: 184169
Project: 184169
Buggy source:
@Override public Object3d getChildAt(int $index){
  return _children.get($index);
}

Fixed version (ground truth):
public Object3d getChildAt(int $index){
  return _children.get($index);
}
Program: 184170
Project: 184170
Buggy source:
/** 
 * TODO: Use better lookup 
 */
@Override public Object3d getChildByName(String $name){
  for (int i=0; i < _children.size(); i++) {
    if (_children.get(i).name().equals($name))     return _children.get(i);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * TODO: Use better lookup 
 */
public Object3d getChildByName(String $name){
  for (int i=0; i < _children.size(); i++) {
    if (_children.get(i).name().equals($name))     return _children.get(i);
  }
  return null;
}
Program: 184171
Project: 184171
Buggy source:
@Override public void addChildAt(Object3d $o,int $index){
  _children.add($index,$o);
  $o.parent(this);
  $o.scene(this.scene());
}

Fixed version (ground truth):
public void addChildAt(Object3d $o,int $index){
  _children.add($index,$o);
  $o.parent(this);
  $o.scene(this.scene());
}
Program: 184172
Project: 184172
Buggy source:
@Override public Object3d removeChildAt(int $index){
  Object3d o=_children.remove($index);
  if (o != null) {
    o.parent(null);
    o.scene(null);
  }
  return o;
}

Fixed version (ground truth):
public Object3d removeChildAt(int $index){
  Object3d o=_children.remove($index);
  if (o != null) {
    o.parent(null);
    o.scene(null);
  }
  return o;
}
Program: 184173
Project: 184173
Buggy source:
@Override public boolean removeChild(Object3d $o){
  boolean b=_children.remove($o);
  if (b) {
    $o.parent(null);
    $o.scene(null);
  }
  return b;
}

Fixed version (ground truth):
public boolean removeChild(Object3d $o){
  boolean b=_children.remove($o);
  if (b) {
    $o.parent(null);
    $o.scene(null);
  }
  return b;
}
Program: 184174
Project: 184174
Buggy source:
@Override public int numChildren(){
  return _children.size();
}

Fixed version (ground truth):
public int numChildren(){
  return _children.size();
}
Program: 184175
Project: 184175
Buggy source:
@Override public void addChild(Object3d $o){
  _children.add($o);
  $o.parent(this);
  $o.scene(this.scene());
}

Fixed version (ground truth):
public void addChild(Object3d $o){
  _children.add($o);
  $o.parent(this);
  $o.scene(this.scene());
}
Program: 184176
Project: 184176
Buggy source:
@Override public int getChildIndexOf(Object3d $o){
  return _children.indexOf($o);
}

Fixed version (ground truth):
public int getChildIndexOf(Object3d $o){
  return _children.indexOf($o);
}
Program: 184178
Project: 184178
Buggy source:
/** 
 * TODO: Use better lookup 
 */
@Override public Object3d getChildByName(String $name){
  for (int i=0; i < _children.size(); i++) {
    if (_children.get(0).name() == $name)     return _children.get(0);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * TODO: Use better lookup 
 */
public Object3d getChildByName(String $name){
  for (int i=0; i < _children.size(); i++) {
    if (_children.get(0).name() == $name)     return _children.get(0);
  }
  return null;
}
Program: 184179
Project: 184179
Buggy source:
/** 
 * Removes Object3d from Scene. Returns false if unsuccessful
 */
@Override public boolean removeChild(Object3d $o){
  $o.parent(null);
  $o.scene(null);
  return _children.remove($o);
}

Fixed version (ground truth):
/** 
 * Removes Object3d from Scene. Returns false if unsuccessful
 */
public boolean removeChild(Object3d $o){
  $o.parent(null);
  $o.scene(null);
  return _children.remove($o);
}
Program: 184180
Project: 184180
Buggy source:
@Override public void onDirty(){
}

Fixed version (ground truth):
public void onDirty(){
}
Program: 184181
Project: 184181
Buggy source:
@Override public int getChildIndexOf(Object3d $o){
  return _children.indexOf($o);
}

Fixed version (ground truth):
public int getChildIndexOf(Object3d $o){
  return _children.indexOf($o);
}
Program: 184182
Project: 184182
Buggy source:
@Override public Object3d getChildAt(int $index){
  return _children.get($index);
}

Fixed version (ground truth):
public Object3d getChildAt(int $index){
  return _children.get($index);
}
Program: 184183
Project: 184183
Buggy source:
@Override public void addChildAt(Object3d $o,int $index){
  if (_children.contains($o))   return;
  _children.add($index,$o);
}

Fixed version (ground truth):
public void addChildAt(Object3d $o,int $index){
  if (_children.contains($o))   return;
  _children.add($index,$o);
}
Program: 184184
Project: 184184
Buggy source:
@Override public Object3d removeChildAt(int $index){
  Object3d o=_children.remove($index);
  if (o != null) {
    o.parent(null);
    o.scene(null);
  }
  return o;
}

Fixed version (ground truth):
public Object3d removeChildAt(int $index){
  Object3d o=_children.remove($index);
  if (o != null) {
    o.parent(null);
    o.scene(null);
  }
  return o;
}
Program: 184185
Project: 184185
Buggy source:
@Override public int numChildren(){
  return _children.size();
}

Fixed version (ground truth):
public int numChildren(){
  return _children.size();
}
Program: 184186
Project: 184186
Buggy source:
/** 
 * Adds Object3d to Scene. Object3d's must be added to Scene in order to be rendered Returns always true. 
 */
@Override public void addChild(Object3d $o){
  if (_children.contains($o))   return;
  _children.add($o);
  $o.parent(this);
  $o.scene(this);
}

Fixed version (ground truth):
/** 
 * Adds Object3d to Scene. Object3d's must be added to Scene in order to be rendered Returns always true. 
 */
public void addChild(Object3d $o){
  if (_children.contains($o))   return;
  _children.add($o);
  $o.parent(this);
  $o.scene(this);
}
Program: 184187
Project: 184187
Buggy source:
public Rectangle(float $width,float $height,int $segsW,int $segsH,long $colorRgba){
  super(4 * $segsW * $segsH,2 * $segsW * $segsH);
  int row, col;
  float w=$width / $segsW;
  float h=$height / $segsH;
  float width5=$width / 2f;
  float height5=$height / 2f;
  Color4 c=new Color4();
  c.setAll($colorRgba);
  for (row=0; row <= $segsH; row++) {
    for (col=0; col <= $segsW; col++) {
      this.vertices().addVertex((float)col * w - width5,(float)row * h - height5,0f,(float)col / (float)$segsW,1 - (float)row / (float)$segsH,0,0,1f,c.r,c.g,c.b,c.a);
    }
  }
  int colspan=$segsW + 1;
  for (row=1; row <= $segsH; row++) {
    for (col=1; col <= $segsW; col++) {
      int lr=row * colspan + col;
      int ll=lr - 1;
      int ur=lr - colspan;
      int ul=ur - 1;
      Utils.addQuad(this,ul,ur,lr,ll);
    }
  }
}

Fixed version (ground truth):
public Rectangle(float $width,float $height,int $segsW,int $segsH,Color4 color){
  super(4 * $segsW * $segsH,2 * $segsW * $segsH);
  int row, col;
  float w=$width / $segsW;
  float h=$height / $segsH;
  float width5=$width / 2f;
  float height5=$height / 2f;
  for (row=0; row <= $segsH; row++) {
    for (col=0; col <= $segsW; col++) {
      this.vertices().addVertex((float)col * w - width5,(float)row * h - height5,0f,(float)col / (float)$segsW,1 - (float)row / (float)$segsH,0,0,1f,color.r,color.g,color.b,color.a);
    }
  }
  int colspan=$segsW + 1;
  for (row=1; row <= $segsH; row++) {
    for (col=1; col <= $segsW; col++) {
      int lr=row * colspan + col;
      int ll=lr - 1;
      int ur=lr - colspan;
      int ul=ur - 1;
      Utils.addQuad(this,ul,ur,lr,ll);
    }
  }
}
Program: 184188
Project: 184188
Buggy source:
/** 
 * Override this in the concrete parser
 */
@Override public void parse(){
}

Fixed version (ground truth):
/** 
 * Override this in the concrete parser
 */
public void parse(){
}
Program: 184189
Project: 184189
Buggy source:
/** 
 * Override this in the concrete parser
 */
@Override public Object3dContainer getParsedObject(){
  return null;
}

Fixed version (ground truth):
/** 
 * Override this in the concrete parser
 */
public Object3dContainer getParsedObject(){
  return null;
}
Program: 184190
Project: 184190
Buggy source:
/** 
 * Override this in the concrete parser if applicable 
 */
@Override public AnimationObject3d getParsedAnimationObject(){
  return null;
}

Fixed version (ground truth):
/** 
 * Override this in the concrete parser if applicable 
 */
public AnimationObject3d getParsedAnimationObject(){
  return null;
}
Program: 184191
Project: 184191
Buggy source:
/** 
 * Clear object for garbage collection.
 */
public void clear(){
  this.vertices().points().clear();
  this.vertices().uvs().clear();
  this.vertices().normals().clear();
  this.vertices().colors().clear();
  _textures.clear();
  if (this.parent() != null)   this.parent().removeChild(this);
}

Fixed version (ground truth):
/** 
 * Clear object for garbage collection.
 */
public void clear(){
  this.vertices().points().clear();
  this.vertices().uvs().clear();
  this.vertices().normals().clear();
  if (this.vertices().colors() != null)   this.vertices().colors().clear();
  _textures.clear();
  if (this.parent() != null)   this.parent().removeChild(this);
}
Program: 184192
Project: 184192
Buggy source:
private void getFrames(BufferedInputStream stream,byte[] bytes) throws IOException {
  ByteArrayInputStream ba=new ByteArrayInputStream(bytes,header.offsetFrames - 68,bytes.length - header.offsetFrames);
  LittleEndianDataInputStream is=new LittleEndianDataInputStream(ba);
  ArrayList<Number3d> firstFrameVerts=new ArrayList<Number3d>();
  for (int i=0; i < header.numFrames; i++) {
    float scaleX=is.readFloat();
    float scaleY=is.readFloat();
    float scaleZ=is.readFloat();
    float translateX=is.readFloat();
    float translateY=is.readFloat();
    float translateZ=is.readFloat();
    String name=is.readString(16);
    name=name.subSequence(0,name.lastIndexOf("String_Node_Str")).toString();
    Log.d(Min3d.TAG,"String_Node_Str" + name);
    float vertices[]=new float[header.numVerts * 3];
    int index=0;
    for (int j=0; j < header.numVerts; j++) {
      vertices[index++]=scaleX * is.readUnsignedByte() + translateX;
      vertices[index++]=scaleY * is.readUnsignedByte() + translateY;
      vertices[index++]=scaleZ * is.readUnsignedByte() + translateZ;
      int normalIndex=is.readUnsignedByte();
      if (i == 0)       co.vertices.add(new Number3d(vertices[index - 3],vertices[index - 2],vertices[index - 1]));
    }
    frames[i]=new KeyFrame(name,vertices);
  }
}

Fixed version (ground truth):
private void getFrames(BufferedInputStream stream,byte[] bytes) throws IOException {
  ByteArrayInputStream ba=new ByteArrayInputStream(bytes,header.offsetFrames - 68,bytes.length - header.offsetFrames);
  LittleEndianDataInputStream is=new LittleEndianDataInputStream(ba);
  ArrayList<Number3d> firstFrameVerts=new ArrayList<Number3d>();
  for (int i=0; i < header.numFrames; i++) {
    float scaleX=is.readFloat();
    float scaleY=is.readFloat();
    float scaleZ=is.readFloat();
    float translateX=is.readFloat();
    float translateY=is.readFloat();
    float translateZ=is.readFloat();
    String name=is.readString(16);
    if (name.indexOf("String_Node_Str") > 0)     name=name.subSequence(0,name.lastIndexOf("String_Node_Str")).toString();
 else     name=name.substring(0,6).replaceAll("String_Node_Str","String_Node_Str");
    Log.d(Min3d.TAG,"String_Node_Str" + name);
    float vertices[]=new float[header.numVerts * 3];
    int index=0;
    for (int j=0; j < header.numVerts; j++) {
      vertices[index++]=scaleX * is.readUnsignedByte() + translateX;
      vertices[index++]=scaleY * is.readUnsignedByte() + translateY;
      vertices[index++]=scaleZ * is.readUnsignedByte() + translateZ;
      int normalIndex=is.readUnsignedByte();
      if (i == 0)       co.vertices.add(new Number3d(vertices[index - 3],vertices[index - 2],vertices[index - 1]));
    }
    frames[i]=new KeyFrame(name,vertices);
  }
}
Program: 184193
Project: 184193
Buggy source:
/** 
 * Generates a new texture atlas
 */
public void generate(){
  Collections.sort(bitmaps,new BitmapHeightComparer());
  if (bitmaps.size() == 0)   return;
  BitmapAsset largestBitmap=bitmaps.get(0);
  int totalWidth=0;
  int numBitmaps=bitmaps.size();
  int uOffset=0;
  int vOffset=0;
  for (int i=0; i < numBitmaps; i++) {
    if (bitmaps.get(i).useForAtlasDimensions)     totalWidth+=bitmaps.get(i).bitmap.getWidth();
  }
  atlas=Bitmap.createBitmap(totalWidth,largestBitmap.bitmap.getHeight(),Config.ARGB_8888);
  for (int i=0; i < numBitmaps; i++) {
    BitmapAsset ba=bitmaps.get(i);
    BitmapAsset existingBA=getBitmapAssetByResourceID(ba.resourceID);
    if (ba.useForAtlasDimensions) {
      Bitmap b=ba.bitmap;
      int w=b.getWidth();
      int h=b.getHeight();
      int[] pixels=new int[w * h];
      b.getPixels(pixels,0,w,0,0,w,h);
      atlas.setPixels(pixels,0,w,uOffset,vOffset,w,h);
      ba.uOffset=(float)uOffset / totalWidth;
      ba.vOffset=0;
      ba.uScale=(float)w / (float)totalWidth;
      ba.vScale=(float)h / (float)largestBitmap.bitmap.getHeight();
      uOffset+=w;
      b.recycle();
    }
 else {
      ba.uOffset=existingBA.uOffset;
      ba.vOffset=existingBA.vOffset;
      ba.uScale=existingBA.uScale;
      ba.vScale=existingBA.vScale;
    }
  }
}

Fixed version (ground truth):
/** 
 * Generates a new texture atlas
 */
public void generate(){
  Collections.sort(bitmaps,new BitmapHeightComparer());
  if (bitmaps.size() == 0)   return;
  BitmapAsset largestBitmap=bitmaps.get(0);
  int totalWidth=0;
  int numBitmaps=bitmaps.size();
  int uOffset=0;
  int vOffset=0;
  for (int i=0; i < numBitmaps; i++) {
    if (bitmaps.get(i).useForAtlasDimensions)     totalWidth+=bitmaps.get(i).bitmap.getWidth();
  }
  atlas=Bitmap.createBitmap(totalWidth,largestBitmap.bitmap.getHeight(),Config.ARGB_8888);
  for (int i=0; i < numBitmaps; i++) {
    BitmapAsset ba=bitmaps.get(i);
    BitmapAsset existingBA=getBitmapAssetByResourceID(ba.resourceID);
    if (ba.useForAtlasDimensions) {
      Bitmap b=ba.bitmap;
      int w=b.getWidth();
      int h=b.getHeight();
      int[] pixels=new int[w * h];
      b.getPixels(pixels,0,w,0,0,w,h);
      atlas.setPixels(pixels,0,w,uOffset,vOffset,w,h);
      ba.uOffset=(float)uOffset / totalWidth;
      ba.vOffset=0;
      ba.uScale=(float)w / (float)totalWidth;
      ba.vScale=(float)h / (float)largestBitmap.bitmap.getHeight();
      uOffset+=w;
      b.recycle();
    }
 else {
      ba.uOffset=existingBA.uOffset;
      ba.vOffset=existingBA.vOffset;
      ba.uScale=existingBA.uScale;
      ba.vScale=existingBA.vScale;
    }
  }
  setId(Shared.textureManager().getNewAtlasId());
}
Program: 184194
Project: 184194
Buggy source:
@Override public AnimationObject3d getParsedAnimationObject(){
  Log.d(Min3d.TAG,"String_Node_Str");
  Bitmap texture=null;
  AnimationObject3d animObj;
  if (textureAtlas.hasBitmaps()) {
    textureAtlas.generate();
    texture=textureAtlas.getBitmap();
    Shared.textureManager().addTextureId(texture,"String_Node_Str",generateMipMap);
  }
  Log.d(Min3d.TAG,"String_Node_Str" + co.name);
  animObj=co.getParsedObject(textureAtlas,frames);
  if (textureAtlas.hasBitmaps()) {
    if (texture != null)     texture.recycle();
  }
  Log.d(Min3d.TAG,"String_Node_Str");
  super.cleanup();
  return animObj;
}

Fixed version (ground truth):
@Override public AnimationObject3d getParsedAnimationObject(){
  Log.d(Min3d.TAG,"String_Node_Str");
  Bitmap texture=null;
  AnimationObject3d animObj;
  if (textureAtlas.hasBitmaps()) {
    textureAtlas.generate();
    texture=textureAtlas.getBitmap();
    Shared.textureManager().addTextureId(texture,textureAtlas.getId(),generateMipMap);
  }
  Log.d(Min3d.TAG,"String_Node_Str" + co.name);
  animObj=co.getParsedObject(textureAtlas,frames);
  if (textureAtlas.hasBitmaps()) {
    if (texture != null)     texture.recycle();
  }
  Log.d(Min3d.TAG,"String_Node_Str");
  super.cleanup();
  return animObj;
}
Program: 184195
Project: 184195
Buggy source:
public Object3dContainer getParsedObject(){
  Log.d(Min3d.TAG,"String_Node_Str");
  Object3dContainer obj=new Object3dContainer(0,0);
  int numObjects=parseObjects.size();
  Bitmap texture=null;
  if (textureAtlas.hasBitmaps()) {
    textureAtlas.generate();
    texture=textureAtlas.getBitmap();
    Shared.textureManager().addTextureId(texture,"String_Node_Str",generateMipMap);
  }
  for (int i=0; i < numObjects; i++) {
    ParseObjectData o=parseObjects.get(i);
    Log.d(Min3d.TAG,"String_Node_Str" + o.name);
    obj.addChild(o.getParsedObject(textureAtlas));
  }
  if (textureAtlas.hasBitmaps()) {
    if (texture != null)     texture.recycle();
  }
  Log.d(Min3d.TAG,"String_Node_Str");
  super.cleanup();
  return obj;
}

Fixed version (ground truth):
public Object3dContainer getParsedObject(){
  Log.d(Min3d.TAG,"String_Node_Str");
  Object3dContainer obj=new Object3dContainer(0,0);
  int numObjects=parseObjects.size();
  Bitmap texture=null;
  if (textureAtlas.hasBitmaps()) {
    textureAtlas.generate();
    texture=textureAtlas.getBitmap();
    Shared.textureManager().addTextureId(texture,textureAtlas.getId(),generateMipMap);
  }
  for (int i=0; i < numObjects; i++) {
    ParseObjectData o=parseObjects.get(i);
    Log.d(Min3d.TAG,"String_Node_Str" + o.name);
    obj.addChild(o.getParsedObject(textureAtlas));
  }
  if (textureAtlas.hasBitmaps()) {
    if (texture != null)     texture.recycle();
  }
  Log.d(Min3d.TAG,"String_Node_Str");
  super.cleanup();
  return obj;
}
Program: 184196
Project: 184196
Buggy source:
public Object3dContainer getParsedObject(){
  Log.d(Min3d.TAG,"String_Node_Str");
  Object3dContainer obj=new Object3dContainer(0,0);
  int numObjects=parseObjects.size();
  Bitmap texture=null;
  if (textureAtlas.hasBitmaps()) {
    textureAtlas.generate();
    texture=textureAtlas.getBitmap();
    Shared.textureManager().addTextureId(texture,"String_Node_Str",generateMipMap);
  }
  for (int i=0; i < numObjects; i++) {
    ParseObjectData o=parseObjects.get(i);
    Log.d(Min3d.TAG,"String_Node_Str" + o.name);
    obj.addChild(o.getParsedObject(textureAtlas));
  }
  if (textureAtlas.hasBitmaps()) {
    if (texture != null)     texture.recycle();
  }
  Log.d(Min3d.TAG,"String_Node_Str");
  cleanup();
  return obj;
}

Fixed version (ground truth):
public Object3dContainer getParsedObject(){
  Log.d(Min3d.TAG,"String_Node_Str");
  Object3dContainer obj=new Object3dContainer(0,0);
  int numObjects=parseObjects.size();
  Bitmap texture=null;
  if (textureAtlas.hasBitmaps()) {
    textureAtlas.generate();
    texture=textureAtlas.getBitmap();
    Shared.textureManager().addTextureId(texture,textureAtlas.getId(),generateMipMap);
  }
  for (int i=0; i < numObjects; i++) {
    ParseObjectData o=parseObjects.get(i);
    Log.d(Min3d.TAG,"String_Node_Str" + o.name);
    obj.addChild(o.getParsedObject(textureAtlas));
  }
  if (textureAtlas.hasBitmaps()) {
    if (texture != null)     texture.recycle();
  }
  Log.d(Min3d.TAG,"String_Node_Str");
  cleanup();
  return obj;
}
Program: 184197
Project: 184197
Buggy source:
private void parseObject(Object3d obj,TextureAtlas textureAtlas){
  int numFaces=faces.size();
  int faceIndex=0;
  boolean hasBitmaps=textureAtlas.hasBitmaps();
  for (int i=0; i < numFaces; i++) {
    ParseObjectFace face=faces.get(i);
    BitmapAsset ba=textureAtlas.getBitmapAssetByName(face.materialKey);
    for (int j=0; j < face.faceLength; j++) {
      Number3d newVertex=vertices.get(face.v[j]);
      Uv newUv=face.hasuv ? texCoords.get(face.uv[j]).clone() : new Uv();
      Number3d newNormal=face.hasn ? normals.get(face.n[j]) : new Number3d();
      Color4 newColor=new Color4(255,255,0,255);
      if (hasBitmaps) {
        newUv.u=ba.uOffset + newUv.u * ba.uScale;
        newUv.v=ba.vOffset + ((newUv.v + 1) * ba.vScale) - 1;
      }
      obj.vertices().addVertex(newVertex,newUv,newNormal,newColor);
    }
    if (face.faceLength == 3) {
      obj.faces().add(new Face(faceIndex,faceIndex + 1,faceIndex + 2));
    }
 else     if (face.faceLength == 4) {
      obj.faces().add(new Face(faceIndex,faceIndex + 1,faceIndex + 3));
      obj.faces().add(new Face(faceIndex + 1,faceIndex + 2,faceIndex + 3));
    }
    faceIndex+=face.faceLength;
  }
  if (hasBitmaps) {
    obj.textures().addById("String_Node_Str");
  }
  cleanup();
}

Fixed version (ground truth):
private void parseObject(Object3d obj,TextureAtlas textureAtlas){
  int numFaces=faces.size();
  int faceIndex=0;
  boolean hasBitmaps=textureAtlas.hasBitmaps();
  for (int i=0; i < numFaces; i++) {
    ParseObjectFace face=faces.get(i);
    BitmapAsset ba=textureAtlas.getBitmapAssetByName(face.materialKey);
    for (int j=0; j < face.faceLength; j++) {
      Number3d newVertex=vertices.get(face.v[j]);
      Uv newUv=face.hasuv ? texCoords.get(face.uv[j]).clone() : new Uv();
      Number3d newNormal=face.hasn ? normals.get(face.n[j]) : new Number3d();
      Color4 newColor=new Color4(255,255,0,255);
      if (hasBitmaps) {
        newUv.u=ba.uOffset + newUv.u * ba.uScale;
        newUv.v=ba.vOffset + ((newUv.v + 1) * ba.vScale) - 1;
      }
      obj.vertices().addVertex(newVertex,newUv,newNormal,newColor);
    }
    if (face.faceLength == 3) {
      obj.faces().add(new Face(faceIndex,faceIndex + 1,faceIndex + 2));
    }
 else     if (face.faceLength == 4) {
      obj.faces().add(new Face(faceIndex,faceIndex + 1,faceIndex + 3));
      obj.faces().add(new Face(faceIndex + 1,faceIndex + 2,faceIndex + 3));
    }
    faceIndex+=face.faceLength;
  }
  if (hasBitmaps) {
    obj.textures().addById(textureAtlas.getId());
  }
  cleanup();
}
Program: 184198
Project: 184198
Buggy source:
private void build(){
  color=new Color4();
  faces=new Rectangle[6];
  Rectangle north=new Rectangle(size,size,quality,quality,color);
  Rectangle east=new Rectangle(size,size,quality,quality,color);
  Rectangle south=new Rectangle(size,size,quality,quality,color);
  Rectangle west=new Rectangle(size,size,quality,quality,color);
  Rectangle up=new Rectangle(size,size,quality,quality,color);
  Rectangle down=new Rectangle(size,size,quality,quality,color);
  north.position().z=halfSize;
  north.lightingEnabled(false);
  east.rotation().y=-90;
  east.position().x=-halfSize;
  east.lightingEnabled(false);
  south.rotation().y=180;
  south.position().z=-halfSize;
  south.lightingEnabled(false);
  west.rotation().y=90;
  west.position().x=halfSize;
  west.lightingEnabled(false);
  up.rotation().x=-90;
  up.position().y=halfSize;
  up.lightingEnabled(false);
  down.rotation().x=90;
  down.position().y=-halfSize;
  down.lightingEnabled(false);
  faces[Face.North.ordinal()]=north;
  faces[Face.East.ordinal()]=east;
  faces[Face.South.ordinal()]=south;
  faces[Face.West.ordinal()]=west;
  faces[Face.Up.ordinal()]=up;
  faces[Face.Down.ordinal()]=down;
  addChild(north);
  addChild(east);
  addChild(south);
  addChild(west);
  addChild(up);
  addChild(down);
}

Fixed version (ground truth):
private void build(){
  color=new Color4();
  faces=new Rectangle[6];
  Rectangle north=new Rectangle(size,size,quality,quality,color);
  Rectangle east=new Rectangle(size,size,quality,quality,color);
  Rectangle south=new Rectangle(size,size,quality,quality,color);
  Rectangle west=new Rectangle(size,size,quality,quality,color);
  Rectangle up=new Rectangle(size,size,quality,quality,color);
  Rectangle down=new Rectangle(size,size,quality,quality,color);
  north.position().z=halfSize;
  north.lightingEnabled(false);
  east.rotation().y=-90;
  east.position().x=halfSize;
  east.doubleSidedEnabled(true);
  east.lightingEnabled(false);
  south.rotation().y=180;
  south.position().z=-halfSize;
  south.lightingEnabled(false);
  west.rotation().y=90;
  west.position().x=-halfSize;
  west.doubleSidedEnabled(true);
  west.lightingEnabled(false);
  up.rotation().x=90;
  up.position().y=halfSize;
  up.doubleSidedEnabled(true);
  up.lightingEnabled(false);
  down.rotation().x=-90;
  down.position().y=-halfSize;
  down.doubleSidedEnabled(true);
  down.lightingEnabled(false);
  faces[Face.North.ordinal()]=north;
  faces[Face.East.ordinal()]=east;
  faces[Face.South.ordinal()]=south;
  faces[Face.West.ordinal()]=west;
  faces[Face.Up.ordinal()]=up;
  faces[Face.Down.ordinal()]=down;
  addChild(north);
  addChild(east);
  addChild(south);
  addChild(west);
  addChild(up);
  addChild(down);
}
Program: 184199
Project: 184199
Buggy source:
/** 
 * Generates a new texture atlas
 */
public void generate(){
  Collections.sort(bitmaps,new BitmapHeightComparer());
  BitmapAsset largestBitmap=bitmaps.get(0);
  int totalWidth=0;
  int numBitmaps=bitmaps.size();
  for (int i=0; i < numBitmaps; i++) {
    totalWidth+=bitmaps.get(i).bitmap.getWidth();
  }
  atlas=Bitmap.createBitmap(totalWidth,largestBitmap.bitmap.getHeight(),Config.ARGB_8888);
  int uOffset=0;
  int vOffset=0;
  for (int i=0; i < numBitmaps; i++) {
    BitmapAsset ba=bitmaps.get(i);
    Bitmap b=ba.bitmap;
    int w=b.getWidth();
    int h=b.getHeight();
    int[] pixels=new int[w * h];
    b.getPixels(pixels,0,w,0,0,w,h);
    atlas.setPixels(pixels,0,w,uOffset,vOffset,w,h);
    ba.uOffset=(float)uOffset / totalWidth;
    ba.vOffset=0;
    ba.uScale=(float)w / (float)totalWidth;
    ba.vScale=(float)h / (float)largestBitmap.bitmap.getHeight();
    uOffset+=w;
    b.recycle();
  }
}

Fixed version (ground truth):
/** 
 * Generates a new texture atlas
 */
public void generate(){
  Collections.sort(bitmaps,new BitmapHeightComparer());
  if (bitmaps.size() == 0)   return;
  BitmapAsset largestBitmap=bitmaps.get(0);
  int totalWidth=0;
  int numBitmaps=bitmaps.size();
  for (int i=0; i < numBitmaps; i++) {
    totalWidth+=bitmaps.get(i).bitmap.getWidth();
  }
  atlas=Bitmap.createBitmap(totalWidth,largestBitmap.bitmap.getHeight(),Config.ARGB_8888);
  int uOffset=0;
  int vOffset=0;
  for (int i=0; i < numBitmaps; i++) {
    BitmapAsset ba=bitmaps.get(i);
    Bitmap b=ba.bitmap;
    int w=b.getWidth();
    int h=b.getHeight();
    int[] pixels=new int[w * h];
    b.getPixels(pixels,0,w,0,0,w,h);
    atlas.setPixels(pixels,0,w,uOffset,vOffset,w,h);
    ba.uOffset=(float)uOffset / totalWidth;
    ba.vOffset=0;
    ba.uScale=(float)w / (float)totalWidth;
    ba.vScale=(float)h / (float)largestBitmap.bitmap.getHeight();
    uOffset+=w;
    b.recycle();
  }
}
Program: 184200
Project: 184200
Buggy source:
public Object3dContainer getParsedObject(){
  Log.d(Min3d.TAG,"String_Node_Str");
  Object3dContainer obj=new Object3dContainer(0,0);
  int numObjects=parseObjects.size();
  textureAtlas.generate();
  Bitmap texture=textureAtlas.getBitmap();
  Shared.textureManager().addTextureId(texture,"String_Node_Str");
  for (int i=0; i < numObjects; i++) {
    ParseObjectData o=parseObjects.get(i);
    Log.d(Min3d.TAG,"String_Node_Str" + o.name);
    obj.addChild(o.getParsedObject(textureAtlas));
  }
  texture.recycle();
  textureAtlas.cleanup();
  Log.d(Min3d.TAG,"String_Node_Str");
  cleanup();
  return obj;
}

Fixed version (ground truth):
public Object3dContainer getParsedObject(){
  Log.d(Min3d.TAG,"String_Node_Str");
  Object3dContainer obj=new Object3dContainer(0,0);
  int numObjects=parseObjects.size();
  Bitmap texture=null;
  if (textureAtlas.hasBitmaps()) {
    textureAtlas.generate();
    texture=textureAtlas.getBitmap();
    Shared.textureManager().addTextureId(texture,"String_Node_Str");
  }
  for (int i=0; i < numObjects; i++) {
    ParseObjectData o=parseObjects.get(i);
    Log.d(Min3d.TAG,"String_Node_Str" + o.name);
    obj.addChild(o.getParsedObject(textureAtlas));
  }
  if (textureAtlas.hasBitmaps()) {
    if (texture != null)     texture.recycle();
    textureAtlas.cleanup();
  }
  Log.d(Min3d.TAG,"String_Node_Str");
  cleanup();
  return obj;
}
Program: 184201
Project: 184201
Buggy source:
public ObjFace(StringTokenizer parts,String materialKey,int faceLength){
  super();
  this.materialKey=materialKey;
  this.faceLength=faceLength;
  StringTokenizer subParts=new StringTokenizer(parts.nextToken(),"String_Node_Str");
  int partLength=subParts.countTokens();
  boolean emptyVt=parts.toString().indexOf("String_Node_Str") > -1;
  hasuv=partLength >= 2 && !emptyVt;
  hasn=partLength == 3;
  v=new short[faceLength];
  if (hasuv)   uv=new short[faceLength];
  if (hasn)   n=new short[faceLength];
  for (int i=1; i < faceLength + 1; i++) {
    if (i > 1)     subParts=new StringTokenizer(parts.nextToken(),"String_Node_Str");
    int index=i - 1;
    v[index]=(short)(Short.parseShort(subParts.nextToken()) - 1);
    if (hasuv)     uv[index]=(short)(Short.parseShort(subParts.nextToken()) - 1);
    if (hasn)     n[index]=(short)(Short.parseShort(subParts.nextToken()) - 1);
  }
}

Fixed version (ground truth):
public ObjFace(String line,String materialKey,int faceLength){
  super();
  this.materialKey=materialKey;
  this.faceLength=faceLength;
  boolean emptyVt=line.indexOf("String_Node_Str") > -1;
  if (emptyVt)   line=line.replace("String_Node_Str","String_Node_Str");
  StringTokenizer parts=new StringTokenizer(line);
  parts.nextToken();
  StringTokenizer subParts=new StringTokenizer(parts.nextToken(),"String_Node_Str");
  int partLength=subParts.countTokens();
  hasuv=partLength >= 2 && !emptyVt;
  hasn=partLength == 3 || (partLength == 2 && emptyVt);
  v=new short[faceLength];
  if (hasuv)   uv=new short[faceLength];
  if (hasn)   n=new short[faceLength];
  for (int i=1; i < faceLength + 1; i++) {
    if (i > 1)     subParts=new StringTokenizer(parts.nextToken(),"String_Node_Str");
    int index=i - 1;
    v[index]=(short)(Short.parseShort(subParts.nextToken()) - 1);
    if (hasuv)     uv[index]=(short)(Short.parseShort(subParts.nextToken()) - 1);
    if (hasn)     n[index]=(short)(Short.parseShort(subParts.nextToken()) - 1);
  }
}
Program: 184203
Project: 184203
Buggy source:
public void play(String name){
  currentFrameIndex=0;
  for (int i=0; i < numFrames; i++) {
    if (frames[i].getName().equals(name))     currentFrameIndex=i;
  }
  play();
}

Fixed version (ground truth):
public void play(String name,boolean loop){
  this.loop=loop;
  play(name);
}
Program: 184205
Project: 184205
Buggy source:
private void getFrames(BufferedInputStream stream,byte[] bytes) throws IOException {
  ByteArrayInputStream ba=new ByteArrayInputStream(bytes,header.offsetFrames - 68,bytes.length - header.offsetFrames);
  LittleEndianDataInputStream is=new LittleEndianDataInputStream(ba);
  ArrayList<Number3d> firstFrameVerts=new ArrayList<Number3d>();
  for (int i=0; i < header.numFrames; i++) {
    float scaleX=is.readFloat();
    float scaleY=is.readFloat();
    float scaleZ=is.readFloat();
    float translateX=is.readFloat();
    float translateY=is.readFloat();
    float translateZ=is.readFloat();
    String name=is.readString(16);
    float vertices[]=new float[header.numVerts * 3];
    int index=0;
    for (int j=0; j < header.numVerts; j++) {
      vertices[index++]=scaleX * is.readUnsignedByte() + translateX;
      vertices[index++]=scaleY * is.readUnsignedByte() + translateY;
      vertices[index++]=scaleZ * is.readUnsignedByte() + translateZ;
      int normalIndex=is.readUnsignedByte();
      if (i == 0)       co.vertices.add(new Number3d(vertices[index - 3],vertices[index - 2],vertices[index - 1]));
    }
    frames[i]=new KeyFrame(name,vertices);
  }
}

Fixed version (ground truth):
private void getFrames(BufferedInputStream stream,byte[] bytes) throws IOException {
  ByteArrayInputStream ba=new ByteArrayInputStream(bytes,header.offsetFrames - 68,bytes.length - header.offsetFrames);
  LittleEndianDataInputStream is=new LittleEndianDataInputStream(ba);
  ArrayList<Number3d> firstFrameVerts=new ArrayList<Number3d>();
  for (int i=0; i < header.numFrames; i++) {
    float scaleX=is.readFloat();
    float scaleY=is.readFloat();
    float scaleZ=is.readFloat();
    float translateX=is.readFloat();
    float translateY=is.readFloat();
    float translateZ=is.readFloat();
    String name=is.readString(16);
    name=name.subSequence(0,name.lastIndexOf("String_Node_Str")).toString();
    Log.d(Min3d.TAG,"String_Node_Str" + name);
    float vertices[]=new float[header.numVerts * 3];
    int index=0;
    for (int j=0; j < header.numVerts; j++) {
      vertices[index++]=scaleX * is.readUnsignedByte() + translateX;
      vertices[index++]=scaleY * is.readUnsignedByte() + translateY;
      vertices[index++]=scaleZ * is.readUnsignedByte() + translateZ;
      int normalIndex=is.readUnsignedByte();
      if (i == 0)       co.vertices.add(new Number3d(vertices[index - 3],vertices[index - 2],vertices[index - 1]));
    }
    frames[i]=new KeyFrame(name,vertices);
  }
}
Program: 184207
Project: 184207
Buggy source:
public ReadLog(String filename,double burnIn){
  time=-System.currentTimeMillis();
  String[] lines=LoadStrings(filename);
  int commentedLines=0;
  for (int row=0; row < lines.length; row++) {
    if (lines[row].startsWith("String_Node_Str")) {
      commentedLines++;
    }
  }
  nrow=lines.length - commentedLines - 1;
  String[] colNames=lines[commentedLines].split("String_Node_Str");
  List<Integer> list=new ArrayList<Integer>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  for (int row=0; row < colNames.length; row++) {
    Matcher matcher=pattern.matcher(colNames[row]);
    if (matcher.find()) {
      list.add(row);
    }
  }
  ncol=list.size();
  int delete=(int)(nrow * burnIn) + 1;
  indicators=new double[nrow - delete][ncol];
  int i=0;
  for (int row=delete; row < nrow; row++) {
    String[] line=lines[row].split("String_Node_Str");
    indicators[i]=Utils.parseDouble(Utils.Subset(line,list.get(0),ncol));
    i++;
  }
  indicators=(double[][])indicators;
  nrow=indicators.length;
  time+=System.currentTimeMillis();
}

Fixed version (ground truth):
public ReadLog(String filename,double burnIn){
  String[] lines=LoadStrings(filename);
  int commentedLines=0;
  for (int row=0; row < lines.length; row++) {
    if (lines[row].startsWith("String_Node_Str")) {
      commentedLines++;
    }
  }
  nrow=lines.length - commentedLines - 1;
  String[] colNames=lines[commentedLines].split("String_Node_Str");
  List<Integer> list=new ArrayList<Integer>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  for (int row=0; row < colNames.length; row++) {
    Matcher matcher=pattern.matcher(colNames[row]);
    if (matcher.find()) {
      list.add(row);
    }
  }
  ncol=list.size();
  int delete=(int)(nrow * burnIn) + 1;
  System.out.println(nrow * burnIn);
  indicators=new double[nrow - delete][ncol];
  int i=0;
  for (int row=delete; row < nrow; row++) {
    String[] line=lines[row].split("String_Node_Str");
    indicators[i]=Utils.parseDouble(Utils.Subset(line,list.get(0),ncol));
    i++;
  }
  indicators=(double[][])indicators;
  nrow=indicators.length;
}
Program: 184208
Project: 184208
Buggy source:
public ReadLog(String filename,double burnIn){
  String[] lines=LoadStrings(filename);
  int commentedLines=0;
  for (int row=0; row < lines.length; row++) {
    if (lines[row].startsWith("String_Node_Str")) {
      commentedLines++;
    }
  }
  nrow=lines.length - commentedLines - 1;
  String[] colNames=lines[commentedLines].split("String_Node_Str");
  List<Integer> list=new ArrayList<Integer>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  for (int row=0; row < colNames.length; row++) {
    Matcher matcher=pattern.matcher(colNames[row]);
    if (matcher.find()) {
      list.add(row);
    }
  }
  ncol=list.size();
  int delete=(int)(nrow * burnIn) + 1;
  System.out.println(nrow * burnIn);
  indicators=new double[nrow - delete][ncol];
  int i=0;
  for (int row=delete; row < nrow; row++) {
    String[] line=lines[row].split("String_Node_Str");
    indicators[i]=Utils.parseDouble(Utils.Subset(line,list.get(0),ncol));
    i++;
  }
  indicators=(double[][])indicators;
  nrow=indicators.length;
}

Fixed version (ground truth):
public ReadLog(String filename,double burnIn){
  String[] lines=LoadStrings(filename);
  int commentedLines=0;
  for (int row=0; row < lines.length; row++) {
    if (lines[row].startsWith("String_Node_Str")) {
      commentedLines++;
    }
  }
  nrow=lines.length - commentedLines - 1;
  String[] colNames=lines[commentedLines].split("String_Node_Str");
  List<Integer> list=new ArrayList<Integer>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  for (int row=0; row < colNames.length; row++) {
    Matcher matcher=pattern.matcher(colNames[row]);
    if (matcher.find()) {
      list.add(row);
    }
  }
  ncol=list.size();
  int delete=(int)(nrow * burnIn) + 1;
  indicators=new double[nrow - delete][ncol];
  int i=0;
  for (int row=delete; row < nrow; row++) {
    String[] line=lines[row].split("String_Node_Str");
    indicators[i]=Utils.parseDouble(Utils.Subset(line,list.get(0),ncol));
    i++;
  }
  indicators=(double[][])indicators;
  nrow=indicators.length;
}
Program: 184209
Project: 184209
Buggy source:
public String getNextCleaner(){
  Calendar c=Calendar.getInstance();
  return getCleaner(c.get(Calendar.WEEK_OF_YEAR) + 1);
}

Fixed version (ground truth):
public String getNextCleaner(){
  Calendar c=Calendar.getInstance(Locale.UK);
  return getCleaner(c.get(Calendar.WEEK_OF_YEAR) + 1);
}
Program: 184210
Project: 184210
Buggy source:
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder holder;
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.pantlistrow,parent,false);
    holder=new ViewHolder();
    holder.amount=(TextView)convertView.findViewById(R.id.pantrow_amount);
    holder.date=(TextView)convertView.findViewById(R.id.pantrow_date);
    holder.user=(TextView)convertView.findViewById(R.id.pantrow_user);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  holder.date.setVisibility(8);
  Pant p=pantList.get(position);
  holder.amount.setText(p.getAmount() + "String_Node_Str");
  holder.date.setText(p.getDate().toString());
  holder.user.setText(p.getUser());
  return convertView;
}

Fixed version (ground truth):
@Override public View getView(int position,View convertView,ViewGroup parent){
  ViewHolder holder;
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.pantlistrow,parent,false);
    holder=new ViewHolder();
    holder.amount=(TextView)convertView.findViewById(R.id.pantrow_amount);
    holder.date=(TextView)convertView.findViewById(R.id.pantrow_date);
    holder.user=(TextView)convertView.findViewById(R.id.pantrow_user);
    convertView.setTag(holder);
  }
 else {
    holder=(ViewHolder)convertView.getTag();
  }
  Pant p=pantList.get(position);
  holder.amount.setText(p.getAmount() + "String_Node_Str");
  holder.date.setText(p.getDate().getDate() + "String_Node_Str" + (p.getDate().getMonth() + 1)+ "String_Node_Str"+ (p.getDate().getYear() + 1900));
  holder.user.setText(p.getUser());
  return convertView;
}