nus-yam/ex-repair huggingface dataset:
Program: 41806
Project: 41806
Buggy source:
@Test @Ignore public void testAppending() throws IOException {
  int counter=0;
  String basePath=System.getProperty("String_Node_Str") + "String_Node_Str";
  ChronicleTools.deleteDirOnExit(basePath);
  for (int k=0; k < 15; k++) {
    RollingChronicle rc=new RollingChronicle(basePath,ChronicleConfig.TEST);
    ExcerptAppender appender=rc.createAppender();
    assertEquals("String_Node_Str" + k,(long)counter,appender.size());
    for (int i=0; i < 1; i++) {
      appender.startExcerpt(4);
      appender.writeInt(counter++);
      appender.finish();
      assertEquals("String_Node_Str" + k + "String_Node_Str"+ i,(long)counter,appender.size());
    }
    appender.close();
    rc.close();
  }
  RollingChronicle rc=new RollingChronicle(basePath,ChronicleConfig.TEST);
  ExcerptTailer tailer=rc.createTailer();
  for (int i=0; i < counter; i++) {
    assertTrue("String_Node_Str" + i,tailer.nextIndex());
    assertEquals(i,tailer.readInt());
    tailer.finish();
  }
  rc.close();
}

Fixed version (ground truth):
@Test @Ignore public void testAppending() throws IOException {
  int counter=0;
  String basePath=System.getProperty("String_Node_Str") + "String_Node_Str";
  ChronicleTools.deleteDirOnExit(basePath);
  for (int k=0; k < 15; k++) {
    RollingChronicle rc=new RollingChronicle(basePath,ChronicleConfig.TEST);
    ExcerptAppender appender=rc.createAppender();
    assertEquals("String_Node_Str" + k,(long)counter,appender.size());
    for (int i=0; i < ChronicleConfig.TEST.indexFileExcerpts() * 2 / 7; i++) {
      appender.startExcerpt(4);
      appender.writeInt(counter++);
      appender.finish();
      assertEquals("String_Node_Str" + k + "String_Node_Str"+ i,(long)counter,appender.size());
    }
    appender.close();
    rc.close();
  }
  RollingChronicle rc=new RollingChronicle(basePath,ChronicleConfig.TEST);
  ExcerptTailer tailer=rc.createTailer();
  for (int i=0; i < counter; i++) {
    assertTrue("String_Node_Str" + i,tailer.nextIndex());
    assertEquals(i,tailer.readInt());
    tailer.finish();
  }
  rc.close();
}
Program: 41807
Project: 41807
Buggy source:
public static void main(String... ignored) throws IOException {
  ChronicleTools.warmup();
  if (GWMain.WITH_BINDING)   PosixJNAAffinity.INSTANCE.setAffinity(1L << 5);
  String tmp=System.getProperty("String_Node_Str");
  ChronicleConfig config=ChronicleConfig.DEFAULT.clone();
  String pePath=tmp + "String_Node_Str";
  IndexedChronicle pe2gw=new IndexedChronicle(pePath,config);
  ExcerptAppender excerpt=pe2gw.createAppender();
  final Pe2GwWriter pe2GwWriter=new Pe2GwWriter(excerpt);
  Gw2PeEvents listener=new PEEvents(pe2GwWriter);
  Gw2PeReader[] readers=new Gw2PeReader[1];
  IndexedChronicle[] gw2pe=new IndexedChronicle[readers.length];
  for (int i=0; i < readers.length; i++) {
    int sourceId=i + 1;
    String gw2pePath=tmp + "String_Node_Str" + sourceId;
    gw2pe[i]=new IndexedChronicle(gw2pePath,config);
    readers[i]=new Gw2PeReader(sourceId,gw2pe[i].createTailer(),listener);
  }
  long prevProcessed=0, count=0;
  do {
    boolean readOne=false;
    for (    Gw2PeReader reader : readers) {
      readOne|=reader.readOne();
    }
    if (readOne) {
      count=0;
    }
 else     if (count++ > 1000000) {
      long processed=excerpt.index() + 1;
      if (prevProcessed != processed) {
        System.out.printf("String_Node_Str",processed);
        prevProcessed=processed;
      }
    }
  }
 while (true);
}

Fixed version (ground truth):
public static void main(String... ignored) throws IOException {
  ChronicleTools.warmup();
  if (GWMain.WITH_BINDING)   PosixJNAAffinity.INSTANCE.setAffinity(1L << 5);
  String tmp=System.getProperty("String_Node_Str");
  ChronicleConfig config=ChronicleConfig.DEFAULT.clone();
  String pePath=tmp + "String_Node_Str";
  ChronicleTools.deleteDirOnExit(pePath);
  IndexedChronicle pe2gw=new IndexedChronicle(pePath,config);
  ExcerptAppender excerpt=pe2gw.createAppender();
  final Pe2GwWriter pe2GwWriter=new Pe2GwWriter(excerpt);
  Gw2PeEvents listener=new PEEvents(pe2GwWriter);
  Gw2PeReader[] readers=new Gw2PeReader[1];
  IndexedChronicle[] gw2pe=new IndexedChronicle[readers.length];
  for (int i=0; i < readers.length; i++) {
    int sourceId=i + 1;
    String gw2pePath=tmp + "String_Node_Str" + sourceId;
    ChronicleTools.deleteDirOnExit(gw2pePath);
    gw2pe[i]=new IndexedChronicle(gw2pePath,config);
    readers[i]=new Gw2PeReader(sourceId,gw2pe[i].createTailer(),listener);
  }
  long prevProcessed=0, count=0;
  do {
    boolean readOne=false;
    for (    Gw2PeReader reader : readers) {
      readOne|=reader.readOne();
    }
    if (readOne) {
      count=0;
    }
 else     if (count++ > 1000000) {
      long processed=excerpt.index() + 1;
      if (prevProcessed != processed) {
        System.out.printf("String_Node_Str",processed);
        prevProcessed=processed;
      }
    }
  }
 while (true);
}
Program: 41808
Project: 41808
Buggy source:
@Override public void addPaddedEntry(){
  if (index != lastWrittenIndex()) {
    toEnd();
  }
  checkNewIndexLine();
  writePaddedEntry();
  loadNextDataBuffer();
  checkNewIndexLine();
  finished=true;
}

Fixed version (ground truth):
@Override public void addPaddedEntry(){
  if (index != lastWrittenIndex()) {
    toEnd();
  }
  if (index == 322)   Thread.yield();
  checkNewIndexLine();
  writePaddedEntry();
  loadNextDataBuffer();
  checkNewIndexLine();
  finished=true;
}
Program: 41809
Project: 41809
Buggy source:
void checkNewIndexLine2(){
  if ((indexPositionAddr & cacheLineMask) == 8) {
    indexBaseForLine=UNSAFE.getLongVolatile(null,indexPositionAddr - 8);
    setLmitAddr(0);
  }
}

