nus-yam/ex-repair huggingface dataset:
Program: 179494
Project: 179494
Buggy source:
private List<View> generatePage(final LibraryResultsPage page,JSONObject results) throws JSONException {
  LayoutInflater layoutInflater=(LayoutInflater)page.getApplication().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  LinearLayout libraryResultsTemplate=(LinearLayout)layoutInflater.inflate(R.layout.library_results_template,page.getContentLayout(),false);
  page.getContentLayout().addView(libraryResultsTemplate);
  List<View> outputs=new ArrayList<View>();
  final JSONObject jsonPage=results.getJSONObject("String_Node_Str");
  final LinearLayout resultsLayout=(LinearLayout)page.findViewById(R.id.resultsLayout);
  final TextView resultsNo=(TextView)page.findViewById(R.id.libraryResultsNo);
  populateResults(page,getNextResultsPage(page),resultsLayout,resultsNo);
  Button nextButton=(Button)page.findViewById(R.id.moreButton);
  nextButton.setEnabled(false);
  if (jsonPage.getBoolean("String_Node_Str")) {
    nextButton.setEnabled(true);
    nextButton.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        new LibraryNextPageTask(page,resultsLayout,resultsNo,false).execute();
      }
    }
);
  }
  return outputs;
}

Fixed version (ground truth):
private List<View> generatePage(final LibraryResultsPage page,JSONObject results) throws JSONException {
  LayoutInflater layoutInflater=(LayoutInflater)page.getApplication().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  LinearLayout libraryResultsTemplate=(LinearLayout)layoutInflater.inflate(R.layout.library_results_template,page.getContentLayout(),false);
  page.getContentLayout().addView(libraryResultsTemplate);
  List<View> outputs=new ArrayList<View>();
  final JSONObject jsonPage=results.getJSONObject("String_Node_Str");
  final LinearLayout resultsLayout=(LinearLayout)page.findViewById(R.id.resultsLayout);
  final TextView resultsNo=(TextView)page.findViewById(R.id.libraryResultsNo);
  populateResults(page,getNextResultsPage(page),resultsLayout,resultsNo);
  Button nextButton=(Button)page.findViewById(R.id.moreButton);
  nextButton.setEnabled(false);
  System.out.println();
  if (jsonPage.getBoolean("String_Node_Str") & jsonPage.getInt("String_Node_Str") > 1) {
    nextButton.setEnabled(true);
    nextButton.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        new LibraryNextPageTask(page,resultsLayout,resultsNo,false).execute();
      }
    }
);
  }
  return outputs;
}
Program: 179496
Project: 179496
Buggy source:
public void onLocationChanged(Location location){
  display.updateLocation(location);
  NetworkMessageMedium msg=new NetworkMessageMedium("String_Node_Str");
  msg.doubles.add(location.getLatitude());
  msg.doubles.add(location.getLongitude());
  networkBinder.sendGameUpdate(msg);
  Regions newRegion=checkRegion(location);
  if (currentRegion != newRegion) {
    foundPokeInRegion=false;
    if (newRegion == Regions.POKEMART) {
    }
 else     if (newRegion == Regions.POKEMON_CENTER) {
      for (      Pokemon p : G.player.pokemon) {
        p.setHP(p.getTotalHP());
        p.restorePP();
      }
      display.showToast("String_Node_Str");
      display.showNoPokemonAlert(false);
      G.player.playerState=PlayerState.AVAILABLE;
      networkBinder.sendGameUpdate(new NetworkMessage("String_Node_Str"));
    }
  }
  currentRegion=newRegion;
}

Fixed version (ground truth):
public void onLocationChanged(Location location){
  display.updateLocation(location);
  NetworkMessageMedium msg=new NetworkMessageMedium("String_Node_Str");
  msg.doubles.add(location.getLatitude());
  msg.doubles.add(location.getLongitude());
  if (networkBinder != null)   networkBinder.sendGameUpdate(msg);
  Regions newRegion=checkRegion(location);
  if (currentRegion != newRegion) {
    foundPokeInRegion=false;
    if (newRegion == Regions.POKEMART) {
    }
 else     if (newRegion == Regions.POKEMON_CENTER) {
      for (      Pokemon p : G.player.pokemon) {
        p.setHP(p.getTotalHP());
        p.restorePP();
      }
      display.showToast("String_Node_Str");
      display.showNoPokemonAlert(false);
      G.player.playerState=PlayerState.AVAILABLE;
      if (networkBinder != null)       networkBinder.sendGameUpdate(new NetworkMessage("String_Node_Str"));
    }
  }
  currentRegion=newRegion;
}
Program: 179499
Project: 179499
Buggy source:
private void connectToServer(){
  boolean success=true;
  try {
    Inet4Address hostAddress=(Inet4Address)InetAddress.getByName(NetworkVariables.hostname);
    socket=new Socket(hostAddress,NetworkVariables.port);
    in=socket.getInputStream();
    out=new NetworkWriteThread(socket);
    out.start();
    startLatencyLogger();
    Looper.loop();
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionEstablishedListener.class);
  }
 catch (  UnknownHostException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    success=false;
  }
catch (  IOException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str");
    success=false;
  }
 finally {
    if (!success) {
      fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionFailedListener.class);
    }
 else {
      connected=true;
    }
  }
  Log.i(NetworkVariables.TAG,"String_Node_Str");
}

Fixed version (ground truth):
private void connectToServer(){
  boolean success=true;
  try {
    Inet4Address hostAddress=(Inet4Address)InetAddress.getByName(NetworkVariables.hostname);
    socket=new Socket(hostAddress,NetworkVariables.port);
    in=socket.getInputStream();
    out=new NetworkWriteThread(socket);
    out.start();
    startLatencyLogger();
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionEstablishedListener.class);
  }
 catch (  UnknownHostException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    success=false;
  }
catch (  IOException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str");
    success=false;
  }
 finally {
    if (!success) {
      fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionFailedListener.class);
    }
 else {
      connected=true;
    }
  }
  Log.i(NetworkVariables.TAG,"String_Node_Str");
}
Program: 179500
Project: 179500
Buggy source:
public void shutdownThread(){
  try {
    Log.d(NetworkVariables.TAG,"String_Node_Str");
    isRunning=false;
    if (out != null)     out.shutdownThread();
    stopOperation=true;
    this.interrupt();
    if (socket != null)     socket.close();
    connected=false;
  }
 catch (  IOException e) {
    Log.w(NetworkVariables.TAG,"String_Node_Str" + e);
  }
 finally {
    hasCompletedOperation=true;
    Looper.myLooper().quit();
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionLostListener.class);
  }
}

