Program: 179511
Project: 179511
Buggy source:
@Override public void run(){
  while (!stopOperation) {
    try {
      NetworkMessage msg=null;
      Schema schema=null;
      byte[] messageHeader=new byte[6];
      int headerBytesRead=in.read(messageHeader);
      if (headerBytesRead == 6) {
        byte classType=messageHeader[0];
        boolean compressed=false;
        if (messageHeader[1] == 1)         compressed=true;
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,2,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);
}
byte[] decompressed;
if (compressed) {
decompressed=QuickLZ.decompress(object);
}
 else {
decompressed=object;
}
ProtostuffIOUtil.mergeFrom(decompressed,msg,schema);
processNetworkMessage(msg);
}
}
 else {
if (headerBytesRead == -1) {
LogMaker.errorPrintln("String_Node_Str",playerID);
shutdownThread();
}
}
}
 catch (InterruptedIOException e) {
}
catch (IOException e) {
LogMaker.errorPrintln("String_Node_Str" + e,playerID);
this.shutdownThread();
}
catch (NullPointerException e) {
LogMaker.errorPrintln("String_Node_Str" + e.getMessage(),playerID);
this.shutdownThread();
}
catch (BufferOverflowException e) {
LogMaker.errorPrintln("String_Node_Str",playerID);
}
catch (java.lang.OutOfMemoryError e) {
LogMaker.errorPrintln("String_Node_Str",playerID);
}
catch (RuntimeException e) {
LogMaker.errorPrintln("String_Node_Str" + e,playerID);
}
 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[6];
      int headerBytesRead=in.read(messageHeader);
      if (headerBytesRead == 6) {
        byte classType=messageHeader[0];
        boolean compressed=false;
        if (messageHeader[1] == 1)         compressed=true;
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,2,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);
}
byte[] decompressed;
if (compressed) {
decompressed=QuickLZ.decompress(object);
}
 else {
decompressed=object;
}
ProtostuffIOUtil.mergeFrom(decompressed,msg,schema);
processNetworkMessage(msg);
}
}
 else {
if (headerBytesRead == -1) {
LogMaker.errorPrintln("String_Node_Str",playerID);
shutdownThread();
}
}
}
 catch (InterruptedIOException e) {
}
catch (IOException e) {
LogMaker.errorPrintln("String_Node_Str" + e,playerID);
this.shutdownThread();
}
catch (NullPointerException e) {
LogMaker.errorPrintln("String_Node_Str" + e.getMessage(),playerID);
this.shutdownThread();
}
catch (BufferOverflowException e) {
LogMaker.errorPrintln("String_Node_Str",playerID);
}
catch (java.lang.OutOfMemoryError e) {
LogMaker.errorPrintln("String_Node_Str",playerID);
}
catch (RuntimeException e) {
LogMaker.errorPrintln("String_Node_Str" + e,playerID);
}
catch (Exception e) {
LogMaker.errorPrintln("String_Node_Str" + e,playerID);
}
 finally {
keepAliveBreak=false;
buffer.clear();
b.clear();
}
}
}