Fixed version (ground truth):
void checkNewIndexLine2(){
}
Program: 41810
Project: 41810
Buggy source:
public boolean nextIndex(){
  return nextIndex0() || nextIndex0();
}

Fixed version (ground truth):
public boolean nextIndex(){
  checkNextLine();
  long offset=UNSAFE.getInt(null,indexPositionAddr);
  if (offset == 0)   offset=UNSAFE.getIntVolatile(null,indexPositionAddr);
  if (offset == 0) {
    return false;
  }
  index++;
  return nextIndex0(offset) || nextIndex1();
}
Program: 41813
Project: 41813
Buggy source:
@Test public void testCAD() throws Exception {
  String key="String_Node_Str";
  EtcdResponse result;
  result=this.client.set(key,"String_Node_Str");
  result=this.client.get(key);
  Assert.assertEquals("String_Node_Str",result.node.value);
  Map<String,String> params=new HashMap<String,String>();
  params.put("String_Node_Str","String_Node_Str");
  result=this.client.cad(key,params);
  Assert.assertEquals(true,result.isError());
  result=this.client.get(key);
  Assert.assertEquals("String_Node_Str",result.node.value);
}

Fixed version (ground truth):
@Test public void testCAD() throws Exception {
  String key="String_Node_Str";
  EtcdResponse result;
  result=this.client.set(key,"String_Node_Str");
  result=this.client.get(key);
  Assert.assertEquals("String_Node_Str",result.node.value);
  Map<String,String> params=new HashMap<String,String>();
  params.put("String_Node_Str","String_Node_Str");
  result=this.client.cad(key,params);
  Assert.assertEquals(true,result.isError());
  result=this.client.get(key);
  Assert.assertEquals("String_Node_Str",result.node.value);
  params.clear();
  params.put("String_Node_Str","String_Node_Str");
  result=this.client.cad(key,params);
  Assert.assertEquals("String_Node_Str",result.action);
}
Program: 41814
Project: 41814
Buggy source:
@Test public void testDeleteDir() throws Exception {
  String key=prefix + "String_Node_Str";
  EtcdResponse result;
  result=this.client.set(key,"String_Node_Str");
  Assert.assertEquals(result.node.key,key);
  Assert.assertEquals(result.node.value,"String_Node_Str");
  result=this.client.deleteDir(prefix + "String_Node_Str",false);
  Assert.assertTrue(result.isError());
  result=this.client.deleteDir(prefix + "String_Node_Str",true);
  Assert.assertEquals(result.action,"String_Node_Str");
  Assert.assertNotNull(result.prevNode);
  key=prefix + "String_Node_Str";
  result=this.client.createDir(key,null,null);
  Assert.assertEquals(key,result.node.key);
  Assert.assertTrue(result.node.dir);
  result=this.client.deleteDir(key,false);
  Assert.assertEquals(result.action,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testDeleteDir() throws Exception {
  String key=prefix + "String_Node_Str";
  EtcdResponse result;
  result=this.client.set(key,"String_Node_Str");
  Assert.assertEquals(result.node.key,key);
  Assert.assertEquals(result.node.value,"String_Node_Str");
  try {
    result=this.client.deleteDir(prefix + "String_Node_Str",false);
    Assert.fail();
  }
 catch (  EtcdClientException e) {
    Assert.assertTrue(e.isEtcdError());
  }
  result=this.client.deleteDir(prefix + "String_Node_Str",true);
  Assert.assertEquals(result.action,"String_Node_Str");
  Assert.assertNotNull(result.prevNode);
  key=prefix + "String_Node_Str";
  result=this.client.createDir(key,null,null);
  Assert.assertEquals(key,result.node.key);
  Assert.assertTrue(result.node.dir);
  result=this.client.deleteDir(key,false);
  Assert.assertEquals(result.action,"String_Node_Str");
}
Program: 41815
Project: 41815
Buggy source:
@Test public void testListDir() throws Exception {
  String key=prefix + "String_Node_Str";
  EtcdResponse result;
  result=this.client.set(key,"String_Node_Str",null);
  String keyTwo=prefix + "String_Node_Str";
  result=this.client.set(keyTwo,"String_Node_Str",null);
  List<EtcdNode> nodes=this.client.listDir(key,true);
  Assert.assertEquals((long)nodes.size(),(long)2);
  this.client.deleteDir(key,true);
}

Fixed version (ground truth):
@Test public void testListDir() throws Exception {
  String key=prefix + "String_Node_Str";
  EtcdResponse result;
  result=this.client.set(key,"String_Node_Str",null);
  String keyTwo=prefix + "String_Node_Str";
  result=this.client.set(keyTwo,"String_Node_Str",null);
  List<EtcdNode> nodes=this.client.listDir(prefix + "String_Node_Str",true);
  Assert.assertEquals((long)nodes.size(),(long)2);
  this.client.deleteDir(key,true);
}
Program: 41816
Project: 41816
Buggy source:
@Override public HttpUriRequest getRedirect(HttpRequest httpRequest,HttpResponse httpResponse,HttpContext httpContext) throws ProtocolException {
  String redirectUrl=httpResponse.getFirstHeader("String_Node_Str").getValue();
  HttpUriRequest uriRequest;
  if (httpRequest instanceof HttpPut) {
    uriRequest=new HttpPut(redirectUrl);
    ((HttpPut)uriRequest).setEntity(((HttpPut)httpRequest).getEntity());
  }
 else   if (httpRequest instanceof HttpPost) {
    uriRequest=new HttpPost(redirectUrl);
    ((HttpPost)uriRequest).setEntity(((HttpPost)httpRequest).getEntity());
  }
 else   if (httpRequest instanceof HttpDelete) {
    uriRequest=new HttpDelete(redirectUrl);
  }
 else {
    uriRequest=new HttpGet(redirectUrl);
  }
  return uriRequest;
}

Fixed version (ground truth):
@Override public HttpUriRequest getRedirect(HttpRequest httpRequest,HttpResponse httpResponse,HttpContext httpContext) throws ProtocolException {
  String redirectUrl=httpResponse.getFirstHeader("String_Node_Str").getValue();
  HttpRequestWrapper requestWrapper=(HttpRequestWrapper)httpRequest;
  HttpUriRequest uriRequest;
  HttpRequest origin=requestWrapper.getOriginal();
  if (origin instanceof HttpPut) {
    uriRequest=new HttpPut(redirectUrl);
    ((HttpPut)uriRequest).setEntity(((HttpPut)origin).getEntity());
  }
 else   if (origin instanceof HttpPost) {
    uriRequest=new HttpPost(redirectUrl);
    ((HttpPost)uriRequest).setEntity(((HttpPost)origin).getEntity());
  }
 else   if (origin instanceof HttpDelete) {
    uriRequest=new HttpDelete(redirectUrl);
  }
 else {
    uriRequest=new HttpGet(redirectUrl);
  }
  return uriRequest;
}
Program: 41817
Project: 41817
Buggy source:
private EtcdResponse execute(HttpUriRequest request) throws EtcdClientException {
  try {
    return httpClient.execute(request,new JsonResponseHandler());
  }
 catch (  IOException e) {
    throw new EtcdClientException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Execute the specific HttpUriRequest
 * @param request request instance
 * @return EtcdResponse
 * @throws EtcdClientException
 */
private EtcdResponse execute(HttpUriRequest request) throws EtcdClientException {
  try {
    return httpClient.execute(request,new JsonResponseHandler());
  }
 catch (  IOException e) {
    throw unwrap(e);
  }
}
Program: 41818
Project: 41818
Buggy source:
/** 
 * Get the value of the key
 * @param key the key
 * @return the corresponding response
 */
public EtcdResponse get(String key) throws EtcdClientException {
  URI uri=buildUriWithKeyAndParams(key,null);
  HttpGet httpGet=new HttpGet(uri);
  EtcdResponse response=execute(httpGet);
  if (response.isError()) {
    if (response.errorCode == 100) {
      return null;
    }
  }
  return response;
}

Fixed version (ground truth):
/** 
 * Get the value of the key
 * @param key the key
 * @return the corresponding response
 */
public EtcdResponse get(String key) throws EtcdClientException {
  URI uri=buildUriWithKeyAndParams(key,null);
  HttpGet httpGet;
  httpGet=new HttpGet(uri);
  return execute(httpGet);
}
Program: 41819
Project: 41819
Buggy source:
private static EtcdResponse parseResponse(String json) throws EtcdClientException {
  EtcdResponse response;
  try {
    response=gson.fromJson(json,EtcdResponse.class);
  }
 catch (  JsonParseException e) {
    throw new EtcdClientException("String_Node_Str",e);
  }
  return response;
}

Fixed version (ground truth):
private static EtcdResponse parseResponse(String json) throws EtcdClientException {
  EtcdResponse response;
  try {
    response=gson.fromJson(json,EtcdResponse.class);
    if (response.isError()) {
      throw new EtcdClientException("String_Node_Str",response);
    }
  }
 catch (  JsonParseException e) {
    throw new EtcdClientException("String_Node_Str",e);
  }
  return response;
}
Program: 41820
Project: 41820
Buggy source:
public EtcdClientException(String message,int httpStatusCode){
  super(message + "String_Node_Str" + httpStatusCode+ "String_Node_Str");
  this.httpStatusCode=httpStatusCode;
}

Fixed version (ground truth):
public EtcdClientException(String message,EtcdResponse response){
  super(message);
  this.httpStatusCode=null;
  this.response=response;
}
Program: 41821
Project: 41821
Buggy source:
@Before public void setUp() throws Exception {
  client=new EtcdClient(new URI("String_Node_Str"));
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  client=new EtcdClient(new URI("String_Node_Str"));
  prefix="String_Node_Str" + UUID.randomUUID().toString();
}
Program: 41822
Project: 41822
Buggy source:
@Override public void create(){
  assets=new AssetManager();
  String model="String_Node_Str";
  assets.load(model,Model.class);
  assets.finishLoading();
  modelInstance=new ModelInstance(assets.get(model,Model.class));
  DefaultShader.Config config=new Config();
  config.defaultCullFace=GL20.GL_NONE;
  ShaderProvider shaderProvider=new DefaultShaderProvider(config);
  modelBatch=new ModelBatch(shaderProvider);
  camera=new PerspectiveCamera();
  cameraController=new CameraInputController(camera);
  camera.position.set(10,10,10);
  camera.lookAt(0,0,0);
  Gdx.input.setInputProcessor(cameraController);
  viewport=new ScreenViewport(camera);
  ModelBuilder builder=new ModelBuilder();
  float groundSize=1000f;
  ground=new ModelInstance(builder.createRect(-groundSize,0,groundSize,groundSize,0,groundSize,groundSize,0,-groundSize,-groundSize,0,-groundSize,0,1,0,new Material(),Usage.Position | Usage.Normal),new Matrix4().setToTranslation(0,-0.01f,0));
  environment=new Environment();
  environment.set(new ColorAttribute(ColorAttribute.AmbientLight,0.4f,0.4f,0.4f,1f));
  environment.add(new DirectionalLight().set(0.8f,0.8f,0.8f,-1f,-0.8f,-0.2f));
  VirtualReality.renderer.listeners.add(this);
  VirtualReality.head.setCyclops(true);
}

Fixed version (ground truth):
@Override public void create(){
  assets=new AssetManager();
  String model="String_Node_Str";
  assets.load(model,Model.class);
  assets.finishLoading();
  modelInstance=new ModelInstance(assets.get(model,Model.class));
  DefaultShader.Config config=new Config();
  config.defaultCullFace=GL20.GL_NONE;
  ShaderProvider shaderProvider=new DefaultShaderProvider(config);
  modelBatch=new ModelBatch(shaderProvider);
  camera=new PerspectiveCamera();
  cameraController=new CameraInputController(camera);
  camera.position.set(10,10,10);
  camera.lookAt(0,0,0);
  Gdx.input.setInputProcessor(cameraController);
  viewport=new ScreenViewport(camera);
  ModelBuilder builder=new ModelBuilder();
  float groundSize=1000f;
  ground=new ModelInstance(builder.createRect(-groundSize,0,groundSize,groundSize,0,groundSize,groundSize,0,-groundSize,-groundSize,0,-groundSize,0,1,0,new Material(),Usage.Position | Usage.Normal),new Matrix4().setToTranslation(0,-0.01f,0));
  environment=new Environment();
  environment.set(new ColorAttribute(ColorAttribute.AmbientLight,0.4f,0.4f,0.4f,1f));
  environment.add(new DirectionalLight().set(0.8f,0.8f,0.8f,-1f,-0.8f,-0.2f));
  VirtualReality.renderer.listeners.add(this);
}
Program: 41824
Project: 41824
Buggy source:
public void render(){
  for (  VirtualRealityRenderListener listener : listeners) {
    listener.frameStarted();
  }
  if (VirtualReality.head.isCyclops()) {
    renderEye(VirtualReality.head.getCyclopsEye(),new Vector3());
  }
 else {
    renderEye(VirtualReality.head.getLeftEye(),new Vector3(-VirtualReality.head.getInterpupillaryDistance() / 2f,0,0));
    renderEye(VirtualReality.head.getRightEye(),new Vector3(VirtualReality.head.getInterpupillaryDistance() / 2f,0,0));
  }
  for (  VirtualRealityRenderListener listener : listeners) {
    listener.frameEnded();
  }
}

Fixed version (ground truth):
public void render(){
  for (  VirtualRealityRenderListener listener : listeners) {
    listener.frameStarted();
  }
  int screenWidth=Gdx.graphics.getWidth();
  int screenHeight=Gdx.graphics.getHeight();
  if (VirtualReality.head.isCyclops()) {
    VirtualReality.head.getCyclopsEye().update(screenWidth,screenHeight);
    renderEye(VirtualReality.head.getCyclopsEye(),new Vector3());
  }
 else {
    splitViewport.update(screenWidth,screenHeight);
    splitViewport.activateSubViewport(0,0,false);
    renderEye(VirtualReality.head.getLeftEye(),new Vector3(-VirtualReality.head.getInterpupillaryDistance() / 2f,0,0));
    splitViewport.activateSubViewport(0,1,false);
    renderEye(VirtualReality.head.getRightEye(),new Vector3(VirtualReality.head.getInterpupillaryDistance() / 2f,0,0));
  }
  for (  VirtualRealityRenderListener listener : listeners) {
    listener.frameEnded();
  }
}
Program: 41825
Project: 41825
Buggy source:
private void renderEye(Viewport eye,Vector3 eyeOffset){
  int screenWidth=Gdx.graphics.getWidth();
  int screenHeight=Gdx.graphics.getHeight();
  eye.update(screenWidth,screenHeight);
  Camera camera=eye.getCamera();
  Vector3 eyePosition=camera.position;
  eyePosition.set(VirtualReality.body.position);
  eyePosition.add(VirtualReality.body.headOffset);
  Quaternion eyeOrientation=new Quaternion();
  eyeOrientation.set(VirtualReality.head.getOrientation());
  eyeOrientation.mul(VirtualReality.body.rotation);
  eyeOffset.mul(eyeOrientation);
  eyePosition.add(eyeOffset);
  Vector3 eyeDirection=new Vector3(0,0,-1);
  eyeDirection.mul(eyeOrientation);
  Vector3 eyeUp=new Vector3(0,1,0);
  eyeUp.mul(eyeOrientation);
  camera.position.set(eyePosition);
  camera.direction.set(eyeDirection);
  camera.up.set(eyeUp);
  camera.update(true);
  for (  VirtualRealityRenderListener listener : listeners) {
    listener.render(camera);
  }
}

Fixed version (ground truth):
private void renderEye(Viewport eye,Vector3 eyeOffset){
  Camera camera=eye.getCamera();
  Vector3 eyePosition=camera.position;
  eyePosition.set(VirtualReality.body.position);
  eyePosition.add(VirtualReality.body.headOffset);
  Quaternion eyeOrientation=new Quaternion();
  eyeOrientation.set(VirtualReality.head.getOrientation());
  eyeOrientation.mul(VirtualReality.body.orientation);
  eyeOffset.mul(eyeOrientation);
  eyePosition.add(eyeOffset);
  Vector3 eyeDirection=new Vector3(0,0,-1);
  eyeDirection.mul(eyeOrientation);
  Vector3 eyeUp=new Vector3(0,1,0);
  eyeUp.mul(eyeOrientation);
  camera.position.set(eyePosition);
  camera.direction.set(eyeDirection);
  camera.up.set(eyeUp);
  camera.update(true);
  for (  VirtualRealityRenderListener listener : listeners) {
    listener.render(camera);
  }
}
Program: 41826
Project: 41826
Buggy source:
/** 
 * The default constructor 
 */
private AIController(){
  Log.v(TAG,"String_Node_Str");
  HoxApp.getApp().getAiEngine().initGame();
}

Fixed version (ground truth):
/** 
 * The default constructor 
 */
private AIController(){
  Log.v(TAG,"String_Node_Str");
  HoxApp.getApp().getAiEngine().initGame();
  final TimeInfo initialTime=new TimeInfo(Enums.DEFAULT_INITIAL_GAME_TIMES);
  timeTracker_.setInitialColor(Enums.ColorEnum.COLOR_RED);
  timeTracker_.setInitialTime(initialTime);
  timeTracker_.setBlackTime(initialTime);
  timeTracker_.setRedTime(initialTime);
  playerTracker_.setRedInfo(HoxApp.getApp().getString(R.string.you_label),"String_Node_Str");
  playerTracker_.setBlackInfo(HoxApp.getApp().getString(R.string.ai_label),"String_Node_Str");
}
Program: 41827
Project: 41827
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (DEBUG_LIFE_CYCLE)   Log.v(TAG,"String_Node_Str");
  setContentView(R.layout.activity_ai_table);
  Toolbar toolbar=(Toolbar)findViewById(R.id.my_toolbar);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (findViewById(R.id.board_container) != null) {
    if (savedInstanceState == null) {
      BoardFragment boardFragment=BoardFragment.newInstance("String_Node_Str");
      getSupportFragmentManager().beginTransaction().add(R.id.board_container,boardFragment).commit();
    }
  }
  aiController_.setBoardController(this);
  setupNewTable();
  setVolumeControlStream(SoundManager.getInstance().getStreamType());
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (DEBUG_LIFE_CYCLE)   Log.v(TAG,"String_Node_Str");
  setContentView(R.layout.activity_ai_table);
  Toolbar toolbar=(Toolbar)findViewById(R.id.my_toolbar);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (findViewById(R.id.board_container) != null) {
    if (savedInstanceState == null) {
      BoardFragment boardFragment=BoardFragment.newInstance("String_Node_Str");
      getSupportFragmentManager().beginTransaction().add(R.id.board_container,boardFragment).commit();
    }
  }
  aiController_.setBoardController(this);
  prepareTableOnCreate();
  setVolumeControlStream(SoundManager.getInstance().getStreamType());
}
Program: 41828
Project: 41828
Buggy source:
private void restoreHistoryMoves(BoardFragment boardFragment){
  List<Piece.Move> historyMoves=aiController_.getHistoryMoves();
  if (historyMoves.size() > 0) {
    Log.d(TAG,"String_Node_Str" + historyMoves.size());
    for (    Piece.Move move : historyMoves) {
      referee_.validateMove(move.fromPosition.row,move.fromPosition.column,move.toPosition.row,move.toPosition.column);
    }
    int lastGameStatus=referee_.getGameStatus();
    boardFragment.restoreMoveHistory(historyMoves,lastGameStatus);
  }
}

Fixed version (ground truth):
private void restoreHistoryMoves(BoardFragment boardFragment){
  List<Piece.Move> historyMoves=aiController_.getHistoryMoves();
  if (historyMoves.size() > 0) {
    Log.d(TAG,"String_Node_Str" + historyMoves.size());
    for (    Piece.Move move : historyMoves) {
      referee_.validateMove(move.fromPosition.row,move.fromPosition.column,move.toPosition.row,move.toPosition.column);
    }
    int lastGameStatus=referee_.getGameStatus();
    boardFragment.restoreMoveHistory(historyMoves,lastGameStatus);
    timeTracker_.start();
  }
}
Program: 41829
Project: 41829
Buggy source:
@Override public void updateBoardWithNewTableInfo(TableInfo tableInfo){
  Log.d(TAG,"String_Node_Str");
  tableId_=tableInfo.tableId;
  setAndShowTitle(tableInfo.tableId);
  invalidateOptionsMenu();
  referee_.resetGame();
  BoardFragment boardFragment=myBoardFragment_.get();
  if (boardFragment != null) {
    boardFragment.resetBoard();
  }
  PlayersFragment playersFragment=myPlayersFragment_.get();
  if (playersFragment != null) {
    playersFragment.refreshPlayersIfNeeded();
  }
}

Fixed version (ground truth):
@Override public void updateBoardWithNewTableInfo(TableInfo tableInfo){
  Log.d(TAG,"String_Node_Str");
  tableId_=tableInfo.tableId;
  setAndShowTitle(tableId_);
  invalidateOptionsMenu();
  referee_.resetGame();
  BoardFragment boardFragment=myBoardFragment_.get();
  if (boardFragment != null) {
    boardFragment.resetBoard();
  }
  PlayersFragment playersFragment=myPlayersFragment_.get();
  if (playersFragment != null) {
    playersFragment.refreshPlayersIfNeeded();
  }
}
Program: 41830
Project: 41830
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.v(TAG,"String_Node_Str");
  setContentView(R.layout.activity_network_table);
  Toolbar toolbar=(Toolbar)findViewById(R.id.my_toolbar);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  MainPagerAdapter pagerAdapter=new MainPagerAdapter(this,getSupportFragmentManager());
  viewPager_=(ViewPager)findViewById(R.id.network_table_view_pager);
  viewPager_.setAdapter(pagerAdapter);
  viewPager_.setOffscreenPageLimit(2);
  viewPager_.addOnPageChangeListener(this);
  tableController_.setBoardController(this);
  timeTracker_=tableController_.getTimeTracker();
  playerTracker_=tableController_.getPlayerTracker();
  tableId_=getIntent().getStringExtra(EXTRA_TABLE_ID);
  Log.d(TAG,"String_Node_Str" + tableId_ + "String_Node_Str");
  if (TextUtils.isEmpty(tableId_)) {
    NetworkController.getInstance().sendRequestToOpenNewTable();
  }
 else {
    NetworkController.getInstance().handleTableSelection(tableId_);
  }
  setVolumeControlStream(SoundManager.getInstance().getStreamType());
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.v(TAG,"String_Node_Str");
  setContentView(R.layout.activity_network_table);
  Toolbar toolbar=(Toolbar)findViewById(R.id.my_toolbar);
  setSupportActionBar(toolbar);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  MainPagerAdapter pagerAdapter=new MainPagerAdapter(this,getSupportFragmentManager());
  viewPager_=(ViewPager)findViewById(R.id.network_table_view_pager);
  viewPager_.setAdapter(pagerAdapter);
  viewPager_.setOffscreenPageLimit(2);
  viewPager_.addOnPageChangeListener(this);
  tableController_.setBoardController(this);
  if (savedInstanceState == null) {
    tableId_=getIntent().getStringExtra(EXTRA_TABLE_ID);
    Log.d(TAG,"String_Node_Str" + tableId_ + "String_Node_Str");
    if (TextUtils.isEmpty(tableId_)) {
      NetworkController.getInstance().sendRequestToOpenNewTable();
    }
 else {
      NetworkController.getInstance().handleTableSelection(tableId_);
    }
  }
 else {
    tableId_=NetworkController.getInstance().getMyTableId();
    Log.d(TAG,"String_Node_Str" + tableId_ + "String_Node_Str");
    setAndShowTitle(tableId_);
  }
  setVolumeControlStream(SoundManager.getInstance().getStreamType());
}
Program: 41831
Project: 41831
Buggy source:
public void loginServer(){
  loadPreferences_Account();
  networkController_.setLoginInfo(pid_,password_);
  networkController_.connectToServer();
}

Fixed version (ground truth):
public void loginServer(){
  networkController_.setLoginInfo(pid_,password_);
  networkController_.connectToServer();
}
Program: 41832
Project: 41832
Buggy source:
private void openNotificationView(){
  Log.d(TAG,"String_Node_Str");
  Intent intent=new Intent(this,ChatBubbleActivity.class);
  startActivity(intent);
  notifCount_=0;
  invalidateOptionsMenu();
}

Fixed version (ground truth):
private void openNotificationView(){
  Log.d(TAG,"String_Node_Str");
  startActivity(new Intent(this,ChatBubbleActivity.class));
  invalidateOptionsMenu();
}
Program: 41833
Project: 41833
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (DEBUG_LIFE_CYCLE)   Log.v(TAG,"String_Node_Str");
  MessageManager.getInstance().addListener(this);
  adjustScreenOnFlagBasedOnGameStatus();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (DEBUG_LIFE_CYCLE)   Log.v(TAG,"String_Node_Str");
  if (notificationMenuItem_ != null) {
    BadgeDrawable.setBadgeCount(this,notificationMenuItem_,MessageManager.getInstance().getNotificationCount());
  }
  MessageManager.getInstance().addListener(this);
  adjustScreenOnFlagBasedOnGameStatus();
}
Program: 41834
Project: 41834
Buggy source:
@Override public void onMessageReceived(MessageInfo messageInfo){
  Log.d(TAG,"String_Node_Str" + messageInfo.getId() + "String_Node_Str"+ messageInfo+ "String_Node_Str");
  if (messageInfo.type == MessageInfo.MessageType.MESSAGE_TYPE_INVITE_TO_PLAY || messageInfo.type == MessageInfo.MessageType.MESSAGE_TYPE_CHAT_PRIVATE) {
    notifCount_++;
    invalidateOptionsMenu();
  }
}

Fixed version (ground truth):
@Override public void onMessageReceived(MessageInfo messageInfo){
  Log.d(TAG,"String_Node_Str" + messageInfo.getId() + "String_Node_Str"+ messageInfo+ "String_Node_Str");
  if (MessageManager.getInstance().isNotificationType(messageInfo.type)) {
    invalidateOptionsMenu();
  }
}
Program: 41835
Project: 41835
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  Log.d(TAG,"String_Node_Str");
  getMenuInflater().inflate(R.menu.main_activity_actions,menu);
  MenuItem item=menu.findItem(R.id.action_notifications);
  LayerDrawable icon=(LayerDrawable)item.getIcon();
  BadgeDrawable.setBadgeCount(this,icon,notifCount_);
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  Log.d(TAG,"String_Node_Str");
  getMenuInflater().inflate(R.menu.main_activity_actions,menu);
  notificationMenuItem_=menu.findItem(R.id.action_notifications);
  BadgeDrawable.setBadgeCount(this,notificationMenuItem_,MessageManager.getInstance().getNotificationCount());
  return super.onCreateOptionsMenu(menu);
}
Program: 41836
Project: 41836
Buggy source:
/** 
 * A helper function to update LayerDrawable's BadgeDrawable
 */