Fixed version (ground truth):
public void shutdownThread(){
  try {
    Log.d(NetworkVariables.TAG,"String_Node_Str");
    isRunning=false;
    if (out != null)     out.shutdownThread();
    stopOperation=true;
    this.interrupt();
    if (socket != null)     socket.close();
    connected=false;
  }
 catch (  IOException e) {
    Log.w(NetworkVariables.TAG,"String_Node_Str" + e);
  }
 finally {
    hasCompletedOperation=true;
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionLostListener.class);
  }
}
Program: 179501
Project: 179501
Buggy source:
/** 
 * Asynchronously connects to the server
 */
public void connectToServerAsync(){
  if (!connected) {
    if (!this.isAlive())     this.start();
  }
}

Fixed version (ground truth):
/** 
 * Asynchronously connects to the server
 */
public void connectToServerAsync(){
  connectToManager();
  if (!connected) {
    if (!this.isAlive())     this.start();
  }
}
Program: 179502
Project: 179502
Buggy source:
/** 
 * Starts the latency logging as well as the data networks logging.
 */
private void startLatencyLogger(){
  manager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  manager.listen(new DataNetworkListener(this),DataNetworkListener.LISTEN_DATA_CONNECTION_STATE);
  Timer t=new Timer();
  t.schedule(new TimerTask(){
    @Override public void run(){
      if (connected) {
        requestNetworkLatency();
      }
    }
  }
,0,1000);
}

Fixed version (ground truth):
/** 
 * Starts the latency logging as well as the data networks logging.
 */
private void startLatencyLogger(){
  Timer t=new Timer();
  t.schedule(new TimerTask(){
    @Override public void run(){
      if (connected) {
        requestNetworkLatency();
      }
    }
  }
,0,1000);
}
Program: 179504
Project: 179504
Buggy source:
private void connectToServer(){
  boolean success=true;
  try {
    Inet4Address hostAddress=(Inet4Address)InetAddress.getByName(NetworkVariables.hostname);
    socket=new Socket(hostAddress,NetworkVariables.port);
    in=socket.getInputStream();
    out=new NetworkWriteThread(socket);
    out.start();
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionEstablishedListener.class);
  }
 catch (  UnknownHostException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    success=false;
  }
catch (  IOException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str");
    success=false;
  }
 finally {
    if (!success) {
      fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionFailedListener.class);
    }
 else {
      connected=true;
    }
  }
  Log.i(NetworkVariables.TAG,"String_Node_Str");
}

Fixed version (ground truth):
private void connectToServer(){
  boolean success=true;
  try {
    Inet4Address hostAddress=(Inet4Address)InetAddress.getByName(NetworkVariables.hostname);
    socket=new Socket(hostAddress,NetworkVariables.port);
    in=socket.getInputStream();
    out=new NetworkWriteThread(socket);
    out.start();
    startLatencyLogger();
    Looper.loop();
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionEstablishedListener.class);
  }
 catch (  UnknownHostException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    success=false;
  }
catch (  IOException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str");
    success=false;
  }
 finally {
    if (!success) {
      fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionFailedListener.class);
    }
 else {
      connected=true;
    }
  }
  Log.i(NetworkVariables.TAG,"String_Node_Str");
}
Program: 179505
Project: 179505
Buggy source:
public void shutdownThread(){
  try {
    Log.d(NetworkVariables.TAG,"String_Node_Str");
    isRunning=false;
    if (out != null)     out.shutdownThread();
    stopOperation=true;
    this.interrupt();
    if (socket != null)     socket.close();
    connected=false;
  }
 catch (  IOException e) {
    Log.w(NetworkVariables.TAG,"String_Node_Str" + e);
  }
 finally {
    hasCompletedOperation=true;
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionLostListener.class);
  }
}

Fixed version (ground truth):
public void shutdownThread(){
  try {
    Log.d(NetworkVariables.TAG,"String_Node_Str");
    isRunning=false;
    if (out != null)     out.shutdownThread();
    stopOperation=true;
    this.interrupt();
    if (socket != null)     socket.close();
    connected=false;
  }
 catch (  IOException e) {
    Log.w(NetworkVariables.TAG,"String_Node_Str" + e);
  }
 finally {
    hasCompletedOperation=true;
    Looper.myLooper().quit();
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionLostListener.class);
  }
}
Program: 179506
Project: 179506
Buggy source:
/** 
 * Asynchronously connects to the server
 */
public void connectToServerAsync(){
  if (!connected) {
    startLatencyLogger();
    this.start();
  }
}

Fixed version (ground truth):
/** 
 * Asynchronously connects to the server
 */
public void connectToServerAsync(){
  if (!connected) {
    if (!this.isAlive())     this.start();
  }
}
Program: 179507
Project: 179507
Buggy source:
/** 
 * Starts the latency logging as well as the data networks logging.
 */
private void startLatencyLogger(){
  Timer t=new Timer();
  t.schedule(new TimerTask(){
    @Override public void run(){
      if (connected) {
        requestNetworkLatency();
      }
    }
  }
,0,1000);
  manager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  manager.listen(new DataNetworkListener(this),DataNetworkListener.LISTEN_DATA_CONNECTION_STATE);
}

Fixed version (ground truth):
/** 
 * Starts the latency logging as well as the data networks logging.
 */
