Program: 178640
Project: 178640
Buggy source:
public void run(){
  CompressionManager cm=new CompressionManager(this,ptc,fm,out);
  Packet packet=new Packet();
  Packet packetBackup=packet;
  while (!killed()) {
    try {
      packet=in.getPacket(packet);
      if (packet == null) {
        ptc.printLogMessage("String_Node_Str");
        kill();
        continue;
      }
    }
 catch (    EOFException e) {
      ptc.printLogMessage("String_Node_Str");
      kill();
      continue;
    }
catch (    IOException e) {
      System.out.println("String_Node_Str");
      kill();
      continue;
    }
catch (    IllegalStateException ise) {
      kill();
      ptc.printLogMessage(packetBackup + "String_Node_Str");
      ptc.printLogMessage("String_Node_Str" + oldPacketIds);
      continue;
    }
    if (packet.start < packet.end) {
      boolean dontSend=false;
      int packetId=packet.getByte(0) & 0xFF;
      if (packetId == 0x46) {
        System.out.println("String_Node_Str" + packet.getByte(1));
      }
      if (packetId == 0x32) {
        int x=packet.getInt(1);
        int z=packet.getInt(5);
        boolean mode=packet.getByte(9) != 0;
        if (mode) {
          if (!ptc.connectionInfo.addChunk(x,z)) {
            ptc.printLogMessage("String_Node_Str" + x + "String_Node_Str"+ z);
          }
        }
 else {
          if (!ptc.connectionInfo.removeChunk(x,z)) {
            ptc.printLogMessage("String_Node_Str" + x + "String_Node_Str"+ z);
          }
        }
      }
 else       if (packetId == 0x32 || packetId == 0x51) {
        int x=packet.getInt(1);
        int z=packet.getInt(7);
        if (!ptc.connectionInfo.containsChunk(x,z)) {
          ptc.printLogMessage("String_Node_Str" + x + "String_Node_Str"+ z+ "String_Node_Str");
        }
        Packet fakeInit=new Packet32PreChunk(x,z,true);
        cm.addToQueue(fakeInit);
      }
      int clientPlayerId=ptc.connectionInfo.clientPlayerId;
      int serverPlayerId=ptc.connectionInfo.serverPlayerId;
      Set<Integer> activeEntityIds=ptc.connectionInfo.activeEntities;
      int[] entityIdArray=EntityMap.entityIds[packetId];
      if (entityIdArray != null) {
        for (        int pos : entityIdArray) {
          int id=packet.getInt(pos);
          if (id == clientPlayerId) {
            packet.setInt(pos,serverPlayerId);
            updateEntityId(ptc,activeEntityIds,packetId,serverPlayerId);
          }
 else           if (id == serverPlayerId) {
            packet.setInt(pos,clientPlayerId);
            updateEntityId(ptc,activeEntityIds,packetId,clientPlayerId);
          }
 else {
            updateEntityId(ptc,activeEntityIds,packetId,id);
          }
        }
      }
      if (((packetId >= 0x32 && packetId < 0x36) || packetId == 0x82) || (packetId == 0x51)) {
        cm.addToQueue(packet);
        dontSend=true;
      }
      oldPacketIds.add(packet.buffer[packet.start & packet.mask]);
      if (this.oldPacketIds.size() > 20) {
        oldPacketIds.remove();
      }
      if (!dontSend) {
        ptc.connectionInfo.uploaded.addAndGet(packet.end - packet.start);
        if (packetId == 0xFF) {
          String message=packet.getString16(1);
          String newHostname=redirectDetected(message,ptc);
          ptc.printLogMessage("String_Node_Str" + newHostname);
          ptc.connectionInfo.setHostname(newHostname);
          ptc.connectionInfo.redirect=true;
          if (newHostname != null) {
            cm.killTimerAndJoin();
            List<Integer> entityIds=ptc.connectionInfo.clearEntities();
            for (            int id : entityIds) {
              if (id != clientPlayerId) {
                Packet destroy=new Packet1DDestroyEntity(id);
                fm.addPacketToHighQueue(out,destroy,this);
              }
            }
            List<Long> activeChunks=ptc.connectionInfo.clearChunks();
            for (            Long chunk : activeChunks) {
              int x=ConnectionInfo.getX(chunk);
              int z=ConnectionInfo.getZ(chunk);
              Packet unload=new Packet32PreChunk(x,z,false);
              fm.addPacketToHighQueue(out,unload,this);
            }
            Packet packetBed=new Packet46Bed(2);
            fm.addPacketToHighQueue(out,packetBed,this);
            kill();
            continue;
          }
        }
        fm.addPacketToHighQueue(out,packet,this);
      }
    }
  }
  try {
    out.flush();
  }
 catch (  IOException e) {
    ptc.printLogMessage("String_Node_Str");
  }
  cm.killTimerAndJoin();
synchronized (out) {
    try {
      out.flush();
      out.close();
    }
 catch (    IOException ioe) {
      ptc.printLogMessage("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void run(){
  CompressionManager cm=new CompressionManager(this,ptc,fm,out);
  Packet packet=new Packet();
  Packet packetBackup=packet;
  while (!killed()) {
    try {
      packet=in.getPacket(packet);
      if (packet == null) {
        ptc.printLogMessage("String_Node_Str");
        kill();
        continue;
      }
    }
 catch (    EOFException e) {
      ptc.printLogMessage("String_Node_Str");
      kill();
      continue;
    }
catch (    IOException e) {
      System.out.println("String_Node_Str");
      kill();
      continue;
    }
catch (    IllegalStateException ise) {
      kill();
      ptc.printLogMessage(packetBackup + "String_Node_Str");
      ptc.printLogMessage("String_Node_Str" + oldPacketIds);
      continue;
    }
    if (packet.start < packet.end) {
      boolean dontSend=false;
      int packetId=packet.getByte(0) & 0xFF;
      if (packetId == 0x32) {
        int x=packet.getInt(1);
        int z=packet.getInt(5);
        boolean mode=packet.getByte(9) != 0;
        if (mode) {
          if (!ptc.connectionInfo.addChunk(x,z)) {
            ptc.printLogMessage("String_Node_Str" + x + "String_Node_Str"+ z);
          }
        }
 else {
          if (!ptc.connectionInfo.removeChunk(x,z)) {
            ptc.printLogMessage("String_Node_Str" + x + "String_Node_Str"+ z);
          }
        }
      }
 else       if (packetId == 0x32 || packetId == 0x51) {
        int x=packet.getInt(1);
        int z=packet.getInt(7);
        if (!ptc.connectionInfo.containsChunk(x,z)) {
          ptc.printLogMessage("String_Node_Str" + x + "String_Node_Str"+ z+ "String_Node_Str");
        }
        Packet fakeInit=new Packet32PreChunk(x,z,true);
        cm.addToQueue(fakeInit);
      }
      int clientPlayerId=ptc.connectionInfo.clientPlayerId;
      int serverPlayerId=ptc.connectionInfo.serverPlayerId;
      Set<Integer> activeEntityIds=ptc.connectionInfo.activeEntities;
      int[] entityIdArray=EntityMap.entityIds[packetId];
      if (entityIdArray != null) {
        for (        int pos : entityIdArray) {
          int id=packet.getInt(pos);
          if (id == clientPlayerId) {
            packet.setInt(pos,serverPlayerId);
            updateEntityId(ptc,activeEntityIds,packetId,serverPlayerId);
          }
 else           if (id == serverPlayerId) {
            packet.setInt(pos,clientPlayerId);
            updateEntityId(ptc,activeEntityIds,packetId,clientPlayerId);
          }
 else {
            updateEntityId(ptc,activeEntityIds,packetId,id);
          }
        }
      }
      if (((packetId >= 0x32 && packetId < 0x36) || packetId == 0x82) || (packetId == 0x51)) {
        cm.addToQueue(packet);
        dontSend=true;
      }
      oldPacketIds.add(packet.buffer[packet.start & packet.mask]);
      if (this.oldPacketIds.size() > 20) {
        oldPacketIds.remove();
      }
      if (!dontSend) {
        ptc.connectionInfo.uploaded.addAndGet(packet.end - packet.start);
        if (packetId == 0xFF) {
          String message=packet.getString16(1);
          String newHostname=redirectDetected(message,ptc);
          ptc.printLogMessage("String_Node_Str" + newHostname);
          ptc.connectionInfo.setHostname(newHostname);
          ptc.connectionInfo.redirect=true;
          if (newHostname != null) {
            cm.killTimerAndJoin();
            List<Integer> entityIds=ptc.connectionInfo.clearEntities();
            for (            int id : entityIds) {
              if (id != clientPlayerId) {
                Packet destroy=new Packet1DDestroyEntity(id);
                fm.addPacketToHighQueue(out,destroy,this);
              }
            }
            List<Long> activeChunks=ptc.connectionInfo.clearChunks();
            for (            Long chunk : activeChunks) {
              int x=ConnectionInfo.getX(chunk);
              int z=ConnectionInfo.getZ(chunk);
              Packet unload=new Packet32PreChunk(x,z,false);
              fm.addPacketToHighQueue(out,unload,this);
            }
            Packet packetBed=new Packet46Bed(2);
            fm.addPacketToHighQueue(out,packetBed,this);
            kill();
            continue;
          }
        }
        fm.addPacketToHighQueue(out,packet,this);
      }
    }
  }
  try {
    out.flush();
  }
 catch (  IOException e) {
    ptc.printLogMessage("String_Node_Str");
  }
  cm.killTimerAndJoin();
}