public static void setBadgeCount(Context context,LayerDrawable icon,int count){
  BadgeDrawable badge;
  Drawable reuse=icon.findDrawableByLayerId(R.id.ic_badge);
  if (reuse != null && reuse instanceof BadgeDrawable) {
    badge=(BadgeDrawable)reuse;
  }
 else {
    badge=new BadgeDrawable(context);
  }
  badge.setCount(count);
  icon.mutate();
  icon.setDrawableByLayerId(R.id.ic_badge,badge);
}

Fixed version (ground truth):
public static void setBadgeCount(Context context,MenuItem menuItem,int count){
  if (menuItem != null) {
    LayerDrawable icon=(LayerDrawable)menuItem.getIcon();
    BadgeDrawable.setBadgeCount(context,icon,count);
  }
}
Program: 41837
Project: 41837
Buggy source:
@Override protected void onPause(){
  super.onPause();
  Log.d(TAG,"String_Node_Str");
  NetworkController.getInstance().removeListener(this);
  MessageManager.getInstance().removeListener(this);
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  Log.d(TAG,"String_Node_Str");
  MessageManager.getInstance().removeListener(this);
  NetworkController.getInstance().removeListener(this);
}
Program: 41838
Project: 41838
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str");
  if (drawerToggle_.onOptionsItemSelected(item)) {
    return true;
  }
