Program: 179527
Project: 179527
Buggy source:
@Override public void run(){
  while (!stopOperation) {
    try {
      NetworkMessage msg=null;
      Schema schema=null;
      byte[] messageHeader=new byte[5];
      int success=in.read(messageHeader);
      if (success == 5) {
        byte classType=messageHeader[0];
switch (classType) {
case -1:
          keepAliveBreak=true;
        break;
case 1:
      msg=new PlayerRegistrationMessage();
    schema=playerRegSchema;
  break;
case 2:
msg=new NetworkMessageMedium();
schema=mediumMsgSchema;
break;
case 3:
msg=new NetworkMessageLarge();
schema=largeMsgSchema;
break;
default :
msg=new NetworkMessage();
schema=networkMsgSchema;
}
if (!keepAliveBreak) {
b.clear();
b.put(messageHeader,1,4);
b.rewind();
int mSize=b.getInt();
byte[] object=new byte[mSize];
int bytesRead=0;
while (bytesRead != mSize) {
bytesRead+=in.read(object,bytesRead,object.length - bytesRead);
}
ProtostuffIOUtil.mergeFrom(object,msg,schema);
processNetworkMessage(msg);
}
}
 else {
if (success == -1) {
System.err.println("String_Node_Str");
fireEvent(new NetworkEvent(this,"String_Node_Str" + e),ConnectionLostListener.class);
shutdownThread();
}
}
}
 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 (NullPointerException e) {
System.err.println("String_Node_Str" + e.getMessage());
fireEvent(new NetworkEvent(this,"String_Node_Str" + e),ConnectionLostListener.class);
stopOperation=true;
}
catch (RuntimeException e) {
System.err.println("String_Node_Str" + e);
}
 finally {
keepAliveBreak=false;
buffer.clear();
b.clear();
}
}
}

Fixed version (ground truth):
@Override public void run(){
  while (!stopOperation) {
    try {
      NetworkMessage msg=null;
      Schema schema=null;
      byte[] messageHeader=new byte[5];
      int success=in.read(messageHeader);
      if (success == 5) {
        byte classType=messageHeader[0];
switch (classType) {
case -1:
          keepAliveBreak=true;
        break;
case 1:
      msg=new PlayerRegistrationMessage();
    schema=playerRegSchema;
  break;
case 2:
msg=new NetworkMessageMedium();
schema=mediumMsgSchema;
break;
case 3:
msg=new NetworkMessageLarge();
schema=largeMsgSchema;
break;
default :
msg=new NetworkMessage();
schema=networkMsgSchema;
}
if (!keepAliveBreak) {
b.clear();
b.put(messageHeader,1,4);
b.rewind();
int mSize=b.getInt();
byte[] object=new byte[mSize];
int bytesRead=0;
while (bytesRead != mSize) {
bytesRead+=in.read(object,bytesRead,object.length - bytesRead);
}
ProtostuffIOUtil.mergeFrom(object,msg,schema);
processNetworkMessage(msg);
}
}
 else {
if (success == -1) {
System.err.println("String_Node_Str");
fireEvent(new NetworkEvent(this,"String_Node_Str"),ConnectionLostListener.class);
shutdownThread();
}
}
}
 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 (NullPointerException e) {
System.err.println("String_Node_Str" + e.getMessage());
fireEvent(new NetworkEvent(this,"String_Node_Str" + e),ConnectionLostListener.class);
stopOperation=true;
}
catch (RuntimeException e) {
System.err.println("String_Node_Str" + e);
}
 finally {
keepAliveBreak=false;
buffer.clear();
b.clear();
}
}
}