private void startLatencyLogger(){
  manager=(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
  manager.listen(new DataNetworkListener(this),DataNetworkListener.LISTEN_DATA_CONNECTION_STATE);
  Timer t=new Timer();
  t.schedule(new TimerTask(){
    @Override public void run(){
      if (connected) {
        requestNetworkLatency();
      }
    }
  }
,0,1000);
}
Program: 179510
Project: 179510
Buggy source:
public void shutdownThread(){
  try {
    Log.d(NetworkVariables.TAG,"String_Node_Str");
    isRunning=false;
    if (out != null)     out.shutdownThread();
    stopOperation=true;
    this.interrupt();
    if (socket != null)     socket.close();
    connected=false;
  }
 catch (  IOException e) {
    Log.w(NetworkVariables.TAG,"String_Node_Str" + e);
  }
 finally {
    hasCompletedOperation=true;
  }
}

Fixed version (ground truth):
public void shutdownThread(){
  try {
    Log.d(NetworkVariables.TAG,"String_Node_Str");
    isRunning=false;
    if (out != null)     out.shutdownThread();
    stopOperation=true;
    this.interrupt();
    if (socket != null)     socket.close();
    connected=false;
  }
 catch (  IOException e) {
    Log.w(NetworkVariables.TAG,"String_Node_Str" + e);
  }
 finally {
    hasCompletedOperation=true;
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionLostListener.class);
  }
}
Program: 179517
Project: 179517
Buggy source:
public void handleMessage(Message msg){
  tv.append("String_Node_Str");
switch (NetworkComBinder.EventType.values()[msg.what]) {
case CONNECTION_ESTABLISHED:
    tv.append("String_Node_Str");
  break;
case CONNECTION_LOST:
tv.append("String_Node_Str");
break;
case CONNECTION_FAILED:
tv.append("String_Node_Str");
break;
case LATENCY_UPDATE_RECEIVED:
tv.append("String_Node_Str" + ((NetworkEvent)msg.obj).getMessage() + "String_Node_Str");
int latency=((Long)((NetworkEvent)msg.obj).getMessage()).intValue();
if (latency > highest) highest=latency;
if (latency < lowest) lowest=latency;
total+=latency;
if (pingsPerformed == 20) {
tv.append("String_Node_Str" + highest + "String_Node_Str"+ lowest+ "String_Node_Str"+ (total / 20));
}
break;
default :
tv.append("String_Node_Str" + NetworkComBinder.EventType.values()[msg.what] + "String_Node_Str");
}
}

Fixed version (ground truth):
public void handleMessage(Message msg){
  tv.append("String_Node_Str");
switch (NetworkComBinder.EventType.values()[msg.what]) {
case CONNECTION_ESTABLISHED:
    tv.append("String_Node_Str");
  break;
case CONNECTION_LOST:
tv.append("String_Node_Str");
break;
case CONNECTION_FAILED:
tv.append("String_Node_Str");
break;
case LATENCY_UPDATE_RECEIVED:
tv.append("String_Node_Str" + ((NetworkEvent)msg.obj).getMessage() + "String_Node_Str");
int latency=((Long)((NetworkEvent)msg.obj).getMessage()).intValue();
if (latency > highest) highest=latency;
if (latency < lowest) lowest=latency;
total+=latency;
if (pingsPerformed == 20) {
tv.append("String_Node_Str" + highest + "String_Node_Str"+ lowest+ "String_Node_Str"+ (total / 20)+ "String_Node_Str");
}
 else if (pingsPerformed == 2) {
NetworkMessageMedium medMessage=new NetworkMessageMedium("String_Node_Str");
medMessage.doubles.add(18.5);
medMessage.doubles.add(32.5);
binder.sendGameUpdate(medMessage);
}
 else if (pingsPerformed == 5) {
binder.sendGameStateRequest(new NetworkMessage("String_Node_Str"));
tv.append("String_Node_Str");
}
break;
case GAMESTATE_RECEIVED:
NetworkMessage mMsg=(NetworkMessage)(((NetworkEvent)msg.obj).getMessage());
if (mMsg.getMessage().equals("String_Node_Str")) {
tv.append("String_Node_Str");
if (((NetworkMessageLarge)mMsg).objectDict.containsKey("String_Node_Str")) {
Object pl=((NetworkMessageLarge)mMsg).objectDict.get("String_Node_Str");
if (pl instanceof ArrayList<?>) {
ArrayList<LokemonPotion> players=(ArrayList<LokemonPotion>)pl;
tv.append("String_Node_Str" + players.size() + "String_Node_Str");
}
 else {
tv.append("String_Node_Str");
}
}
 else {
tv.append("String_Node_Str");
}
}
 else {
tv.append("String_Node_Str" + mMsg.getMessage() + "String_Node_Str");
}
break;
default :
tv.append("String_Node_Str" + NetworkComBinder.EventType.values()[msg.what] + "String_Node_Str");
}
}
Program: 179520
Project: 179520
Buggy source:
public LokemonPlayer(){
}

Fixed version (ground truth):
public LokemonPlayer(){
  playerID=-1;
  playerName="String_Node_Str";
  busy=false;
  avatar=0;
  position=new Location();
}
Program: 179521
Project: 179521
Buggy source:
public LokemonPlayer(){
}

Fixed version (ground truth):
public LokemonPlayer(){
  playerID=-1;
  playerName="String_Node_Str";
  busy=false;
  avatar=0;
  position=new Location();
}
Program: 179522
Project: 179522
Buggy source:
public LokemonPotion(){
}

Fixed version (ground truth):
public LokemonPotion(){
  type=PotionType.HEALTH;
  id=-1;
  position=new Location();
}
Program: 179523
Project: 179523
Buggy source:
public void onServiceConnected(ComponentName name,IBinder service){
  binder=(NetworkComBinder)service;
  networkBound=true;
  tv.append("String_Node_Str");
  binder.registerMessenger(eventMessenger);
  if (!binder.isConnectedToServer())   binder.ConnectToServer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      if (pingsPerformed < 20) {
        if (networkBound)         binder.requestLatency();
        pingsPerformed++;
      }
 else {
        this.cancel();
      }
    }
  }
,recurranceDelay * 1000,recurranceDelay * 200);
}

Fixed version (ground truth):
public void onServiceConnected(ComponentName name,IBinder service){
  binder=(NetworkComBinder)service;
  networkBound=true;
  tv.append("String_Node_Str");
  binder.registerMessenger(eventMessenger);
  if (!binder.isConnectedToServer())   binder.ConnectToServer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      if (pingsPerformed < 20) {
        if (networkBound)         binder.requestLatency();
        pingsPerformed++;
      }
 else {
        this.cancel();
      }
    }
  }
,recurranceDelay * 1000,recurranceDelay * 1000);
}
Program: 179525
Project: 179525
Buggy source:
public void EventOccured(NetworkEvent e){
  System.out.println("String_Node_Str" + ((NetworkMessage)e.getMessage()).getMessage());
}