switch (item.getItemId()) {
case R.id.action_notifications:
    openChatView();
  return true;
default :
return super.onOptionsItemSelected(item);
}
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  Log.d(TAG,"String_Node_Str");
  if (drawerToggle_.onOptionsItemSelected(item)) {
    return true;
  }
switch (item.getItemId()) {
case R.id.action_notifications:
    openNotificationView();
  return true;
default :
return super.onOptionsItemSelected(item);
}
}
Program: 41839
Project: 41839
Buggy source:
@Override protected void onResume(){
  super.onResume();
  Log.d(TAG,"String_Node_Str");
  NetworkController.getInstance().addListener(this);
  MessageManager.getInstance().addListener(this);
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  Log.d(TAG,"String_Node_Str");
  if (notificationMenuItem_ != null) {
    BadgeDrawable.setBadgeCount(this,notificationMenuItem_,MessageManager.getInstance().getNotificationCount());
  }
  MessageManager.getInstance().addListener(this);
  NetworkController.getInstance().addListener(this);
}
Program: 41840
Project: 41840
Buggy source:
@Override public void onMessageReceived(MessageInfo messageInfo){
  Log.d(TAG,"String_Node_Str" + messageInfo.getId() + "String_Node_Str"+ messageInfo+ "String_Node_Str");
  if (messageInfo.type == MessageInfo.MessageType.MESSAGE_TYPE_INVITE_TO_PLAY || messageInfo.type == MessageInfo.MessageType.MESSAGE_TYPE_CHAT_PRIVATE) {
    notifCount_++;
    invalidateOptionsMenu();
  }
}

