Program: 179524
Project: 179524
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");
timer.schedule(new TimerTask(){
@Override public void run(){
  binder.ConnectToServer();
}
}
,3000);
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);
NetworkMessage busyMessage=new NetworkMessage("String_Node_Str");
binder.sendGameUpdate(busyMessage);
}
 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 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<LokemonPlayer> players=(ArrayList<LokemonPlayer>)pl;
tv.append("String_Node_Str" + players.size() + "String_Node_Str");
if (players.size() > 0) {
tv.append("String_Node_Str" + players.get(0).getPlayerID() + "String_Node_Str");
tv.append("String_Node_Str" + players.get(0).getBusy() + "String_Node_Str");
tv.append("String_Node_Str" + players.get(0).getAvatar() + "String_Node_Str"+ players.get(0).getPlayerName()+ "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;
case PLAYER_REGISTERED:
tv.append("String_Node_Str");
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");
timer.schedule(new TimerTask(){
@Override public void run(){
  binder.ConnectToServer();
}
}
,3000);
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);
NetworkMessage busyMessage=new NetworkMessage("String_Node_Str");
binder.sendGameUpdate(busyMessage);
tv.append("String_Node_Str");
}
 else if (pingsPerformed == 5) {
binder.sendGameStateRequest(new NetworkMessage("String_Node_Str"));
tv.append("String_Node_Str");
}
 else if (pingsPerformed == 15) {
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");
tv.append("String_Node_Str");
for (LokemonPotion pot : players) {
tv.append("String_Node_Str" + pot.getType());
}
tv.append("String_Node_Str");
}
 else {
tv.append("String_Node_Str");
}
}
 else {
tv.append("String_Node_Str");
}
}
 else 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<LokemonPlayer> players=(ArrayList<LokemonPlayer>)pl;
tv.append("String_Node_Str" + players.size() + "String_Node_Str");
if (players.size() > 0) {
tv.append("String_Node_Str" + players.get(0).getPlayerID() + "String_Node_Str");
tv.append("String_Node_Str" + players.get(0).getBusy() + "String_Node_Str");
tv.append("String_Node_Str" + players.get(0).getAvatar() + "String_Node_Str"+ players.get(0).getPlayerName()+ "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;
case PLAYER_REGISTERED:
tv.append("String_Node_Str");
break;
default :
tv.append("String_Node_Str" + NetworkComBinder.EventType.values()[msg.what] + "String_Node_Str");
}
}