Fixed version (ground truth):
public void EventOccured(NetworkEvent e){
  System.out.println("String_Node_Str" + ((NetworkMessage)e.getMessage()).getMessage());
  ServerVariables.playerThreadMap.get(player.getPlayerID()).shutdownThread();
  LokemonServerVariables.playerList.remove(player);
}
Program: 179528
Project: 179528
Buggy source:
public void handleMessage(Message msg){
  tv.append("String_Node_Str");
switch (NetworkComBinder.EventType.values()[msg.what]) {
case CONNECTION_ESTABLISHED:
    tv.append("String_Node_Str");
  break;
case CONNECTION_LOST:
tv.append("String_Node_Str");
break;
case CONNECTION_FAILED:
tv.append("String_Node_Str");
case LATENCY_UPDATE_RECEIVED:
tv.append("String_Node_Str" + ((NetworkEvent)msg.obj).getMessage() + "String_Node_Str");
int latency=((Long)((NetworkEvent)msg.obj).getMessage()).intValue();
if (latency > highest) highest=latency;
if (latency < lowest) lowest=latency;
total+=latency;
if (pingsPerformed == 20) {
tv.append("String_Node_Str" + highest + "String_Node_Str"+ lowest+ "String_Node_Str"+ (total / 20));
}
break;
default :
tv.append("String_Node_Str" + NetworkComBinder.EventType.values()[msg.what] + "String_Node_Str");
}
}

