nus-yam/ex-repair huggingface dataset:
Program: 30399
Project: 30399
Buggy source:
@Override public void draw(SpriteBatch batch,float x,float y,float originX,float originY,float scale){
  x=x - getWidth() / 2 * scale;
  if (tex == null) {
    RectangleRenderer.draw(batch,x,y,getWidth() * scale,getHeight() * scale,Color.RED);
    return;
  }
  if (!flipX) {
    batch.draw(tex,x,y,originX,originY,tex.getRegionWidth(),tex.getRegionHeight(),scale,scale,0);
  }
 else {
    batch.draw(tex,x + tex.getRegionWidth() * scale,y,originX,originY,-tex.getRegionWidth(),tex.getRegionHeight(),scale,scale,0);
  }
}

Fixed version (ground truth):
@Override public void draw(SpriteBatch batch,float x,float y,float scale){
  x=x - getWidth() / 2 * scale;
  if (tex == null) {
    RectangleRenderer.draw(batch,x,y,getWidth() * scale,getHeight() * scale,Color.RED);
    return;
  }
  if (!flipX) {
    batch.draw(tex,x,y,0,0,tex.getRegionWidth(),tex.getRegionHeight(),scale,scale,0);
  }
 else {
    batch.draw(tex,x + tex.getRegionWidth() * scale,y,0,0,-tex.getRegionWidth(),tex.getRegionHeight(),scale,scale,0);
  }
}
Program: 30400
Project: 30400
Buggy source:
@Override public void draw(SpriteBatch batch,float x,float y,float originX,float originY,float scale){
  if (currentSkeleton != null) {
    currentSkeleton.skeleton.setX(x);
    currentSkeleton.skeleton.setY(y);
    renderer.draw(batch,currentSkeleton.skeleton);
  }
 else {
    RectangleRenderer.draw(batch,x,y,getWidth() * scale,getHeight() * scale,Color.RED);
  }
}

Fixed version (ground truth):
@Override public void draw(SpriteBatch batch,float x,float y,float scale){
  if (currentSkeleton != null) {
    currentSkeleton.skeleton.setX(x);
    currentSkeleton.skeleton.setY(y);
    renderer.draw(batch,currentSkeleton.skeleton);
  }
 else {
    RectangleRenderer.draw(batch,x,y,getWidth() * scale,getHeight() * scale,Color.RED);
  }
}
Program: 30401
Project: 30401
Buggy source:
@Override public void draw(SpriteBatch batch,float x,float y,float originX,float originY,float scale){
  x=x - getWidth() / 2 * scale;
  if (USE_FBO) {
    batch.draw(tex,x,y,originX,originY,width,height,scale,scale,0);
  }
 else {
    float p0x, p0y, pfx, pfy;
    Vector3 tmp=new Vector3();
    updateViewport();
    tmp.set(x,y,0);
    tmp.prj(batch.getProjectionMatrix());
    p0x=VIEWPORT.width * (tmp.x + 1) / 2;
    p0y=VIEWPORT.height * (tmp.y + 1) / 2;
    tmp.set(x + width,y + height,0);
    tmp.prj(batch.getProjectionMatrix());
    pfx=VIEWPORT.width * (tmp.x + 1) / 2;
    pfy=VIEWPORT.height * (tmp.y + 1) / 2;
    batch.end();
    Gdx.gl20.glViewport((int)(p0x + VIEWPORT.x),(int)(p0y + VIEWPORT.y),(int)(pfx - p0x),(int)(pfy - p0y));
    Gdx.gl.glClear(GL20.GL_DEPTH_BUFFER_BIT | (Gdx.graphics.getBufferFormat().coverageSampling ? GL20.GL_COVERAGE_BUFFER_BIT_NV : 0));
    drawModel();
    Gdx.gl20.glViewport((int)VIEWPORT.x,(int)VIEWPORT.y,(int)VIEWPORT.width,(int)VIEWPORT.height);
    batch.begin();
  }
}

Fixed version (ground truth):
@Override public void draw(SpriteBatch batch,float x,float y,float scale){
  x=x - getWidth() / 2 * scale;
  if (USE_FBO) {
    batch.draw(tex,x,y,0,0,width,height,scale,scale,0);
  }
 else {
    float p0x, p0y, pfx, pfy;
    Vector3 tmp=new Vector3();
    updateViewport();
    tmp.set(x,y,0);
    tmp.prj(batch.getProjectionMatrix());
    p0x=VIEWPORT.width * (tmp.x + 1) / 2;
    p0y=VIEWPORT.height * (tmp.y + 1) / 2;
    tmp.set(x + width,y + height,0);
    tmp.prj(batch.getProjectionMatrix());
    pfx=VIEWPORT.width * (tmp.x + 1) / 2;
    pfy=VIEWPORT.height * (tmp.y + 1) / 2;
    batch.end();
    Gdx.gl20.glViewport((int)(p0x + VIEWPORT.x),(int)(p0y + VIEWPORT.y),(int)(pfx - p0x),(int)(pfy - p0y));
    Gdx.gl.glClear(GL20.GL_DEPTH_BUFFER_BIT | (Gdx.graphics.getBufferFormat().coverageSampling ? GL20.GL_COVERAGE_BUFFER_BIT_NV : 0));
    drawModel();
    Gdx.gl20.glViewport((int)VIEWPORT.x,(int)VIEWPORT.y,(int)VIEWPORT.width,(int)VIEWPORT.height);
    batch.begin();
  }
}
Program: 30402
Project: 30402
Buggy source:
public void draw(SpriteBatch batch){
  if (isVisible()) {
    renderer.draw(batch,pos.x,pos.y,0,0,scale);
  }
}

Fixed version (ground truth):
public void draw(SpriteBatch batch){
  if (isVisible()) {
    renderer.draw(batch,pos.x,pos.y,scale);
  }
}
Program: 30403
Project: 30403
Buggy source:
public void draw(SpriteBatch batch,float x,float y,float originX,float originY,float scale);

Fixed version (ground truth):
public void draw(SpriteBatch batch,float x,float y,float scale);
Program: 30405
Project: 30405
Buggy source:
@Override public void render(){
  testSourceChanged();
  testFaChanged();
  if (renderer == null || renderer.getCurrentFrameAnimation() == null)   return;
  renderer.update(Gdx.graphics.getDeltaTime());
  GL20 gl=Gdx.gl20;
  gl.glClearColor(Color.MAGENTA.r,Color.MAGENTA.g,Color.MAGENTA.b,1);
  gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  float scalew=Gdx.graphics.getWidth() / renderer.getWidth();
  float scaleh=Gdx.graphics.getHeight() / renderer.getHeight();
  float scale=scalew > scaleh ? scaleh : scalew;
  batch.setProjectionMatrix(screenCamera.combined);
  batch.begin();
  renderer.draw(batch,renderer.getWidth() * scale / 2,0f,0f,0f,scale);
  batch.end();
}