Fixed version (ground truth):
@Override public void onMessageReceived(MessageInfo messageInfo){
  Log.d(TAG,"String_Node_Str" + messageInfo.getId() + "String_Node_Str"+ messageInfo+ "String_Node_Str");
  if (MessageManager.getInstance().isNotificationType(messageInfo.type)) {
    invalidateOptionsMenu();
  }
}
Program: 41841
Project: 41841
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  Log.d(TAG,"String_Node_Str");
  getMenuInflater().inflate(R.menu.main_activity_actions,menu);
  MenuItem item=menu.findItem(R.id.action_notifications);
  LayerDrawable icon=(LayerDrawable)item.getIcon();
  BadgeDrawable.setBadgeCount(this,icon,notifCount_);
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  Log.d(TAG,"String_Node_Str");
  getMenuInflater().inflate(R.menu.main_activity_actions,menu);
  notificationMenuItem_=menu.findItem(R.id.action_notifications);
  BadgeDrawable.setBadgeCount(this,notificationMenuItem_,MessageManager.getInstance().getNotificationCount());
  return super.onCreateOptionsMenu(menu);
}
Program: 41842
Project: 41842
Buggy source:
private void openNotificationView(){
  Log.d(TAG,"String_Node_Str");
  Intent intent=new Intent(this,ChatBubbleActivity.class);
  startActivity(intent);
  notifCount_=0;
  invalidateOptionsMenu();
}