Fixed version (ground truth):
public void handleMessage(Message msg){
  tv.append("String_Node_Str");
switch (NetworkComBinder.EventType.values()[msg.what]) {
case CONNECTION_ESTABLISHED:
    tv.append("String_Node_Str");
  break;
case CONNECTION_LOST:
tv.append("String_Node_Str");
break;
case CONNECTION_FAILED:
tv.append("String_Node_Str");
break;
case LATENCY_UPDATE_RECEIVED:
tv.append("String_Node_Str" + ((NetworkEvent)msg.obj).getMessage() + "String_Node_Str");
int latency=((Long)((NetworkEvent)msg.obj).getMessage()).intValue();
if (latency > highest) highest=latency;
if (latency < lowest) lowest=latency;
total+=latency;
if (pingsPerformed == 20) {
tv.append("String_Node_Str" + highest + "String_Node_Str"+ lowest+ "String_Node_Str"+ (total / 20));
}
break;
default :
tv.append("String_Node_Str" + NetworkComBinder.EventType.values()[msg.what] + "String_Node_Str");
}
}
Program: 179529
Project: 179529
Buggy source:
@Override public void run(){
  while (!stopOperation) {
    try {
      if (LokemonServerVariables.playerList.size() >= 1) {
        for (        LokemonPlayer pl : LokemonServerVariables.playerList) {
          Location center=pl.getPosition();
          double randomDist=(Math.random() * (LokemonServerVariables.itemSpawnRangeMax - LokemonServerVariables.itemSpawnRangeMin)) + LokemonServerVariables.itemSpawnRangeMin;
          double randomAngle=Math.random() * 360;
          double x=center.getX() + randomDist * Math.cos(randomAngle);
          double y=center.getY() + randomDist * Math.sin(randomAngle);
          LokemonPotion pot=new LokemonPotion(LokemonPotion.PotionType.values()[((int)Math.random() * LokemonPotion.PotionType.values().length)]);
          pot.setPosition(new Location(x,y));
          LokemonServerVariables.itemList.add(pot);
        }
      }
      Thread.sleep(LokemonServerVariables.itemSpawnTimer);
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!stopOperation) {
    try {
      if (LokemonServerVariables.playerList.size() >= 1) {
        for (        LokemonPlayer pl : LokemonServerVariables.playerList) {
          if (pl.getPosition() != null) {
            Location center=pl.getPosition();
            double randomDist=(Math.random() * (LokemonServerVariables.itemSpawnRangeMax - LokemonServerVariables.itemSpawnRangeMin)) + LokemonServerVariables.itemSpawnRangeMin;
            double randomAngle=Math.random() * 360;
            double x=center.getX() + randomDist * Math.cos(randomAngle);
            double y=center.getY() + randomDist * Math.sin(randomAngle);
            LokemonPotion pot=new LokemonPotion(LokemonPotion.PotionType.values()[((int)Math.random() * LokemonPotion.PotionType.values().length)]);
            pot.setPosition(new Location(x,y));
            LokemonServerVariables.itemList.add(pot);
          }
        }
      }
      Thread.sleep(LokemonServerVariables.itemSpawnTimer);
    }
 catch (    InterruptedException e) {
    }
catch (    Exception e) {
      System.err.println("String_Node_Str" + e);
    }
  }
}
Program: 179531
Project: 179531
Buggy source:
/** 
 * Used to start a time synchronisation protocal with the server. This is  automatically run upon first contact with the server, but can be manually  run again if the network latency has changed drastically (IE change from wifi to EDGE). If a time sync is already in progress, calls to this method will be ignored.
 */
public void requestNetworkTimeSync(){
  if (!timeSyncInProgress) {
    timeSyncInProgress=true;
    timeSyncReceived=0;
    NetworkMessage msg=new NetworkMessage("String_Node_Str");
    msg.setMessageType(NetworkMessage.MessageType.TIME_REQUEST);
    writeOut(msg);
    syncTimer.schedule(new TimerTask(){
      @Override public void run(){
        NetworkMessage msg=new NetworkMessage("String_Node_Str");
        msg.setMessageType(NetworkMessage.MessageType.TIME_REQUEST);
        writeOut(msg);
      }
    }
,2000,2000);
  }
}

Fixed version (ground truth):
/** 
 * Used to start a time synchronisation protocal with the server. This is  automatically run upon first contact with the server, but can be manually  run again if the network latency has changed drastically (IE change from wifi to EDGE). If a time sync is already in progress, calls to this method will be ignored.
 */
public void requestNetworkTimeSync(){
  if (!timeSyncInProgress) {
    timeSyncInProgress=true;
    timeSyncReceived=0;
    NetworkMessage msg=new NetworkMessage("String_Node_Str");
    msg.setMessageType(NetworkMessage.MessageType.TIME_REQUEST);
    writeOut(msg);
    syncTimer.schedule(new TimerTask(){
      @Override public void run(){
        NetworkMessage msg=new NetworkMessage("String_Node_Str");
        msg.setMessageType(NetworkMessage.MessageType.TIME_REQUEST);
        writeOut(msg);
      }
    }
,500,2000);
  }
}
Program: 179532
Project: 179532
Buggy source:
/** 
 * Method used to remove outliers from accumulated sync packets, and average the time delta. Will then automatically add the time delta to current time delta to get an accurate estimate  of the server time.
 */
public void convergeSyncPackets(){
  TimeSyncPacket[] workList=(GameClock.TimeSyncPacket[])accumulationList.toArray();
  Arrays.sort(workList);
  long medianLatency=workList[3].latency;
  Log.i(NetworkVariables.TAG,"String_Node_Str" + medianLatency);
  long meanLatency=0;
  for (  TimeSyncPacket pct : workList) {
    meanLatency+=pct.latency;
  }
  meanLatency/=workList.length;
  Log.i(NetworkVariables.TAG,"String_Node_Str" + meanLatency);
  double stdDeviation=0;
  for (  TimeSyncPacket pct : workList) {
    stdDeviation+=(pct.latency - meanLatency) * (pct.latency - meanLatency);
  }
  stdDeviation/=workList.length;
  stdDeviation=Math.sqrt(stdDeviation);
  Log.i(NetworkVariables.TAG,"String_Node_Str" + stdDeviation);
  long averageTimeDelta=0;
  int deltaCount=0;
  for (  TimeSyncPacket pct : workList) {
    if (Math.abs(meanLatency - pct.latency) <= stdDeviation) {
      averageTimeDelta+=pct.timedel;
      deltaCount++;
    }
  }
  averageTimeDelta/=deltaCount;
  Log.i(NetworkVariables.TAG,"String_Node_Str" + averageTimeDelta);
  timeDelta+=averageTimeDelta;
  accumulationList.clear();
}

Fixed version (ground truth):
/** 
 * Method used to remove outliers from accumulated sync packets, and average the time delta. Will then automatically add the time delta to current time delta to get an accurate estimate  of the server time.
 */
public void convergeSyncPackets(){
  Object[] workList=accumulationList.toArray();
  Log.i(NetworkVariables.TAG,"String_Node_Str");
  Arrays.sort(workList);
  long medianLatency=((TimeSyncPacket)workList[2]).latency;
  Log.i(NetworkVariables.TAG,"String_Node_Str" + medianLatency);
  long meanLatency=0;
  for (  Object pct : workList) {
    meanLatency+=((TimeSyncPacket)pct).latency;
  }
  meanLatency/=workList.length;
  Log.i(NetworkVariables.TAG,"String_Node_Str" + meanLatency);
  double stdDeviation=0;
  for (  Object pct : workList) {
    stdDeviation+=(((TimeSyncPacket)pct).latency - meanLatency) * (((TimeSyncPacket)pct).latency - meanLatency);
  }
  stdDeviation/=workList.length;
  stdDeviation=Math.sqrt(stdDeviation);
  Log.i(NetworkVariables.TAG,"String_Node_Str" + stdDeviation);
  long averageTimeDelta=0;
  int deltaCount=0;
  for (  Object pct : workList) {
    if (Math.abs(meanLatency - ((TimeSyncPacket)pct).latency) <= stdDeviation) {
      averageTimeDelta+=((TimeSyncPacket)pct).timedel;
      deltaCount++;
    }
  }
  averageTimeDelta/=deltaCount;
  Log.i(NetworkVariables.TAG,"String_Node_Str" + averageTimeDelta);
  timeDelta+=averageTimeDelta;
  accumulationList.clear();
}
Program: 179533
Project: 179533
Buggy source:
/** 
 * Sends a message directly to the player with the given player ID. Uses P2P communication if possible, but if that isn't possible, it will route the message via the game server.
 * @param message The message to send to the peer. Must be one of the standard NetworkMessages(NetworkMessage, NetworkMessageMedium or NetworkMessageLarge)
 * @param targetPlayerId The player ID of the player we wish to send this message too. If theplayer ID does not exist, this message will be lost in transit, with no notification.
 */
public void sendDirectCommunicationMessage(NetworkMessage message,int targetPlayerId){
  if (playerId != -1) {
    if (message instanceof NetworkMessageLarge) {
      ((NetworkMessageLarge)message).integers.add(targetPlayerId);
      ((NetworkMessageLarge)message).integers.add(playerId);
    }
 else     if (message instanceof NetworkMessageMedium) {
      ((NetworkMessageMedium)message).integers.add(targetPlayerId);
      ((NetworkMessageLarge)message).integers.add(playerId);
    }
 else {
      NetworkMessageMedium msg=new NetworkMessageMedium();
      msg.setMessage(message.getMessage());
      msg.integers.add(targetPlayerId);
      msg.integers.add(playerId);
      message=msg;
    }
    message.setMessageType(NetworkMessage.MessageType.DIRECT_COMMUNICATION_MESSAGE);
    writeOut(message);
  }
 else {
    throw new NotYetRegisteredException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sends a message directly to the player with the given player ID. Uses P2P communication if possible, but if that isn't possible, it will route the message via the game server.
 * @param message The message to send to the peer. Must be one of the standard NetworkMessages(NetworkMessage, NetworkMessageMedium or NetworkMessageLarge)
 * @param targetPlayerId The player ID of the player we wish to send this message too. If theplayer ID does not exist, this message will be lost in transit, with no notification.
 */
public void sendDirectCommunicationMessage(NetworkMessage message,int targetPlayerId){
  if (playerId != -1) {
    if (message instanceof NetworkMessageLarge) {
      ((NetworkMessageLarge)message).integers.add(targetPlayerId);
      ((NetworkMessageLarge)message).integers.add(playerId);
    }
 else     if (message instanceof NetworkMessageMedium) {
      ((NetworkMessageMedium)message).integers.add(targetPlayerId);
      ((NetworkMessageMedium)message).integers.add(playerId);
    }
 else {
      NetworkMessageMedium msg=new NetworkMessageMedium();
      msg.setMessage(message.getMessage());
      msg.integers.add(targetPlayerId);
      msg.integers.add(playerId);
      message=msg;
    }
    message.setMessageType(NetworkMessage.MessageType.DIRECT_COMMUNICATION_MESSAGE);
    writeOut(message);
  }
 else {
    throw new NotYetRegisteredException("String_Node_Str");
  }
}
Program: 179534
Project: 179534
Buggy source:
public NetworkMessageLarge(){
  super();
}

Fixed version (ground truth):
public NetworkMessageLarge(){
  super();
  objectDict=new HashMap<String,Object>();
  stringDict=new HashMap<String,String>();
  integers=new ArrayList<Integer>();
  doubles=new ArrayList<Double>();
  strings=new ArrayList<String>();
}
Program: 179535
Project: 179535
Buggy source:
public NetworkMessageMedium(){
  super();
}

Fixed version (ground truth):
public NetworkMessageMedium(){
  super();
  strings=new ArrayList<String>();
  integers=new ArrayList<Integer>();
  doubles=new ArrayList<Double>();
}
Program: 179537
Project: 179537
Buggy source:
public void shutdownThread(){
  try {
    isRunning=false;
    out.shutdownThread();
    stopOperation=true;
    this.interrupt();
    socket.close();
    connected=false;
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
public void shutdownThread(){
  try {
    isRunning=false;
    if (out != null)     out.shutdownThread();
    stopOperation=true;
    this.interrupt();
    if (socket != null)     socket.close();
    connected=false;
  }
 catch (  IOException e) {
    System.err.println("String_Node_Str" + e);
  }
}
Program: 179538
Project: 179538
Buggy source:
@Override public void run(){
  if (!connected) {
    connectToServer();
  }
  isRunning=true;
  registerWithServer(getPlayerRegistrationInformation());
  while (!stopOperation) {
    try {
      Object data=in.readObject();
      processNetworkMessage(data);
    }
 catch (    InterruptedIOException e) {
    }
catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
      fireEvent(new NetworkEvent(this,"String_Node_Str" + e),ConnectionLostListener.class);
      this.shutdownThread();
      break;
    }
catch (    ClassNotFoundException e) {
      System.err.println("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (!connected) {
    connectToServer();
  }
  if (connected) {
    isRunning=true;
    registerWithServer(getPlayerRegistrationInformation());
    while (!stopOperation) {
      try {
        Object data=in.readObject();
        processNetworkMessage(data);
      }
 catch (      InterruptedIOException e) {
      }
catch (      IOException e) {
        System.err.println("String_Node_Str" + e);
        fireEvent(new NetworkEvent(this,"String_Node_Str" + e),ConnectionLostListener.class);
        this.shutdownThread();
        break;
      }
catch (      ClassNotFoundException e) {
        System.err.println("String_Node_Str");
      }
catch (      NullPointerException e) {
        Log.e(NetworkVariables.TAG,"String_Node_Str",e);
      }
    }
  }
 else {
    shutdownThread();
  }
}
Program: 179539
Project: 179539
Buggy source:
@SuppressWarnings("String_Node_Str") private void handlePeerListUpdate(NetworkMessage msg){
  peers=(Vector<ClientPeer>)msg.getDataObject("String_Node_Str");
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void handlePeerListUpdate(NetworkMessage msg){
  peers=(Vector<ClientPeer>)msg.getDataObject("String_Node_Str");
  Log.d(NetworkVariables.TAG,"String_Node_Str");
}
Program: 179540
Project: 179540
Buggy source:
private void connectToServer(){
  boolean success=true;
  try {
    Inet4Address hostAddress=(Inet4Address)InetAddress.getByName(NetworkVariables.hostname);
    socket=new Socket(hostAddress,NetworkVariables.port);
    in=new ObjectInputStream(socket.getInputStream());
    out=new NetworkWriteThread(socket);
    out.start();
  }
 catch (  UnknownHostException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    success=false;
  }
catch (  IOException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    success=false;
  }
 finally {
    if (!success) {
      fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionFailedListener.class);
    }
 else {
      connected=true;
    }
  }
  Log.i(NetworkVariables.TAG,"String_Node_Str");
}

Fixed version (ground truth):
private void connectToServer(){
  boolean success=true;
  try {
    Inet4Address hostAddress=(Inet4Address)InetAddress.getByName(NetworkVariables.hostname);
    socket=new Socket(hostAddress,NetworkVariables.port);
    in=new ObjectInputStream(socket.getInputStream());
    out=new NetworkWriteThread(socket);
    out.start();
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionEstablishedListener.class);
  }
 catch (  UnknownHostException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    success=false;
  }
catch (  IOException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    success=false;
  }
 finally {
    if (!success) {
      fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionFailedListener.class);
    }
 else {
      connected=true;
    }
  }
  Log.i(NetworkVariables.TAG,"String_Node_Str");
}
Program: 179541
Project: 179541
Buggy source:
/** 
 * Asyncronously connects to the server
 */
public void connect(){
  if (!connected)   this.start();
}

Fixed version (ground truth):
/** 
 * Asynchronously connects to the server
 */
public void connect(){
  if (!connected)   this.start();
}
Program: 179542
Project: 179542
Buggy source:
private void writeOut(Object object) throws BufferOverflowException {
  if (!out.writeMessage(object)) {
    throw new BufferOverflowException();
  }
}

Fixed version (ground truth):
private void writeOut(Object object) throws BufferOverflowException {
  try {
    if (!out.writeMessage(object)) {
      throw new BufferOverflowException();
    }
  }
 catch (  NullPointerException e) {
  }
}
Program: 179543
Project: 179543
Buggy source:
public boolean writeMessage(Object message){
  return messageQueue.offer(message);
}

Fixed version (ground truth):
public boolean writeMessage(Object message){
  if (message != null) {
    return messageQueue.offer(message);
  }
 else {
    return false;
  }
}
Program: 179544
Project: 179544
Buggy source:
public void onServiceConnected(ComponentName name,IBinder service){
  binder=(NetworkComBinder)service;
  networkBound=true;
  tv.append("String_Node_Str");
  binder.registerMessenger(eventMessenger);
  binder.ConnectToServer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      if (networkBound)       binder.requestLatency();
    }
  }
,recurranceDelay * 1000,recurranceDelay * 1000);
}

Fixed version (ground truth):
public void onServiceConnected(ComponentName name,IBinder service){
  binder=(NetworkComBinder)service;
  networkBound=true;
  tv.append("String_Node_Str");
  binder.registerMessenger(eventMessenger);
  binder.ConnectToServer();
  timer.schedule(new TimerTask(){
    @Override public void run(){
      if (networkBound)       binder.requestLatency();
    }
  }
,recurranceDelay * 1000,recurranceDelay * 200);
}
Program: 179546
Project: 179546
Buggy source:
/** 
 * Will make a request to the server to check out what kind of latency there is between android device and server. Response will come as a latencyUpdateEvent.
 */
public void requestNetworkLatency(){
  NetworkMessage msg=new NetworkMessage("String_Node_Str");
  msg.setMessageType(NetworkMessage.MessageType.LATENCY_REQUEST_MESSAGE);
  writeOut(msg);
  latencyStartTime=System.currentTimeMillis();
}

Fixed version (ground truth):
/** 
 * Will make a request to the server to check out what kind of latency there is between android device and server. Response will come as a latencyUpdateEvent.
 */
public void requestNetworkLatency(){
  if (!awaitingLatencyResponse) {
    awaitingLatencyResponse=true;
    NetworkMessage msg=new NetworkMessage("String_Node_Str");
    msg.setMessageType(NetworkMessage.MessageType.LATENCY_REQUEST_MESSAGE);
    writeOut(msg);
    latencyStartTime=System.currentTimeMillis();
  }
}
Program: 179549
Project: 179549
Buggy source:
@Override public void run(){
  while (!stopOperation) {
    try {
      NetworkMessage msg=messageQueue.take();
      Schema<NetworkMessage> schema=RuntimeSchema.getSchema(NetworkMessage.class);
      ProtostuffIOUtil.writeTo(os,msg,schema,buffer);
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
    }
catch (    InterruptedException e) {
    }
catch (    Exception e) {
      Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    }
 finally {
      buffer.clear();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!stopOperation) {
    try {
      NetworkMessage msg=messageQueue.take();
      Schema<NetworkMessage> schema=RuntimeSchema.getSchema(NetworkMessage.class);
      byte[] serializedObject=ProtostuffIOUtil.toByteArray(msg,schema,buffer);
      NumberFormat nf=new DecimalFormat("String_Node_Str");
      byte[] lengthField=nf.format(serializedObject.length).getBytes();
      byte[] message=new byte[serializedObject.length + lengthField.length];
      System.arraycopy(lengthField,0,message,0,lengthField.length);
      System.arraycopy(serializedObject,0,message,lengthField.length,serializedObject.length);
      os.write(message);
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
    }
catch (    InterruptedException e) {
    }
catch (    Exception e) {
      Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    }
 finally {
      buffer.clear();
    }
  }
}
Program: 179550
Project: 179550
Buggy source:
public NetworkMessageMedium(String message){
  super(message);
  strings=new ArrayList<String>();
  ints=new ArrayList<Integer>();
}

Fixed version (ground truth):
public NetworkMessageMedium(String message){
  super(message);
  strings=new ArrayList<String>();
}
Program: 179551
Project: 179551
Buggy source:
public PlayerRegistrationMessage(int playerId){
  super("String_Node_Str");
  playerID=playerId;
  strings=new ArrayList<String>();
  ints=new ArrayList<Integer>();
}

Fixed version (ground truth):
public PlayerRegistrationMessage(){
  super("String_Node_Str");
}
Program: 179552
Project: 179552
Buggy source:
@Override public PlayerRegistrationMessage getPlayerRegistrationInformation(){
  return new PlayerRegistrationMessage(1,"String_Node_Str");
}

Fixed version (ground truth):
@Override public PlayerRegistrationMessage getPlayerRegistrationInformation(){
  return new PlayerRegistrationMessage("String_Node_Str");
}
Program: 179553
Project: 179553
Buggy source:
public void onCreate(){
  try {
    networkThread=NetworkVariables.getInstance();
    binder=new NetworkComBinder(networkThread);
  }
 catch (  IllegalAccessException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
  }
catch (  InstantiationException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void onCreate(){
  try {
    networkThread=NetworkVariables.getInstance();
    binder=new NetworkComBinder(networkThread);
  }
 catch (  IllegalAccessException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str" + e.getMessage(),e);
  }
catch (  InstantiationException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str" + e.getMessage(),e);
  }
}
Program: 179555
Project: 179555
Buggy source:
public void onServiceConnected(ComponentName name,IBinder service){
  binder=(NetworkComBinder)service;
  networkBound=true;
  tv.append("String_Node_Str");
  binder.addListener(ConnectionEstablishedListener.class,new ConnectionEstablishedListener(){
    public void EventOccured(    NetworkEvent e){
      tv.append("String_Node_Str");
    }
  }
);
  if (binder.ConnectToServer()) {
    tv.append("String_Node_Str");
  }
 else {
    tv.append("String_Node_Str");
  }
}

Fixed version (ground truth):
public void onServiceConnected(ComponentName name,IBinder service){
  binder=(NetworkComBinder)service;
  networkBound=true;
  tv.append("String_Node_Str");
  binder.addListener(ConnectionEstablishedListener.class,new ConnectionEstablishedListener(){
    public void EventOccured(    NetworkEvent e){
      tv.append("String_Node_Str");
    }
  }
);
  binder.addListener(ConnectionLostListener.class,new ConnectionLostListener(){
    public void EventOccured(    NetworkEvent e){
      tv.append("String_Node_Str");
    }
  }
);
  if (binder.ConnectToServer()) {
    tv.append("String_Node_Str");
  }
 else {
    tv.append("String_Node_Str");
  }
}
Program: 179556
Project: 179556
Buggy source:
@SuppressWarnings("String_Node_Str") private void handlePeerListUpdate(NetworkMessage msg){
  peers=(Vector<ClientPeer>)msg.getDataObject("String_Node_Str");
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void handlePeerListUpdate(NetworkMessage msg){
  peers=(Vector<ClientPeer>)msg.getDataObject("String_Node_Str");
  Log.d(NetworkVariables.TAG,"String_Node_Str");
}
Program: 179557
Project: 179557
Buggy source:
public boolean connect(){
  try {
    Inet4Address hostAddress=(Inet4Address)InetAddress.getByName(NetworkVariables.hostname);
    socket=new Socket(hostAddress,NetworkVariables.port);
    in=new ObjectInputStream(socket.getInputStream());
    out=new NetworkWriteThread(socket);
    out.start();
  }
 catch (  UnknownHostException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    return false;
  }
catch (  IOException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    return false;
  }
  Log.i(NetworkVariables.TAG,"String_Node_Str");
  return true;
}

Fixed version (ground truth):
public boolean connect(){
  try {
    Inet4Address hostAddress=(Inet4Address)InetAddress.getByName(NetworkVariables.hostname);
    socket=new Socket(hostAddress,NetworkVariables.port);
    in=new ObjectInputStream(socket.getInputStream());
    out=new NetworkWriteThread(socket);
    out.start();
    fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionEstablishedListener.class);
  }
 catch (  UnknownHostException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    return false;
  }
catch (  IOException e) {
    Log.e(NetworkVariables.TAG,"String_Node_Str",e);
    return false;
  }
  Log.i(NetworkVariables.TAG,"String_Node_Str");
  return true;
}
Program: 179558
Project: 179558
Buggy source:
private void processNetworkMessage(Object message){
  if (message instanceof NetworkMessage) {
    NetworkMessage msg=(NetworkMessage)message;
switch (msg.getMessageType()) {
case UPDATE_MESSAGE:
      fireEvent(new NetworkEvent(this,msg),UpdateReceivedListener.class);
    break;
case REQUEST_MESSAGE:
  fireEvent(new NetworkEvent(this,msg),RequestReceivedListener.class);
break;
case INITIAL_GAME_STATE_MESSAGE:
processInitialGameState(msg);
break;
case PARTIAL_GAMESTATE_UPDATE_MESSAGE:
fireEvent(new NetworkEvent(this,msg),PartialGamestateReceivedListener.class);
break;
case GAMESTATE_UPDATE_MESSAGE:
fireEvent(new NetworkEvent(this,msg),GamestateReceivedListener.class);
break;
case GAMESTATE_REQUEST_MESSAGE:
break;
case TERMINATION_REQUEST_MESSAGE:
break;
case PEER_LIST_MESSAGE:
handlePeerListUpdate(msg);
break;
case PEER_LIST_REQUEST_MESSAGE:
break;
case LATENCY_REQUEST_MESSAGE:
NetworkMessage latMsg=new NetworkMessage("String_Node_Str");
latMsg.setMessageType(NetworkMessage.MessageType.LATENCY_RESPONSE_MESSAGE);
writeOut(latMsg);
break;
case LATENCY_RESPONSE_MESSAGE:
latencyEndTime=System.currentTimeMillis();
if (latencyStartTime < latencyEndTime) {
fireEvent(new NetworkEvent(this,(latencyEndTime - latencyStartTime)),LatencyUpdateListener.class);
}
default :
fireEvent(new NetworkEvent(this,msg),UnknownMessageTypeReceivedListener.class);
}
}
}

Fixed version (ground truth):
private void processNetworkMessage(Object message){
  if (message instanceof NetworkMessage) {
    NetworkMessage msg=(NetworkMessage)message;
switch (msg.getMessageType()) {
case UPDATE_MESSAGE:
      fireEvent(new NetworkEvent(this,msg),UpdateReceivedListener.class);
    break;
case REQUEST_MESSAGE:
  fireEvent(new NetworkEvent(this,msg),RequestReceivedListener.class);
break;
case INITIAL_GAME_STATE_MESSAGE:
processInitialGameState(msg);
break;
case PARTIAL_GAMESTATE_UPDATE_MESSAGE:
fireEvent(new NetworkEvent(this,msg),PartialGamestateReceivedListener.class);
break;
case GAMESTATE_UPDATE_MESSAGE:
fireEvent(new NetworkEvent(this,msg),GamestateReceivedListener.class);
break;
case GAMESTATE_REQUEST_MESSAGE:
break;
case TERMINATION_REQUEST_MESSAGE:
break;
case PEER_LIST_MESSAGE:
handlePeerListUpdate(msg);
break;
case PEER_LIST_REQUEST_MESSAGE:
break;
case LATENCY_REQUEST_MESSAGE:
NetworkMessage latMsg=new NetworkMessage("String_Node_Str");
latMsg.setMessageType(NetworkMessage.MessageType.LATENCY_RESPONSE_MESSAGE);
writeOut(latMsg);
break;
case LATENCY_RESPONSE_MESSAGE:
latencyEndTime=System.currentTimeMillis();
if (latencyStartTime < latencyEndTime) {
fireEvent(new NetworkEvent(this,(latencyEndTime - latencyStartTime)),LatencyUpdateListener.class);
}
break;
default :
fireEvent(new NetworkEvent(this,msg),UnknownMessageTypeReceivedListener.class);
break;
}
}
}
Program: 179560
Project: 179560
Buggy source:
public NetworkMessage(String message){
  primeMessage=message;
}

Fixed version (ground truth):
public NetworkMessage(String message){
  primeMessage=message;
  strings=new HashMap<String,String>(ServerCustomisation.initialNetworkMessageMapSize);
  ints=new HashMap<String,Integer>(ServerCustomisation.initialNetworkMessageMapSize);
  objects=new HashMap<String,Object>(ServerCustomisation.initialNetworkMessageMapSize);
}
Program: 179561
Project: 179561
Buggy source:
@Override public void run(){
  while (true) {
    try {
      System.out.println("String_Node_Str");
      Socket con=socket.accept();
      System.out.println("String_Node_Str" + con);
      ServerDaemonThread daemonThread=customSettings.buildInstance();
      daemonThread.start();
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
    }
catch (    InstantiationException e) {
      System.err.println("String_Node_Str" + "String_Node_Str" + e);
    }
catch (    IllegalAccessException e) {
      System.err.println("String_Node_Str" + e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    try {
      System.out.println("String_Node_Str");
      Socket con=socket.accept();
      System.out.println("String_Node_Str" + con);
      ServerDaemonThread daemonThread=customSettings.buildInstance();
      daemonThread.setSocket(con);
      daemonThread.start();
    }
 catch (    IOException e) {
      System.err.println("String_Node_Str" + e);
    }
catch (    InstantiationException e) {
      System.err.println("String_Node_Str" + "String_Node_Str" + e);
    }
catch (    IllegalAccessException e) {
      System.err.println("String_Node_Str" + e);
    }
  }
}