Fixed version (ground truth):
@Override public void render(){
  testSourceChanged();
  testFaChanged();
  if (renderer == null || renderer.getCurrentFrameAnimation() == null)   return;
  renderer.update(Gdx.graphics.getDeltaTime());
  GL20 gl=Gdx.gl20;
  gl.glClearColor(Color.MAGENTA.r,Color.MAGENTA.g,Color.MAGENTA.b,1);
  gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  float scalew=Gdx.graphics.getWidth() / renderer.getWidth();
  float scaleh=Gdx.graphics.getHeight() / renderer.getHeight();
  float scale=scalew > scaleh ? scaleh : scalew;
  batch.setProjectionMatrix(screenCamera.combined);
  batch.begin();
  renderer.draw(batch,renderer.getWidth() * scale / 2,0f,scale);
  batch.end();
}
Program: 30406
Project: 30406
Buggy source:
public void draw(SpriteBatch batch){
  if (renderer != null && currentFrameAnimation != null) {
    float screenWidth=Gdx.graphics.getWidth();
    float screenHeight=Gdx.graphics.getHeight();
    float width=HEIGHT / renderer.getHeight() * renderer.getWidth();
    RectangleRenderer.draw(batch,screenWidth - width - 5,screenHeight - HEIGHT - 55,width + 10,HEIGHT + 10,Color.BLACK);
    RectangleRenderer.draw(batch,screenWidth - width,screenHeight - HEIGHT - 50,width,HEIGHT,BG_COLOR);
    float scaleh=width / renderer.getWidth();
    renderer.draw(batch,screenWidth - width / 2,screenHeight - HEIGHT - 50,0,0,scaleh);
  }
}

Fixed version (ground truth):
public void draw(SpriteBatch batch){
  if (renderer != null && currentFrameAnimation != null) {
    float screenWidth=Gdx.graphics.getWidth();
    float screenHeight=Gdx.graphics.getHeight();
    float width=HEIGHT / renderer.getHeight() * renderer.getWidth();
    RectangleRenderer.draw(batch,screenWidth - width - 5,screenHeight - HEIGHT - 55,width + 10,HEIGHT + 10,Color.BLACK);
    RectangleRenderer.draw(batch,screenWidth - width,screenHeight - HEIGHT - 50,width,HEIGHT,BG_COLOR);
    float scaleh=width / renderer.getWidth();
    renderer.draw(batch,screenWidth - width / 2,screenHeight - HEIGHT - 50,scaleh);
  }
}
Program: 30407
Project: 30407
Buggy source:
@Override public void onEvent(int type,BaseTween<?> source){
  if (cb != null) {
    cb.onEvent();
  }
}

Fixed version (ground truth):
@Override public void onEvent(int type,BaseTween<?> source){
  if (cb != null) {
    ActionCallbackQueue.add(cb);
  }
}
Program: 30408
Project: 30408
Buggy source:
public void update(float delta){
  for (int i=0; i < timers.size(); i++) {
    Timer t=timers.get(i);
    t.currentTime+=delta;
    if (t.currentTime >= t.time) {
      timers.remove(i);
      t.cb.onEvent();
      i--;
    }
  }
}

Fixed version (ground truth):
public void update(float delta){
  for (int i=0; i < timers.size(); i++) {
    Timer t=timers.get(i);
    t.currentTime+=delta;
    if (t.currentTime >= t.time) {
      timers.remove(i);
      ActionCallbackQueue.add(t.cb);
      i--;
    }
  }
}
Program: 30409
Project: 30409
Buggy source:
public void update(float delta){
  timer=timer - delta;
  if (isFinish() && cb != null) {
    ActionCallback cb2=cb;
    cb=null;
    cb2.onEvent();
  }
}

Fixed version (ground truth):
public void update(float delta){
  timer=timer - delta;
  if (isFinish() && cb != null) {
    ActionCallbackQueue.add(cb);
    cb=null;
  }
}
Program: 30410
Project: 30410
Buggy source:
public void update(float delta){
  if (controller.current != null && controller.current.loopCount != 0) {
    controller.update(delta);
    genShadowMap();
    if (USE_FBO)     renderTex();
  }
  if (callCb) {
    callCb=false;
    if (animationCb == null) {
      animationCb=ActionCallbackSerialization.find(animationCbSer);
      animationCbSer=null;
    }
    animationCb.onEvent();
  }
}

Fixed version (ground truth):
public void update(float delta){
  if (controller.current != null && controller.current.loopCount != 0) {
    controller.update(delta);
    genShadowMap();
    if (USE_FBO)     renderTex();
  }
}
Program: 30411
Project: 30411
Buggy source:
@Override public void write(Json json){
  json.writeValue("String_Node_Str",modelFileName);
  json.writeValue("String_Node_Str",width);
  json.writeValue("String_Node_Str",height);
  json.writeValue("String_Node_Str",cameraPos,cameraPos == null ? null : Vector3.class);
  json.writeValue("String_Node_Str",cameraRot,cameraRot == null ? null : Vector3.class);
  json.writeValue("String_Node_Str",cameraName,cameraName == null ? null : String.class);
  json.writeValue("String_Node_Str",cameraFOV);
  json.writeValue("String_Node_Str",modelRotation);
  json.writeValue("String_Node_Str",callCb);
  json.writeValue("String_Node_Str",ActionCallbackSerialization.find(animationCb),animationCb == null ? null : String.class);
}

Fixed version (ground truth):
@Override public void write(Json json){
  json.writeValue("String_Node_Str",modelFileName);
  json.writeValue("String_Node_Str",width);
  json.writeValue("String_Node_Str",height);
  json.writeValue("String_Node_Str",cameraPos,cameraPos == null ? null : Vector3.class);
  json.writeValue("String_Node_Str",cameraRot,cameraRot == null ? null : Vector3.class);
  json.writeValue("String_Node_Str",cameraName,cameraName == null ? null : String.class);
  json.writeValue("String_Node_Str",cameraFOV);
  json.writeValue("String_Node_Str",modelRotation);
  json.writeValue("String_Node_Str",ActionCallbackSerialization.find(animationCb),animationCb == null ? null : String.class);
}
Program: 30412
Project: 30412
Buggy source:
@Override public void read(Json json,JsonValue jsonData){
  modelFileName=json.readValue("String_Node_Str",String.class,jsonData);
  width=json.readValue("String_Node_Str",Integer.class,jsonData);
  height=json.readValue("String_Node_Str",Integer.class,jsonData);
  cameraPos=json.readValue("String_Node_Str",Vector3.class,jsonData);
  cameraRot=json.readValue("String_Node_Str",Vector3.class,jsonData);
  cameraName=json.readValue("String_Node_Str",String.class,jsonData);
  cameraFOV=json.readValue("String_Node_Str",Float.class,jsonData);
  modelRotation=json.readValue("String_Node_Str",Float.class,jsonData);
  callCb=json.readValue("String_Node_Str",Boolean.class,jsonData);
  animationCbSer=json.readValue("String_Node_Str",String.class,jsonData);
}