Fixed version (ground truth):
private void openNotificationView(){
  Log.d(TAG,"String_Node_Str");
  startActivity(new Intent(this,ChatBubbleActivity.class));
  invalidateOptionsMenu();
}
Program: 41843
Project: 41843
Buggy source:
@Override protected void onResume(){
  super.onResume();
  Log.d(TAG,"String_Node_Str");
  MessageManager.getInstance().addListener(this);
  adjustScreenOnFlagBasedOnGameStatus();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  Log.d(TAG,"String_Node_Str");
  if (notificationMenuItem_ != null) {
    BadgeDrawable.setBadgeCount(this,notificationMenuItem_,MessageManager.getInstance().getNotificationCount());
  }
  MessageManager.getInstance().addListener(this);
  adjustScreenOnFlagBasedOnGameStatus();
}
Program: 41844
Project: 41844
Buggy source:
@Override public void onMessageReceived(MessageInfo messageInfo){
  Log.d(TAG,"String_Node_Str" + messageInfo.getId() + "String_Node_Str"+ messageInfo+ "String_Node_Str");
  if (messageInfo.type == MessageInfo.MessageType.MESSAGE_TYPE_INVITE_TO_PLAY || messageInfo.type == MessageInfo.MessageType.MESSAGE_TYPE_CHAT_PRIVATE) {
    notifCount_++;
    invalidateOptionsMenu();
  }
 else   if (messageInfo.type == MessageInfo.MessageType.MESSAGE_TYPE_CHAT_IN_TABLE) {
    if (chatSheet_ != null) {
      chatSheet_.addNewMessage(messageInfo);
      messageInfo.markRead();
      return;
    }
    int currentPageIndex=viewPager_.getCurrentItem();
    if (currentPageIndex == MainPagerAdapter.POSITION_BOARD) {
      BoardFragment boardFragment=myBoardFragment_.get();
      if (boardFragment != null) {
        int unreadCount=MessageManager.getInstance().getUnreadCount(MessageInfo.MessageType.MESSAGE_TYPE_CHAT_IN_TABLE);
        Log.d(TAG,"String_Node_Str" + unreadCount);
        boardFragment.setTableMessageCount(unreadCount);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onMessageReceived(MessageInfo messageInfo){
  Log.d(TAG,"String_Node_Str" + messageInfo.getId() + "String_Node_Str"+ messageInfo+ "String_Node_Str");
  if (MessageManager.getInstance().isNotificationType(messageInfo.type)) {
    invalidateOptionsMenu();
  }
 else   if (messageInfo.type == MessageInfo.MessageType.MESSAGE_TYPE_CHAT_IN_TABLE) {
    if (chatSheet_ != null) {
      chatSheet_.addNewMessage(messageInfo);
      messageInfo.markRead();
      return;
    }
    int currentPageIndex=viewPager_.getCurrentItem();
    if (currentPageIndex == MainPagerAdapter.POSITION_BOARD) {
      BoardFragment boardFragment=myBoardFragment_.get();
      if (boardFragment != null) {
        int unreadCount=MessageManager.getInstance().getUnreadCount(MessageInfo.MessageType.MESSAGE_TYPE_CHAT_IN_TABLE);
        Log.d(TAG,"String_Node_Str" + unreadCount);
        boardFragment.setTableMessageCount(unreadCount);
      }
    }
  }
}
Program: 41845
Project: 41845
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  Log.d(TAG,"String_Node_Str");
  getMenuInflater().inflate(R.menu.main_activity_actions,menu);
  MenuItem item=menu.findItem(R.id.action_notifications);
  LayerDrawable icon=(LayerDrawable)item.getIcon();
  BadgeDrawable.setBadgeCount(this,icon,notifCount_);
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  Log.d(TAG,"String_Node_Str");
  getMenuInflater().inflate(R.menu.main_activity_actions,menu);
  notificationMenuItem_=menu.findItem(R.id.action_notifications);
  BadgeDrawable.setBadgeCount(this,notificationMenuItem_,MessageManager.getInstance().getNotificationCount());
  return super.onCreateOptionsMenu(menu);
}
Program: 41846
Project: 41846
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  if (DEBUG_LIFE_CYCLE)   Log.d(TAG,"String_Node_Str" + boardType_ + "String_Node_Str"+ savedInstanceState);
  final View view=inflater.inflate(R.layout.fragment_main,container,false);
  boardView_=(BoardView)view.findViewById(R.id.board_view);
  messageBadgeText_=(TextView)view.findViewById(R.id.message_badge_text);
  topPlayerLabel=(TextView)view.findViewById(R.id.top_player_label);
  bottomPlayerLabel=(TextView)view.findViewById(R.id.bottom_player_label);
  topPlayerButton=(Button)view.findViewById(R.id.top_button);
  bottomPlayerButton=(Button)view.findViewById(R.id.bottom_button);
  topGameTimeView=(TextView)view.findViewById(R.id.top_game_time);
  topMoveTimeView=(TextView)view.findViewById(R.id.top_move_time);
  bottomGameTimeView=(TextView)view.findViewById(R.id.bottom_game_time);
  bottomMoveTimeView=(TextView)view.findViewById(R.id.bottom_move_time);
  if (HoxApp.getApp().isGameOver()) {
    final Enums.GameStatus gameStatus=HoxApp.getApp().getGameStatus();
    Log.d(TAG,"String_Node_Str" + gameStatus);
    boardView_.onGameEnded(gameStatus);
  }
  boardView_.invalidate();
  setOnClickHandlers(view);
  listener_.onBoardFragment_CreateView(this);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  if (DEBUG_LIFE_CYCLE)   Log.d(TAG,"String_Node_Str" + boardType_ + "String_Node_Str"+ savedInstanceState);
  final View view=inflater.inflate(R.layout.fragment_main,container,false);
  boardView_=(BoardView)view.findViewById(R.id.board_view);
  messageBadgeText_=(TextView)view.findViewById(R.id.message_badge_text);
  topPlayerLabel=(TextView)view.findViewById(R.id.top_player_label);
  bottomPlayerLabel=(TextView)view.findViewById(R.id.bottom_player_label);
  topPlayerButton=(Button)view.findViewById(R.id.top_button);
  bottomPlayerButton=(Button)view.findViewById(R.id.bottom_button);
  topGameTimeView=(TextView)view.findViewById(R.id.top_game_time);
  topMoveTimeView=(TextView)view.findViewById(R.id.top_move_time);
  bottomGameTimeView=(TextView)view.findViewById(R.id.bottom_game_time);
  bottomMoveTimeView=(TextView)view.findViewById(R.id.bottom_move_time);
  boardView_.invalidate();
  setOnClickHandlers(view);
  listener_.onBoardFragment_CreateView(this);
  return view;
}
Program: 41847
Project: 41847
Buggy source:
private void onGameOver(Canvas canvas){
  canvas.drawText(this.getContext().getString(R.string.game_over_text),startP_ + cellSize_ * 2.5f,startP_ + cellSize_ * 4.7f,noticePaint_);
}

Fixed version (ground truth):
private void onGameOver(Canvas canvas){
  canvas.drawText(getContext().getString(R.string.game_over_text),startP_ + cellSize_ * 2.5f,startP_ + cellSize_ * 4.7f,noticePaint_);
}
Program: 41848
Project: 41848
Buggy source:
private void drawReplayStatus(Canvas canvas){
  canvas.drawText(HoxApp.getApp().getString(R.string.replay_text,historyIndex_ + 1,historyMoves_.size()),startP_ + cellSize_ * 2.5f,startP_ + cellSize_ * 4.7f,noticePaint_);
}

Fixed version (ground truth):
private void drawReplayStatus(Canvas canvas){
  canvas.drawText(getContext().getString(R.string.replay_text,historyIndex_ + 1,historyMoves_.size()),startP_ + cellSize_ * 2.5f,startP_ + cellSize_ * 4.7f,noticePaint_);
}
Program: 41849
Project: 41849
Buggy source:
@Override public void onBoardFragment_CreateView(BoardFragment fragment){
  Log.d(TAG,"String_Node_Str");
  myBoardFragment_=new WeakReference<BoardFragment>(fragment);
  BoardFragment boardFragment=myBoardFragment_.get();
  if (boardFragment != null) {
    boardFragment.setBoardEventListener(this);
    boardFragment.setupUIForTimeTracker(timeTracker_);
    boardFragment.setupUIForPlayerTracker(playerTracker_);
    timeTracker_.syncUI();
    playerTracker_.syncUI();
    restoreHistoryMoves(boardFragment);
  }
}

Fixed version (ground truth):
@Override public void onBoardFragment_CreateView(BoardFragment fragment){
  Log.d(TAG,"String_Node_Str");
  myBoardFragment_=new WeakReference<BoardFragment>(fragment);
  BoardFragment boardFragment=myBoardFragment_.get();
  if (boardFragment != null) {
    boardFragment.setBoardEventListener(this);
    boardFragment.setupUIForTimeTracker(timeTracker_);
    boardFragment.setupUIForPlayerTracker(playerTracker_);
    timeTracker_.syncUI();
    playerTracker_.syncUI();
    restoreHistoryMoves(boardFragment);
    if (HoxApp.getApp().getNetworkController().isGameOver()) {
      final Enums.GameStatus gameStatus=HoxApp.getApp().getGameStatus();
      Log.d(TAG,"String_Node_Str" + Utils.gameStatusToString(gameStatus));
      boardFragment.onGameEnded(gameStatus);
    }
  }
}
Program: 41850
Project: 41850
Buggy source:
private void restoreHistoryMoves(BoardFragment boardFragment){
  List<Piece.Move> historyMoves=referee_.getHistoryMoves();
  if (historyMoves.size() > 0) {
    Log.d(TAG,"String_Node_Str" + historyMoves.size());
    Piece.Move[] moves=historyMoves.toArray(new Piece.Move[historyMoves.size()]);
    for (    Piece.Move move : moves) {
      referee_.validateMove(move.fromPosition.row,move.fromPosition.column,move.toPosition.row,move.toPosition.column);
    }
    int lastGameStatus=referee_.getGameStatus();
    boardFragment.restoreMoveHistory(historyMoves,lastGameStatus);
  }
}

Fixed version (ground truth):
private void restoreHistoryMoves(BoardFragment boardFragment){
  List<Piece.Move> historyMoves=referee_.getHistoryMoves();
  if (historyMoves.size() > 0) {
    Log.d(TAG,"String_Node_Str" + historyMoves.size());
    Piece.Move[] moves=historyMoves.toArray(new Piece.Move[historyMoves.size()]);
    referee_.resetGame();
    for (    Piece.Move move : moves) {
      referee_.validateMove(move.fromPosition.row,move.fromPosition.column,move.toPosition.row,move.toPosition.column);
    }
    int lastGameStatus=referee_.getGameStatus();
    boardFragment.restoreMoveHistory(historyMoves,lastGameStatus);
  }
}
Program: 41851
Project: 41851
Buggy source:
public void reverseView(){
  Log.d(TAG,"String_Node_Str");
  isBlackOnTop_=!isBlackOnTop_;
  boardView_.reverseView();
  HoxApp.getApp().getTimeTracker().reverseView();
  HoxApp.getApp().getPlayerTracker().reverseView();
}

Fixed version (ground truth):
private void reverseView(){
  Log.d(TAG,"String_Node_Str" + isBlackOnTop_);
  boardView_.reverseView();
  HoxApp.getApp().getTimeTracker().reverseView();
  HoxApp.getApp().getPlayerTracker().reverseView();
}
Program: 41853
Project: 41853
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (DEBUG_LIFE_CYCLE)   Log.v(TAG,"String_Node_Str");
  if (getArguments() != null) {
    boardType_=getArguments().getString(ARG_BOARD_TYPE);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (DEBUG_LIFE_CYCLE)   Log.v(TAG,"String_Node_Str" + "String_Node_Str" + savedInstanceState);
  if (getArguments() != null) {
    boardType_=getArguments().getString(ARG_BOARD_TYPE);
  }
}
Program: 41854
Project: 41854
Buggy source:
public void onLocalPlayerJoined(Enums.ColorEnum myColor){
  if ((myColor == Enums.ColorEnum.COLOR_RED && !isBlackOnTop_) || (myColor == Enums.ColorEnum.COLOR_BLACK && isBlackOnTop_)) {
    reverseView();
  }
}

Fixed version (ground truth):
public void onLocalPlayerJoined(Enums.ColorEnum myColor){
  Log.d(TAG,"String_Node_Str" + myColor + "String_Node_Str"+ isBlackOnTop_);
  if ((myColor == Enums.ColorEnum.COLOR_RED && !isBlackOnTop_) || (myColor == Enums.ColorEnum.COLOR_BLACK && isBlackOnTop_)) {
    isBlackOnTop_=!isBlackOnTop_;
    reverseView();
  }
}
Program: 41855
Project: 41855
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  if (DEBUG_LIFE_CYCLE)   Log.v(TAG,"String_Node_Str");
  if (savedInstanceState != null) {
    boolean isBlackOnTop=savedInstanceState.getBoolean(STATE_IS_BLACK_ON_TOP,isBlackOnTop_);
    if (!isBlackOnTop) {
      reverseView();
    }
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  if (DEBUG_LIFE_CYCLE)   Log.v(TAG,"String_Node_Str" + "String_Node_Str" + savedInstanceState);
  if (savedInstanceState != null) {
    isBlackOnTop_=savedInstanceState.getBoolean(STATE_IS_BLACK_ON_TOP,isBlackOnTop_);
    Log.d(TAG,"String_Node_Str" + isBlackOnTop_);
  }
  if (!isBlackOnTop_) {
    reverseView();
  }
}
Program: 41857
Project: 41857
Buggy source:
public void onPlayerLeave(String pid){
  final String myPid=HoxApp.getApp().getMyPid();
  if (myPid.equals(pid)) {
  }
 else {
    if (blackPlayer_.hasPid(pid)) {
      blackPlayer_=new PlayerInfo();
    }
 else     if (redPlayer_.hasPid(pid)) {
      redPlayer_=new PlayerInfo();
    }
  }
}

Fixed version (ground truth):
public void onPlayerLeave(String pid){
  final String myPid=HoxApp.getApp().getMyPid();
  if (myPid.equals(pid)) {
  }
 else {
    if (blackPlayer_.hasPid(pid)) {
      blackPlayer_=new PlayerInfo();
    }
 else     if (redPlayer_.hasPid(pid)) {
      redPlayer_=new PlayerInfo();
    }
 else {
      observers_.remove(pid);
    }
  }
}
Program: 41858
Project: 41858
Buggy source:
public void onPlayerJoin(String pid,String rating,Enums.ColorEnum playerColor){
  if (blackPlayer_.hasPid(pid)) {
    blackPlayer_=new PlayerInfo();
  }
 else   if (redPlayer_.hasPid(pid)) {
    redPlayer_=new PlayerInfo();
  }
switch (playerColor) {
case COLOR_BLACK:
    blackPlayer_=new PlayerInfo(pid,rating);
  break;
case COLOR_RED:
redPlayer_=new PlayerInfo(pid,rating);
break;
case COLOR_NONE:
default :
break;
}
}

Fixed version (ground truth):
public void onPlayerJoin(String pid,String rating,Enums.ColorEnum playerColor){
  if (blackPlayer_.hasPid(pid)) {
    blackPlayer_=new PlayerInfo();
  }
 else   if (redPlayer_.hasPid(pid)) {
    redPlayer_=new PlayerInfo();
  }
switch (playerColor) {
case COLOR_BLACK:
    blackPlayer_=new PlayerInfo(pid,rating);
  observers_.remove(pid);
break;
case COLOR_RED:
redPlayer_=new PlayerInfo(pid,rating);
observers_.remove(pid);
break;
case COLOR_NONE:
observers_.put(pid,new PlayerInfo(pid,rating));
break;
default :
break;
}
}