Program: 179498
Project: 179498
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public void run(){
  if (Looper.myLooper() == null) {
    Looper.prepare();
  }
  if (!connected) {
    connectToServer();
  }
  if (connected) {
    isRunning=true;
    registerWithServer(getPlayerRegistrationInformation());
    while (!stopOperation) {
      try {
        NetworkMessage msg=null;
        Schema schema=null;
        byte[] messageHeader=new byte[6];
        int success=in.read(messageHeader);
        if (success == 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;
Log.i(NetworkVariables.TAG,"String_Node_Str" + classType);
break;
}
if (!keepAliveBreak) {
b.clear();
b.put(messageHeader,2,4);
b.rewind();
int mSize=b.getInt();
byte[] object;
try {
object=new byte[mSize];
}
 catch (RuntimeException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + "String_Node_Str" + mSize + "String_Node_Str"+ classType+ "String_Node_Str"+ compressed);
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
shutdownThread();
break;
}
catch (OutOfMemoryError e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + "String_Node_Str" + mSize + "String_Node_Str"+ classType+ "String_Node_Str"+ compressed);
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
shutdownThread();
break;
}
int bytesRead=0;
while (bytesRead != mSize) {
bytesRead+=in.read(object,bytesRead,object.length - bytesRead);
}
Log.i("String_Node_Str","String_Node_Str" + (mSize + 6));
byte[] decompressed;
if (compressed) {
decompressed=QuickLZ.decompress(object);
Log.i("String_Node_Str","String_Node_Str" + decompressed.length + "String_Node_Str"+ mSize+ "String_Node_Str"+ (decompressed.length - mSize));
}
 else {
decompressed=object;
Log.i("String_Node_Str","String_Node_Str" + decompressed.length);
}
ProtostuffIOUtil.mergeFrom(decompressed,msg,schema);
try {
processNetworkMessage(msg);
}
 catch (Exception e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
}
}
}
 else {
if (success == -1) {
Log.e(NetworkVariables.TAG,"String_Node_Str");
shutdownThread();
}
}
}
 catch (InterruptedIOException e) {
}
catch (IOException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
this.shutdownThread();
break;
}
catch (NullPointerException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str",e);
}
catch (BufferOverflowException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str");
}
catch (RuntimeException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
}
catch (NoSuchMethodError e) {
Log.e(NetworkVariables.TAG,"String_Node_Str");
}
 finally {
b.rewind();
b.clear();
buffer.clear();
}
}
}
 else {
shutdownThread();
}
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public void run(){
  if (!connected) {
    connectToServer();
  }
  if (connected) {
    isRunning=true;
    registerWithServer(getPlayerRegistrationInformation());
    while (!stopOperation) {
      try {
        NetworkMessage msg=null;
        Schema schema=null;
        byte[] messageHeader=new byte[6];
        int success=in.read(messageHeader);
        if (success == 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;
Log.i(NetworkVariables.TAG,"String_Node_Str" + classType);
break;
}
if (!keepAliveBreak) {
b.clear();
b.put(messageHeader,2,4);
b.rewind();
int mSize=b.getInt();
byte[] object;
try {
object=new byte[mSize];
}
 catch (RuntimeException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + "String_Node_Str" + mSize + "String_Node_Str"+ classType+ "String_Node_Str"+ compressed);
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
shutdownThread();
break;
}
catch (OutOfMemoryError e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + "String_Node_Str" + mSize + "String_Node_Str"+ classType+ "String_Node_Str"+ compressed);
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
shutdownThread();
break;
}
int bytesRead=0;
while (bytesRead != mSize) {
if (mSize > 4000) Log.i("String_Node_Str","String_Node_Str" + bytesRead + "String_Node_Str"+ mSize);
bytesRead+=in.read(object,bytesRead,object.length - bytesRead);
}
Log.i("String_Node_Str","String_Node_Str" + (mSize + 6));
byte[] decompressed;
if (compressed) {
decompressed=QuickLZ.decompress(object);
Log.i("String_Node_Str","String_Node_Str" + decompressed.length + "String_Node_Str"+ mSize+ "String_Node_Str"+ (decompressed.length - mSize));
}
 else {
decompressed=object;
Log.i("String_Node_Str","String_Node_Str" + decompressed.length);
}
ProtostuffIOUtil.mergeFrom(decompressed,msg,schema);
try {
processNetworkMessage(msg);
}
 catch (Exception e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
}
}
}
 else {
if (success == -1) {
Log.e(NetworkVariables.TAG,"String_Node_Str");
shutdownThread();
}
}
}
 catch (InterruptedIOException e) {
}
catch (IOException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
this.shutdownThread();
break;
}
catch (NullPointerException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str",e);
}
catch (BufferOverflowException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str");
}
catch (RuntimeException e) {
Log.e(NetworkVariables.TAG,"String_Node_Str" + e);
}
catch (NoSuchMethodError e) {
Log.e(NetworkVariables.TAG,"String_Node_Str");
}
 finally {
b.rewind();
b.clear();
buffer.clear();
}
}
}
 else {
shutdownThread();
}
}