Fixed version (ground truth):
@Override public void read(Json json,JsonValue jsonData){
  modelFileName=json.readValue("String_Node_Str",String.class,jsonData);
  width=json.readValue("String_Node_Str",Integer.class,jsonData);
  height=json.readValue("String_Node_Str",Integer.class,jsonData);
  cameraPos=json.readValue("String_Node_Str",Vector3.class,jsonData);
  cameraRot=json.readValue("String_Node_Str",Vector3.class,jsonData);
  cameraName=json.readValue("String_Node_Str",String.class,jsonData);
  cameraFOV=json.readValue("String_Node_Str",Float.class,jsonData);
  modelRotation=json.readValue("String_Node_Str",Float.class,jsonData);
  animationCbSer=json.readValue("String_Node_Str",String.class,jsonData);
}
Program: 30413
Project: 30413
Buggy source:
@Override public void onEnd(AnimationDesc animation){
  if (animationCb != null || animationCbSer != null) {
    callCb=true;
  }
}

Fixed version (ground truth):
@Override public void onEnd(AnimationDesc animation){
  if (animationCb != null || animationCbSer != null) {
    if (animationCb == null) {
      animationCb=ActionCallbackSerialization.find(animationCbSer);
      animationCbSer=null;
    }
    ActionCallbackQueue.add(animationCb);
  }
}
Program: 30414
Project: 30414
Buggy source:
public void startFrameAnimation(String id,int repeatType,int count,ActionCallback cb){
  boolean reverse=false;
  if (repeatType == EngineTween.REVERSE || repeatType == EngineTween.REVERSE_REPEAT)   reverse=true;
  if (modelInstance.getAnimation(id) != null) {
    animationCb=cb;
    callCb=false;
    controller.setAnimation(id,count,reverse ? -1 : 1,animationListener);
    return;
  }
  int idx=id.indexOf('.');
  if (idx != -1) {
    String s=id.substring(0,idx);
    String dir=id.substring(idx + 1);
    lookat(dir);
    if (modelInstance.getAnimation(s) != null) {
      animationCb=cb;
      callCb=false;
      controller.setAnimation(s,count,reverse ? -1 : 1,animationListener);
      return;
    }
  }
  EngineLogger.error("String_Node_Str" + id);
  for (  Animation a : modelInstance.animations) {
    EngineLogger.debug(a.id);
  }
  if (cb != null)   cb.onEvent();
}

Fixed version (ground truth):
public void startFrameAnimation(String id,int repeatType,int count,ActionCallback cb){
  boolean reverse=false;
  animationCb=cb;
  if (repeatType == EngineTween.REVERSE || repeatType == EngineTween.REVERSE_REPEAT)   reverse=true;
  if (modelInstance.getAnimation(id) != null) {
    animationCb=cb;
    controller.setAnimation(id,count,reverse ? -1 : 1,animationListener);
    return;
  }
  int idx=id.indexOf('.');
  if (idx != -1) {
    String s=id.substring(0,idx);
    String dir=id.substring(idx + 1);
    lookat(dir);
    if (modelInstance.getAnimation(s) != null) {
      controller.setAnimation(s,count,reverse ? -1 : 1,animationListener);
      return;
    }
  }
  EngineLogger.error("String_Node_Str" + id);
  for (  Animation a : modelInstance.animations) {
    EngineLogger.debug(a.id);
  }
  if (cb != null) {
    ActionCallbackQueue.add(cb);
  }
}
Program: 30415
Project: 30415
Buggy source:
@Override public void loadAssets(){
  renderer.loadAssets();
}

Fixed version (ground truth):
@Override public void loadAssets(){
  super.loadAssets();
  renderer.loadAssets();
}
Program: 30416
Project: 30416
Buggy source:
@Override public void retrieveAssets(){
  super.retrieveAssets();
  renderer.retrieveAssets();
  if (renderer.getCurrentFrameAnimation() == null && initFrameAnimation != null) {
    startFrameAnimation(initFrameAnimation,null);
  }
}

Fixed version (ground truth):
@Override public void retrieveAssets(){
  super.retrieveAssets();
  renderer.retrieveAssets();
  if (renderer.getCurrentFrameAnimation() == null) {
    startFrameAnimation(initFrameAnimation,null);
  }
}
Program: 30417
Project: 30417
Buggy source:
public void goTo(Vector2 pf,ActionCallback cb){
  EngineLogger.debug(MessageFormat.format("String_Node_Str",pf.x,pf.y));
  Vector2 p0=getPosition();
  ArrayList<Vector2> walkingPath=null;
  PixTileMap bgMap=scene.getBackgroundMap();
  if (bgMap != null)   walkingPath=bgMap.findPath(scene,p0,pf);
  if (walkingPath == null || walkingPath.size() == 0) {
    if (cb != null)     cb.onEvent();
    return;
  }
  TweenManager manager=TweenManagerSingleton.getInstance();
  manager.killTarget(this);
  WalkTween t=new WalkTween();
  t.start(this,walkingPath,walkingSpeed,cb);
  manager.add(t);
}

Fixed version (ground truth):
public void goTo(Vector2 pf,ActionCallback cb){
  EngineLogger.debug(MessageFormat.format("String_Node_Str",pf.x,pf.y));
  Vector2 p0=getPosition();
  ArrayList<Vector2> walkingPath=null;
  PixTileMap bgMap=scene.getBackgroundMap();
  if (bgMap != null)   walkingPath=bgMap.findPath(scene,p0,pf);
  if (walkingPath == null || walkingPath.size() == 0) {
    if (cb != null)     ActionCallbackQueue.add(cb);
    return;
  }
  TweenManager manager=TweenManagerSingleton.getInstance();
  manager.killTarget(this);
  WalkTween t=new WalkTween();
  t.start(this,walkingPath,walkingSpeed,cb);
  manager.add(t);
}
Program: 30418
Project: 30418
Buggy source:
@Override public void update(float delta){
  if (currentAnimation != null) {
    animationTime+=delta;
    tex=currentAnimation.getKeyFrame(animationTime);
    if (currentAnimation.isAnimationFinished(animationTime) && (animationCb != null || animationCbSer != null)) {
      if (animationCb == null) {
        animationCb=ActionCallbackSerialization.find(animationCbSer);
        animationCbSer=null;
      }
      ActionCallback cb2=animationCb;
      animationCb=null;
      cb2.onEvent();
    }
  }
}

