Program: 179512
Project: 179512
Buggy source:
@Override public void run(){
  while (!stopOperation) {
    try {
      NetworkMessage msg=messageQueue.take();
      Schema schema;
      byte classType;
      if (msg instanceof PlayerRegistrationMessage) {
        schema=playerRegSchema;
        classType=1;
      }
 else       if (msg instanceof NetworkMessageMedium) {
        schema=mediumMsgSchema;
        classType=2;
      }
 else       if (msg instanceof NetworkMessageLarge) {
        schema=largeMsgSchema;
        classType=3;
      }
 else {
        schema=networkMsgSchema;
        classType=0;
      }
      byte[] serializedObject=ProtostuffIOUtil.toByteArray(msg,schema,buffer);
      boolean compressed=false;
      byte[] tempArray=QuickLZ.compress(serializedObject,3);
      if (tempArray.length < serializedObject.length) {
        serializedObject=tempArray;
        compressed=true;
      }
      b.clear();
      b.putInt(serializedObject.length);
      byte[] lengthField=b.array();
      byte[] message=new byte[serializedObject.length + lengthField.length + 2];
      message[0]=classType;
      if (compressed) {
        message[1]=1;
      }
 else {
        message[1]=0;
      }
      System.arraycopy(lengthField,0,message,2,lengthField.length);
      System.arraycopy(serializedObject,0,message,lengthField.length + 2,serializedObject.length);
      if (message.length > 8000) {
        LogMaker.println("String_Node_Str" + message.length + "String_Node_Str",mainThread.playerID);
        int numMsgs=message.length / 4096;
        int remainder=message.length % 4096;
        byte[][] msgs=new byte[numMsgs][4096];
        byte[] lastMsg=new byte[remainder];
        for (int i=0; i < numMsgs; i++) {
          msgs[i]=Arrays.copyOfRange(message,i * 4096,(i * 4096) + 4096);
          os.write(msgs[i]);
        }
        if (remainder != 0) {
          lastMsg=Arrays.copyOfRange(message,numMsgs * 4096,message.length);
          os.write(lastMsg);
          LogMaker.println("String_Node_Str" + (lastMsg.length + numMsgs * 4096) + "String_Node_Str"+ message.length+ "String_Node_Str",mainThread.playerID);
        }
      }
 else {
        os.write(message);
      }
      os.flush();
    }
 catch (    IOException e) {
      LogMaker.errorPrintln("String_Node_Str" + e,mainThread.playerID);
    }
catch (    InterruptedException e) {
    }
catch (    Exception e) {
      LogMaker.errorPrintln("String_Node_Str" + e,mainThread.playerID);
    }
 finally {
      buffer.clear();
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (!stopOperation) {
    try {
      NetworkMessage msg;
      try {
        msg=messageQueue.take();
      }
 catch (      InterruptedException e) {
        break;
      }
      Schema schema;
      byte classType;
      if (msg instanceof PlayerRegistrationMessage) {
        schema=playerRegSchema;
        classType=1;
      }
 else       if (msg instanceof NetworkMessageMedium) {
        schema=mediumMsgSchema;
        classType=2;
      }
 else       if (msg instanceof NetworkMessageLarge) {
        schema=largeMsgSchema;
        classType=3;
      }
 else {
        schema=networkMsgSchema;
        classType=0;
      }
      byte[] serializedObject=ProtostuffIOUtil.toByteArray(msg,schema,buffer);
      boolean compressed=false;
      byte[] tempArray=QuickLZ.compress(serializedObject,3);
      if (tempArray.length < serializedObject.length) {
        serializedObject=tempArray;
        compressed=true;
      }
      b.clear();
      b.putInt(serializedObject.length);
      byte[] lengthField=b.array();
      byte[] message=new byte[serializedObject.length + lengthField.length + 2];
      message[0]=classType;
      if (compressed) {
        message[1]=1;
      }
 else {
        message[1]=0;
      }
      System.arraycopy(lengthField,0,message,2,lengthField.length);
      System.arraycopy(serializedObject,0,message,lengthField.length + 2,serializedObject.length);
      if (message.length > 8000) {
        LogMaker.println("String_Node_Str" + message.length + "String_Node_Str",mainThread.playerID);
        int numMsgs=message.length / 4096;
        int remainder=message.length % 4096;
        byte[][] msgs=new byte[numMsgs][4096];
        byte[] lastMsg=new byte[remainder];
        for (int i=0; i < numMsgs; i++) {
          msgs[i]=Arrays.copyOfRange(message,i * 4096,(i * 4096) + 4096);
          os.write(msgs[i]);
        }
        if (remainder != 0) {
          lastMsg=Arrays.copyOfRange(message,numMsgs * 4096,message.length);
          os.write(lastMsg);
          LogMaker.println("String_Node_Str" + (lastMsg.length + numMsgs * 4096) + "String_Node_Str"+ message.length+ "String_Node_Str",mainThread.playerID);
        }
      }
 else {
        os.write(message);
      }
      os.flush();
    }
 catch (    IOException e) {
      LogMaker.errorPrintln("String_Node_Str" + e,mainThread.playerID);
    }
catch (    Exception e) {
      LogMaker.errorPrintln("String_Node_Str" + e,mainThread.playerID);
    }
 finally {
      buffer.clear();
    }
  }
}