Fixed version (ground truth):
@Override public void update(float delta){
  if (currentAnimation != null) {
    animationTime+=delta;
    tex=currentAnimation.getKeyFrame(animationTime);
    if (currentAnimation.isAnimationFinished(animationTime) && (animationCb != null || animationCbSer != null)) {
      if (animationCb == null) {
        animationCb=ActionCallbackSerialization.find(animationCbSer);
        animationCbSer=null;
      }
      ActionCallbackQueue.add(animationCb);
      animationCb=null;
      currentAnimation=null;
    }
  }
}
Program: 30419
Project: 30419
Buggy source:
@Override public void draw(SpriteBatch batch,float x,float y,float originX,float originY,float scale){
  if (tex == null) {
    RectangleRenderer.draw(batch,x,y,getWidth() * scale,getHeight() * scale,Color.RED);
  }
  if (!flipX) {
    batch.draw(tex,x,y,originX,originY,tex.getRegionWidth(),tex.getRegionHeight(),scale,scale,0);
  }
 else {
    batch.draw(tex,x + tex.getRegionWidth() * scale,y,originX,originY,-tex.getRegionWidth(),tex.getRegionHeight(),scale,scale,0);
  }
}

Fixed version (ground truth):
@Override public void draw(SpriteBatch batch,float x,float y,float originX,float originY,float scale){
  if (tex == null) {
    RectangleRenderer.draw(batch,x,y,getWidth() * scale,getHeight() * scale,Color.RED);
    return;
  }
  if (!flipX) {
    batch.draw(tex,x,y,originX,originY,tex.getRegionWidth(),tex.getRegionHeight(),scale,scale,0);
  }
 else {
    batch.draw(tex,x + tex.getRegionWidth() * scale,y,originX,originY,-tex.getRegionWidth(),tex.getRegionHeight(),scale,scale,0);
  }
}
Program: 30420
Project: 30420
Buggy source:
private void startCurrentFrameAnimation(int repeatType,int count,ActionCallback cb){
  if (notPreloadedAtlas != null && !currentFrameAnimation.atlas.equals(notPreloadedAtlas)) {
    EngineAssetManager.getInstance().disposeAtlas(notPreloadedAtlas);
    notPreloadedAtlas=null;
  }
  if (currentFrameAnimation != null && currentFrameAnimation.regions == null) {
    retrieveFA(currentFrameAnimation.id,true);
  }
  if (currentFrameAnimation == null || currentFrameAnimation.regions == null) {
    tex=null;
    return;
  }
  currentAnimation=null;
  animationTime=0;
  animationCb=cb;
  if (currentFrameAnimation.regions.size <= 1 || currentFrameAnimation.duration == 0.0) {
    tex=currentFrameAnimation.regions.first();
    if (cb != null) {
      cb.onEvent();
    }
    return;
  }
  if (repeatType != EngineTween.FROM_FA) {
    currentFrameAnimation.animationType=repeatType;
    currentFrameAnimation.count=count;
  }
  newCurrentAnimation(currentFrameAnimation.animationType,count);
}

Fixed version (ground truth):
private void startCurrentFrameAnimation(int repeatType,int count,ActionCallback cb){
  animationCb=cb;
  if (notPreloadedAtlas != null && !currentFrameAnimation.atlas.equals(notPreloadedAtlas)) {
    EngineAssetManager.getInstance().disposeAtlas(notPreloadedAtlas);
    notPreloadedAtlas=null;
  }
  if (currentFrameAnimation != null && currentFrameAnimation.regions == null) {
    retrieveFA(currentFrameAnimation.id,true);
  }
  if (currentFrameAnimation == null || currentFrameAnimation.regions == null) {
    tex=null;
    return;
  }
  currentAnimation=null;
  animationTime=0;
  if (currentFrameAnimation.regions.size <= 1 || currentFrameAnimation.duration == 0.0) {
    tex=currentFrameAnimation.regions.first();
    if (cb != null) {
      ActionCallbackQueue.add(cb);
    }
    return;
  }
  if (repeatType != EngineTween.FROM_FA) {
    currentFrameAnimation.animationType=repeatType;
    currentFrameAnimation.count=count;
  }
  newCurrentAnimation(currentFrameAnimation.animationType,count);
}
Program: 30421
Project: 30421
Buggy source:
public void startFrameAnimation(String id,int repeatType,int count,ActionCallback cb){
  AtlasFrameAnimation fa=getFrameAnimation(id);
  if (fa == null) {
    EngineLogger.error("String_Node_Str" + id);
    return;
  }
  currentFrameAnimation=fa;
  startCurrentFrameAnimation(repeatType,count,cb);
}

Fixed version (ground truth):
public void startFrameAnimation(String id,int repeatType,int count,ActionCallback cb){
  AtlasFrameAnimation fa=null;
  if (id == null) {
    fa=fanims.values().iterator().next();
  }
 else {
    fa=getFrameAnimation(id);
  }
  if (fa == null) {
    EngineLogger.error("String_Node_Str" + id);
    return;
  }
  currentFrameAnimation=fa;
  startCurrentFrameAnimation(repeatType,count,cb);
}
Program: 30422
Project: 30422
Buggy source:
public void callCb(){
  if (cb != null) {
    cb.onEvent();
  }
}

Fixed version (ground truth):
public void callCb(){
  if (cb != null) {
    ActionCallbackQueue.add(cb);
  }
}
Program: 30423
Project: 30423
Buggy source:
public void update(float delta){
  currentTime+=delta;
  if (isFinish() && cb != null) {
    ActionCallback cb2=cb;
    cb=null;
    cb2.onEvent();
  }
}

Fixed version (ground truth):
public void update(float delta){
  currentTime+=delta;
  if (isFinish() && cb != null) {
    ActionCallbackQueue.add(cb);
    cb=null;
  }
}
Program: 30424
Project: 30424
Buggy source:
public void update(float delta){
  if (assetState == AssetState.LOAD_ASSETS || assetState == AssetState.LOAD_ASSETS_AND_INIT_SCENE) {
    loadAssets();
    if (assetState == AssetState.LOAD_ASSETS)     assetState=AssetState.LOADING;
 else     assetState=AssetState.LOADING_AND_INIT_SCENE;
    initLoadingTime=System.currentTimeMillis();
  }
 else   if ((assetState == AssetState.LOADING || assetState == AssetState.LOADING_AND_INIT_SCENE) && !EngineAssetManager.getInstance().isLoading()) {
    retrieveAssets();
    boolean initScene=(assetState == AssetState.LOADING_AND_INIT_SCENE);
    assetState=AssetState.LOADED;
    EngineLogger.debug("String_Node_Str" + (System.currentTimeMillis() - initLoadingTime));
    if (initScene) {
      initCurrentScene();
    }
  }
  if (paused || assetState != AssetState.LOADED)   return;
  timeOfGame+=delta;
  getCurrentScene().update(delta);
  textManager.update(delta);
  timers.update(delta);
  TweenManagerSingleton.getInstance().update(delta);
}

Fixed version (ground truth):
public void update(float delta){
  if (assetState == AssetState.LOAD_ASSETS || assetState == AssetState.LOAD_ASSETS_AND_INIT_SCENE) {
    loadAssets();
    if (assetState == AssetState.LOAD_ASSETS)     assetState=AssetState.LOADING;
 else     assetState=AssetState.LOADING_AND_INIT_SCENE;
    initLoadingTime=System.currentTimeMillis();
  }
 else   if ((assetState == AssetState.LOADING || assetState == AssetState.LOADING_AND_INIT_SCENE) && !EngineAssetManager.getInstance().isLoading()) {
    retrieveAssets();
    boolean initScene=(assetState == AssetState.LOADING_AND_INIT_SCENE);
    assetState=AssetState.LOADED;
    EngineLogger.debug("String_Node_Str" + (System.currentTimeMillis() - initLoadingTime));
    if (initScene) {
      initCurrentScene();
    }
  }
  if (paused || assetState != AssetState.LOADED)   return;
  timeOfGame+=delta;
  getCurrentScene().update(delta);
  textManager.update(delta);
  timers.update(delta);
  TweenManagerSingleton.getInstance().update(delta);
  ActionCallbackQueue.run();
}
Program: 30425
Project: 30425
Buggy source:
@Override public void afterProcess(Page page){
  System.out.println(page);
}

Fixed version (ground truth):
@Override public void afterProcess(Page page){
}
Program: 30426
Project: 30426
Buggy source:
/** 
 * @return all of the VCF FILTER lines in their original file order, or an empty list if none were present
 */
public List<VCFIDHeaderLine> getIDHeaderLines(){
  final List<VCFIDHeaderLine> filters=new ArrayList<VCFIDHeaderLine>();
  for (  final VCFHeaderLine line : mMetaData) {
    if (line instanceof VCFIDHeaderLine) {
      filters.add((VCFIDHeaderLine)line);
    }
  }
  return filters;
}

Fixed version (ground truth):
/** 
 * @return all of the VCF ID-based header lines in their original file order, or an empty list if none were present
 */
public List<VCFIDHeaderLine> getIDHeaderLines(){
  final List<VCFIDHeaderLine> lines=new ArrayList<VCFIDHeaderLine>();
  for (  final VCFHeaderLine line : mMetaData) {
    if (line instanceof VCFIDHeaderLine) {
      lines.add((VCFIDHeaderLine)line);
    }
  }
  return lines;
}
Program: 30427
Project: 30427
Buggy source:
/** 
 * Requires that the accumulator for the record is previously fill with  {@link #accumulateSamRecord(htsjdk.samtools.SAMRecord)}. Include in the LocusInfo the indels; the quality threshold does not affect insertions/deletions
 */
@Override void accumulateIndels(SAMRecord rec){
  final List<CigarElement> cigar=rec.getCigar().getCigarElements();
  int readBase=0;
  int refBase=rec.getAlignmentStart() - getAccumulatorOffset(rec);
  for (int elementIndex=0; elementIndex < cigar.size(); elementIndex++) {
    final CigarElement e=cigar.get(elementIndex);
    final CigarOperator operator=e.getOperator();
    if (operator.equals(CigarOperator.I)) {
      System.err.println("String_Node_Str");
      accumulator.get(refBase - 1).addInserted(rec,readBase);
      readBase+=e.getLength();
    }
 else     if (operator.equals(CigarOperator.D)) {
      for (int i=0; i < e.getLength(); i++) {
        accumulator.get(refBase + i).addDeleted(rec,readBase - 1);
      }
      refBase+=e.getLength();
    }
 else {
      if (operator.consumesReadBases())       readBase+=e.getLength();
      if (operator.consumesReferenceBases())       refBase+=e.getLength();
    }
  }
}

Fixed version (ground truth):
/** 
 * Requires that the accumulator for the record is previously fill with  {@link #accumulateSamRecord(htsjdk.samtools.SAMRecord)}. Include in the LocusInfo the indels; the quality threshold does not affect insertions/deletions
 */
@Override void accumulateIndels(SAMRecord rec){
  final List<CigarElement> cigar=rec.getCigar().getCigarElements();
  int readBase=0;
  int refBase=rec.getAlignmentStart() - getAccumulatorOffset(rec);
  for (int elementIndex=0; elementIndex < cigar.size(); elementIndex++) {
    final CigarElement e=cigar.get(elementIndex);
    final CigarOperator operator=e.getOperator();
    if (operator.equals(CigarOperator.I)) {
      accumulator.get(refBase - 1).addInserted(rec,readBase);
      readBase+=e.getLength();
    }
 else     if (operator.equals(CigarOperator.D)) {
      for (int i=0; i < e.getLength(); i++) {
        accumulator.get(refBase + i).addDeleted(rec,readBase - 1);
      }
      refBase+=e.getLength();
    }
 else {
      if (operator.consumesReadBases())       readBase+=e.getLength();
      if (operator.consumesReferenceBases())       refBase+=e.getLength();
    }
  }
}
Program: 30428
Project: 30428
Buggy source:
/** 
 * Pop the first entry from the AbstractLocusInfo<T> accumulator into the complete queue.  In addition, check the ReferenceSequenceMask and if there are intervening mask positions between the last popped base and the one about to be popped, put those on the complete queue as well. Note that a single call to this method may not empty the accumulator completely, or even empty it at all, because it may just put a zero-coverage AbstractLocusInfo<T> into the complete queue.
 * @param stopBeforeLocus don't go up to this sequence and position
 */
private void populateCompleteQueue(final Locus stopBeforeLocus){
  while (!accumulator.isEmpty() && accumulator.get(0).isEmpty() && locusComparator.compare(accumulator.get(0),stopBeforeLocus) < 0) {
    accumulator.remove(0);
  }
  if (accumulator.isEmpty()) {
    return;
  }
  final K locusInfo=accumulator.get(0);
  if (locusComparator.compare(stopBeforeLocus,locusInfo) <= 0) {
    return;
  }
  if (emitUncoveredLoci) {
    final K zeroCoverage=createNextUncoveredLocusInfo(locusInfo);
    if (zeroCoverage != null) {
      complete.add(zeroCoverage);
      return;
    }
  }
  accumulator.remove(0);
  final int sequenceIndex=locusInfo.getSequenceIndex();
  if (referenceSequenceMask.get(locusInfo.getSequenceIndex(),locusInfo.getPosition())) {
    complete.add(locusInfo);
  }
  lastReferenceSequence=sequenceIndex;
  lastPosition=locusInfo.getPosition();
}

Fixed version (ground truth):
/** 
 * Pop the first entry from the AbstractLocusInfo<T> accumulator into the complete queue.  In addition, check the ReferenceSequenceMask and if there are intervening mask positions between the last popped base and the one about to be popped, put those on the complete queue as well. Note that a single call to this method may not empty the accumulator completely, or even empty it at all, because it may just put a zero-coverage AbstractLocusInfo<T> into the complete queue.
 * @param stopBeforeLocus don't go up to this sequence and position
 */
private void populateCompleteQueue(final Locus stopBeforeLocus){
  removeSkippedRegion(stopBeforeLocus);
  if (accumulator.isEmpty()) {
    return;
  }
  final K locusInfo=accumulator.get(0);
  if (locusComparator.compare(stopBeforeLocus,locusInfo) <= 0) {
    return;
  }
  if (emitUncoveredLoci) {
    final K zeroCoverage=createNextUncoveredLocusInfo(locusInfo);
    if (zeroCoverage != null) {
      complete.add(zeroCoverage);
      return;
    }
  }
  accumulator.remove(0);
  final int sequenceIndex=locusInfo.getSequenceIndex();
  if (referenceSequenceMask.get(locusInfo.getSequenceIndex(),locusInfo.getPosition())) {
    complete.add(locusInfo);
  }
  lastReferenceSequence=sequenceIndex;
  lastPosition=locusInfo.getPosition();
}
Program: 30429
Project: 30429
Buggy source:
/** 
 * Add a contig header line to the lookup list for contig lines (contigMetaData). If there's already a contig line with the same ID, does not add the line. Note: does not add the contig line to the master list of header lines in mMetaData -- this must be done separately if desired.
 * @param line contig header line to add
 * @return true if line was added to the list of contig lines, otherwise false
 */
private boolean addContigMetaDataLineLookupEntry(final VCFContigHeaderLine line){
  for (  VCFContigHeaderLine vcfContigHeaderLine : contigMetaData) {
    if (vcfContigHeaderLine.getID().equals(line.getID())) {
      if (GeneralUtils.DEBUG_MODE_ENABLED) {
        System.err.println("String_Node_Str" + line.getID() + "String_Node_Str");
      }
      return false;
    }
  }
  contigMetaData.add(line);
  return true;
}

Fixed version (ground truth):
/** 
 * Add a contig header line to the lookup list for contig lines (contigMetaData). If there's already a contig line with the same ID, does not add the line. Note: does not add the contig line to the master list of header lines in mMetaData -- this must be done separately if desired.
 * @param line contig header line to add
 * @return true if line was added to the list of contig lines, otherwise false
 */
private boolean addContigMetaDataLineLookupEntry(final VCFContigHeaderLine line){
  if (contigMetaData.containsKey(line.getID())) {
    if (GeneralUtils.DEBUG_MODE_ENABLED) {
      System.err.println("String_Node_Str" + line.getID() + "String_Node_Str");
    }
    return false;
  }
  contigMetaData.put(line.getID(),line);
  return true;
}
Program: 30430
Project: 30430
Buggy source:
/** 
 * Completely replaces the contig records in this header with those in the given SAMSequenceDictionary.
 */
public void setSequenceDictionary(final SAMSequenceDictionary dictionary){
  this.contigMetaData.clear();
  final List<VCFHeaderLine> toRemove=new ArrayList<VCFHeaderLine>();
  for (  final VCFHeaderLine line : mMetaData) {
    if (line instanceof VCFContigHeaderLine) {
      toRemove.add(line);
    }
  }
  mMetaData.removeAll(toRemove);
  for (  final SAMSequenceRecord record : dictionary.getSequences()) {
    contigMetaData.add(new VCFContigHeaderLine(record,record.getAssembly()));
  }
  this.mMetaData.addAll(contigMetaData);
}

Fixed version (ground truth):
/** 
 * Completely replaces the contig records in this header with those in the given SAMSequenceDictionary.
 */
public void setSequenceDictionary(final SAMSequenceDictionary dictionary){
  this.contigMetaData.clear();
  final List<VCFHeaderLine> toRemove=new ArrayList<VCFHeaderLine>();
  for (  final VCFHeaderLine line : mMetaData) {
    if (line instanceof VCFContigHeaderLine) {
      toRemove.add(line);
    }
  }
  mMetaData.removeAll(toRemove);
  for (  final SAMSequenceRecord record : dictionary.getSequences()) {
    addMetaDataLine(new VCFContigHeaderLine(record,record.getAssembly()));
  }
}
Program: 30431
Project: 30431
Buggy source:
/** 
 * @return all of the VCF header lines of the ##contig form in order, or an empty list if none were present
 */
public List<VCFContigHeaderLine> getContigLines(){
  return Collections.unmodifiableList(contigMetaData);
}

Fixed version (ground truth):
/** 
 * @return all of the VCF header lines of the ##contig form in order, or an empty list if none were present
 */
public List<VCFContigHeaderLine> getContigLines(){
  return Collections.unmodifiableList(new ArrayList<>(contigMetaData.values()));
}
Program: 30432
Project: 30432
Buggy source:
@Test public void testVCFHeaderAddContigLine(){
  final VCFHeader header=getHiSeqVCFHeader();
  final VCFContigHeaderLine contigLine=new VCFContigHeaderLine("String_Node_Str",VCFHeaderVersion.VCF4_0,"String_Node_Str",0);
  header.addMetaDataLine(contigLine);
  Assert.assertTrue(header.getContigLines().contains(contigLine),"String_Node_Str");
  Assert.assertTrue(header.getMetaDataInInputOrder().contains(contigLine),"String_Node_Str");
  Assert.assertFalse(header.getInfoHeaderLines().contains(contigLine),"String_Node_Str");
  Assert.assertFalse(header.getFormatHeaderLines().contains(contigLine),"String_Node_Str");
  Assert.assertFalse(header.getFilterLines().contains(contigLine),"String_Node_Str");
  Assert.assertFalse(header.getOtherHeaderLines().contains(contigLine),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testVCFHeaderAddContigLine(){
  final VCFHeader header=getHiSeqVCFHeader();
  final VCFContigHeaderLine contigLine=new VCFContigHeaderLine("String_Node_Str",VCFHeaderVersion.VCF4_0,VCFHeader.CONTIG_KEY,0);
  header.addMetaDataLine(contigLine);
  Assert.assertTrue(header.getContigLines().contains(contigLine),"String_Node_Str");
  Assert.assertTrue(header.getMetaDataInInputOrder().contains(contigLine),"String_Node_Str");
  Assert.assertFalse(header.getInfoHeaderLines().contains(contigLine),"String_Node_Str");
  Assert.assertFalse(header.getFormatHeaderLines().contains(contigLine),"String_Node_Str");
  Assert.assertFalse(header.getFilterLines().contains(contigLine),"String_Node_Str");
  Assert.assertFalse(header.getOtherHeaderLines().contains(contigLine),"String_Node_Str");
}
Program: 30433
Project: 30433
Buggy source:
/** 
 * Creates the BAMIndexContent for this reference. Requires all features of the reference have already been processed.
 */
public BinningIndexContent generateIndexContent(){
  if (binsSeen == 0)   return null;
  final long[] newIndex=new long[largestIndexSeen + 1];
  long lastNonZeroOffset=0;
  for (int i=0; i <= largestIndexSeen; i++) {
    if (index[i] == 0) {
      index[i]=lastNonZeroOffset;
    }
 else {
      lastNonZeroOffset=index[i];
    }
    newIndex[i]=index[i];
  }
  final LinearIndex linearIndex=new LinearIndex(referenceSequence,0,newIndex);
  return new BinningIndexContent(referenceSequence,new BinningIndexContent.BinList(bins,binsSeen),linearIndex);
}

Fixed version (ground truth):
/** 
 * Creates the BAMIndexContent for this reference. Requires all features of the reference have already been processed.
 */
public BinningIndexContent generateIndexContent(){
  if (binsSeen == 0)   return null;
  final long[] newIndex=new long[largestIndexSeen + 1];
  long lastNonZeroOffset=0;
  for (int i=0; i <= largestIndexSeen; i++) {
    if (index[i] == UNINITIALIZED_WINDOW) {
      index[i]=lastNonZeroOffset;
    }
 else {
      lastNonZeroOffset=index[i];
    }
    newIndex[i]=index[i];
  }
  final LinearIndex linearIndex=new LinearIndex(referenceSequence,0,newIndex);
  return new BinningIndexContent(referenceSequence,new BinningIndexContent.BinList(bins,binsSeen),linearIndex);
}
Program: 30434
Project: 30434
Buggy source:
public void processFeature(final FeatureToBeIndexed feature){
  final Integer binNumber=feature.getIndexingBin();
  final int binNum=binNumber == null ? computeIndexingBin(feature) : binNumber;
  final Bin bin;
  if (bins[binNum] != null) {
    bin=bins[binNum];
  }
 else {
    bin=new Bin(referenceSequence,binNum);
    bins[binNum]=bin;
    binsSeen++;
  }
  final Chunk newChunk=feature.getChunk();
  final long chunkStart=newChunk.getChunkStart();
  final long chunkEnd=newChunk.getChunkEnd();
  final List<Chunk> oldChunks=bin.getChunkList();
  if (!bin.containsChunks()) {
    bin.addInitialChunk(newChunk);
  }
 else {
    final Chunk lastChunk=bin.getLastChunk();
    if (BlockCompressedFilePointerUtil.areInSameOrAdjacentBlocks(lastChunk.getChunkEnd(),chunkStart)) {
      lastChunk.setChunkEnd(chunkEnd);
    }
 else {
      oldChunks.add(newChunk);
      bin.setLastChunk(newChunk);
    }
  }
  final int featureEnd=feature.getEnd();
  int startWindow=LinearIndex.convertToLinearIndexOffset(feature.getStart());
  final int endWindow;
  if (featureEnd == GenomicIndexUtil.UNSET_GENOMIC_LOCATION) {
    startWindow=LinearIndex.convertToLinearIndexOffset(feature.getStart() - 1);
    endWindow=startWindow;
  }
 else {
    endWindow=LinearIndex.convertToLinearIndexOffset(featureEnd);
  }
  if (endWindow > largestIndexSeen) {
    largestIndexSeen=endWindow;
  }
  for (int win=startWindow; win <= endWindow; win++) {
    if (index[win] == 0 || chunkStart < index[win]) {
      index[win]=chunkStart;
    }
  }
}

Fixed version (ground truth):
public void processFeature(final FeatureToBeIndexed feature){
  final Integer binNumber=feature.getIndexingBin();
  final int binNum=binNumber == null ? computeIndexingBin(feature) : binNumber;
  final Bin bin;
  if (bins[binNum] != null) {
    bin=bins[binNum];
  }
 else {
    bin=new Bin(referenceSequence,binNum);
    bins[binNum]=bin;
    binsSeen++;
  }
  final Chunk newChunk=feature.getChunk();
  final long chunkStart=newChunk.getChunkStart();
  final long chunkEnd=newChunk.getChunkEnd();
  final List<Chunk> oldChunks=bin.getChunkList();
  if (!bin.containsChunks()) {
    bin.addInitialChunk(newChunk);
  }
 else {
    final Chunk lastChunk=bin.getLastChunk();
    if (BlockCompressedFilePointerUtil.areInSameOrAdjacentBlocks(lastChunk.getChunkEnd(),chunkStart)) {
      lastChunk.setChunkEnd(chunkEnd);
    }
 else {
      oldChunks.add(newChunk);
      bin.setLastChunk(newChunk);
    }
  }
  final int featureEnd=feature.getEnd();
  int startWindow=LinearIndex.convertToLinearIndexOffset(feature.getStart());
  final int endWindow;
  if (featureEnd == GenomicIndexUtil.UNSET_GENOMIC_LOCATION) {
    startWindow=LinearIndex.convertToLinearIndexOffset(feature.getStart() - 1);
    endWindow=startWindow;
  }
 else {
    endWindow=LinearIndex.convertToLinearIndexOffset(featureEnd);
  }
  if (endWindow > largestIndexSeen) {
    largestIndexSeen=endWindow;
  }
  for (int win=startWindow; win <= endWindow; win++) {
    if (index[win] == UNINITIALIZED_WINDOW || chunkStart < index[win]) {
      index[win]=chunkStart;
    }
  }
}
Program: 30435
Project: 30435
Buggy source:
/** 
 * Builds a FastaSequenceIndex on the fly from a FASTA file. Note: this also alows to create an index for a compressed file, but does not generate the .gzi index required for use it with samtools.
 * @param fastaFile the FASTA file.
 * @return a fai index.
 * @throws SAMException for formatting errors.
 * @throws IOException  if an IO error occurs.
 */
public static FastaSequenceIndex buildFromFasta(final Path fastaFile) throws IOException {
  try (final AsciiLineReader in=new AsciiLineReader(IOUtil.openFileForReading(fastaFile))){
    String previous=in.readLine();
    if (previous == null) {
      throw new SAMException("String_Node_Str" + fastaFile);
    }
 else     if (previous.charAt(0) != '>') {
      throw new SAMException("String_Node_Str" + previous);
    }
    int sequenceIndex=-1;
    long location=in.getPosition();
    final FastaSequenceIndex index=new FastaSequenceIndex();
    FaiEntryBuilder entry=null;
    for (String line=in.readLine(); previous != null; line=in.readLine()) {
      if (previous.charAt(0) == '>') {
        if (entry != null)         index.add(entry.build());
        entry=new FaiEntryBuilder(sequenceIndex++,previous,line,in.getLineTerminatorLength(),location);
      }
 else       if (line != null && line.charAt(0) == '>') {
        location=in.getPosition();
      }
 else       if (line != null && !line.isEmpty()) {
        entry.updateWithSequence(line,in.getLineTerminatorLength());
      }
      previous=line;
    }
    index.add(entry.build());
    return index;
  }
 }

Fixed version (ground truth):
/** 
 * Builds a FastaSequenceIndex on the fly from a FASTA file. Note: this also alows to create an index for a compressed file, but does not generate the .gzi index required for use it with samtools.
 * @param fastaFile the FASTA file.
 * @return a fai index.
 * @throws SAMException for formatting errors.
 * @throws IOException  if an IO error occurs.
 */
public static FastaSequenceIndex buildFromFasta(final Path fastaFile) throws IOException {
  try (final AsciiLineReader in=AsciiLineReader.from(IOUtil.openFileForReading(fastaFile))){
    String previous=in.readLine();
    if (previous == null) {
      throw new SAMException("String_Node_Str" + fastaFile);
    }
 else     if (previous.charAt(0) != '>') {
      throw new SAMException("String_Node_Str" + previous);
    }
    int sequenceIndex=-1;
    long location=in.getPosition();
    final FastaSequenceIndex index=new FastaSequenceIndex();
    FaiEntryBuilder entry=null;
    for (String line=in.readLine(); previous != null; line=in.readLine()) {
      if (previous.charAt(0) == '>') {
        if (entry != null)         index.add(entry.build());
        entry=new FaiEntryBuilder(sequenceIndex++,previous,line,in.getLineTerminatorLength(),location);
      }
 else       if (line != null && line.charAt(0) == '>') {
        location=in.getPosition();
      }
 else       if (line != null && !line.isEmpty()) {
        entry.updateWithSequence(line,in.getLineTerminatorLength());
      }
      previous=line;
    }
    index.add(entry.build());
    return index;
  }
 }
Program: 30436
Project: 30436
Buggy source:
@Override public LocationAware makeIndexableSourceFromStream(final InputStream bufferedInputStream){
  final PositionalBufferedStream pbs;
  if (bufferedInputStream instanceof PositionalBufferedStream) {
    pbs=(PositionalBufferedStream)bufferedInputStream;
  }
 else {
    pbs=new PositionalBufferedStream(bufferedInputStream);
  }
  return new AsciiLineReaderIterator(new AsciiLineReader(pbs));
}

Fixed version (ground truth):
@Override public LocationAware makeIndexableSourceFromStream(final InputStream inputStream){
  return new AsciiLineReaderIterator(AsciiLineReader.from(inputStream));
}
Program: 30437
Project: 30437
Buggy source:
/** 
 * Generates a   {@link LocationAware} reader of type {@link SOURCE}.  Like   {@link #makeSourceFromStream(java.io.InputStream)}, except the   {@link LocationAware} compatibility is required for creating indexes.Implementers of this method must return a type that is both  {@link LocationAware} as well as {@link SOURCE}.  Note that this  requirement cannot be enforced via the method signature due to limitations in Java's generic typing system.  Instead, consumers should cast the call result into a   {@link SOURCE} when applicable.
 */
public LocationAware makeIndexableSourceFromStream(final InputStream bufferedInputStream);

Fixed version (ground truth):
/** 
 * Return a   {@link SOURCE} for this {@link FeatureCodec} that implements {@link LocationAware}, and is thus suitable for use during indexing. Like   {@link #makeSourceFromStream(java.io.InputStream)}, except the   {@link LocationAware} compatibility is required for creating indexes.</p> Implementers of this method must return a type that is both  {@link LocationAware} as well as {@link SOURCE}.  Note that this  requirement cannot be enforced via the method signature due to limitations in Java's generic typing system.  Instead, consumers should cast the call result into a   {@link SOURCE} when applicable.</p> NOTE: During the indexing process, the indexer passes the  {@link SOURCE} to the codecto consume Features from the underlying  {@link SOURCE}, one at a time, recording the Feature location via the   {@link SOURCE}'s  {@link LocationAware} interface. Therefore, it is essential that the {@link SOURCE} implementation, the {@link #readHeader}method, and the   {@link #decodeLoc} method, which are used during indexing, not introduce any buffering that would thatwould advance the  {@link SOURCE} more than a single feature (or the more than the size of the header, in the case of{@link #readHeader}).
 */
public LocationAware makeIndexableSourceFromStream(final InputStream inputStream);
Program: 30438
Project: 30438
Buggy source:
@Override public Object readActualHeader(LineIterator reader){
  return null;
}

Fixed version (ground truth):
/** 
 * The BED codec doesn't retain the actual header, but we need to parse through it and advance to the beginning of the first feature. This is especially true if we're indexing, since we want to underlying stream offset to be established correctly, but is also the case for when we're simply iterating to satisfy a feature query (otherwise the feature reader can terminate prematurely if the header is large).
 * @param lineIterator
 * @return Always null. The BEDCodec currently doesn't model or preserve the BED header.
 */
@Override public Object readActualHeader(final LineIterator lineIterator){
  while (lineIterator.hasNext()) {
    final String nextLine=lineIterator.peek();
    if (isBEDHeaderLine(nextLine)) {
      this.readHeaderLine(lineIterator.next());
    }
 else {
      return null;
    }
  }
  return null;
}
Program: 30439
Project: 30439
Buggy source:
/** 
 * @param inputFile The file from which to read. Stream for reading is opened on construction.
 * @param codec
 */
public FeatureIterator(final File inputFile,final FeatureCodec<FEATURE_TYPE,SOURCE> codec){
  this.codec=codec;
  this.inputFile=inputFile;
  final FeatureCodecHeader header=readHeader();
  source=(SOURCE)codec.makeIndexableSourceFromStream(initStream(inputFile,header.getHeaderEnd()));
  readNextFeature();
}

Fixed version (ground truth):
/** 
 * @param inputFile The file from which to read. Stream for reading is opened on construction. May not be null.
 * @param codec
 */
public FeatureIterator(final File inputFile,final FeatureCodec<FEATURE_TYPE,SOURCE> codec){
  if (inputFile == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.codec=codec;
  this.inputFile=inputFile;
  try {
    if (AbstractFeatureReader.hasBlockCompressedExtension(inputFile)) {
      final BlockCompressedInputStream bcs=initIndexableBlockCompressedStream(inputFile);
      source=(SOURCE)codec.makeIndexableSourceFromStream(bcs);
    }
 else {
      final PositionalBufferedStream ps=initIndexablePositionalStream(inputFile);
      source=(SOURCE)codec.makeIndexableSourceFromStream(ps);
    }
    this.codec.readHeader(source);
    readNextFeature();
  }
 catch (  final IOException e) {
    throw new TribbleException.InvalidHeader("String_Node_Str" + e.getMessage());
  }
}