Program: 49941
Project: 49941
Buggy source:
public void host(PlayNetGame png) throws Exception {
  ServerSocket serverSocket=null;
  Socket clientSocket=null;
  serverSocket=new ServerSocket(27335);
  serverSocket.setSoTimeout(1000);
  while (clientSocket == null) {
    try {
      PlayGame.resetTimers();
      clientSocket=serverSocket.accept();
    }
 catch (    Exception e) {
      if (NewGameMenu.cancelled)       return;
    }
  }
  AnimatedLabel.finished=true;
  ObjectOutputStream out=new ObjectOutputStream(clientSocket.getOutputStream());
  ObjectInputStream in=new ObjectInputStream(clientSocket.getInputStream());
  Object fromUser;
  Object fromServer;
  Game g=PlayNetGame.getGame();
  fromServer=g;
  if (fromServer != null)   out.writeObject(fromServer);
  PlayGame.resetTimers();
  Driver.getInstance().setPanel(png);
  try {
    while (g.isBlackMove() == false) {
      while (PlayNetGame.netMove == null)       Thread.sleep(0);
      fromServer=PlayNetGame.netMove;
      PlayNetGame.netMove=null;
      out.writeObject(fromServer);
      out.flush();
    }
    while (PlayNetGame.running) {
      while (g.isBlackMove() == true && PlayNetGame.running) {
        fromUser=in.readObject();
        FakeMove toMove=(FakeMove)fromUser;
        if (toMove.originCol == -1) {
          int surrender=JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
          if (surrender == 0) {
            out.writeObject(new FakeMove(-2,-2,-2,-2,-2,null));
            Result r=new Result(Result.DRAW);
            r.setText("String_Node_Str");
            g.getLastMove().setResult(r);
            PlayGame.endOfGame(r);
            throw new Exception();
          }
 else {
            out.writeObject(new FakeMove(-3,-3,-3,-3,-3,null));
            continue;
          }
        }
 else {
          g.playMove(g.fakeToRealMove((FakeMove)fromUser));
          if (g.getLastMove().getResult() != null)           continue;
        }
      }
      while (g.isBlackMove() == false && PlayNetGame.running) {
        while (PlayNetGame.netMove == null && !png.drawRequested && PlayNetGame.running)         Thread.sleep(0);
        if (png.drawRequested) {
          fromUser=in.readObject();
          FakeMove toMove=(FakeMove)fromUser;
          if (toMove.originCol == -2) {
            Result r=new Result(Result.DRAW);
            r.setText("String_Node_Str");
            g.getLastMove().setResult(r);
            PlayGame.endOfGame(r);
            png.drawRequested=false;
            throw new Exception();
          }
 else           if (toMove.originCol == -3) {
            JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
            png.drawRequested=false;
            continue;
          }
        }
        fromServer=PlayNetGame.netMove;
        PlayNetGame.netMove=null;
        if (((FakeMove)fromServer).originCol == -1)         png.drawRequested=true;
        out.writeObject(fromServer);
        out.flush();
        if (g.getLastMove().getResult() != null)         break;
      }
    }
  }
 catch (  SocketException e) {
    e.printStackTrace();
    JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
    Driver.getInstance().fileMenu.setVisible(true);
    Driver.getInstance().gameOptions.setVisible(false);
    Driver.getInstance().revertPanel();
    serverSocket.close();
    return;
  }
catch (  EOFException e) {
    e.printStackTrace();
    if (g.getHistory().size() != 0 && g.getHistory().get(g.getHistory().size() - 1).getResult() != null)     return;
    JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
    g.getBlackTimer().stop();
    g.getWhiteTimer().stop();
    Driver.getInstance().fileMenu.setVisible(true);
    Driver.getInstance().gameOptions.setVisible(false);
    Driver.getInstance().revertPanel();
    serverSocket.close();
    return;
  }
catch (  Exception e) {
    e.printStackTrace();
  }
  out.close();
  in.close();
  clientSocket.close();
  serverSocket.close();
}

Fixed version (ground truth):
/** 
 * Method to create the host to wait for a client and to set up the new game
 * @param png the game that is going to be played
 * @throws Exception socket or end of file exception
 */
public void host(PlayNetGame png) throws Exception {
  ServerSocket serverSocket=null;
  Socket clientSocket=null;
  serverSocket=new ServerSocket(27335);
  serverSocket.setSoTimeout(1000);
  while (clientSocket == null) {
    try {
      PlayGame.resetTimers();
      clientSocket=serverSocket.accept();
    }
 catch (    Exception e) {
      if (NewGameMenu.cancelled)       return;
    }
  }
  AnimatedLabel.finished=true;
  ObjectOutputStream out=new ObjectOutputStream(clientSocket.getOutputStream());
  ObjectInputStream in=new ObjectInputStream(clientSocket.getInputStream());
  Object fromUser;
  Object fromServer;
  Game g=PlayNetGame.getGame();
  fromServer=g;
  if (fromServer != null)   out.writeObject(fromServer);
  PlayGame.resetTimers();
  Driver.getInstance().setPanel(png);
  try {
    while (g.isBlackMove() == false) {
      while (PlayNetGame.netMove == null)       Thread.sleep(0);
      fromServer=PlayNetGame.netMove;
      PlayNetGame.netMove=null;
      out.writeObject(fromServer);
      out.flush();
    }
    while (PlayNetGame.running) {
      while (g.isBlackMove() == true && PlayNetGame.running) {
        fromUser=in.readObject();
        FakeMove toMove=(FakeMove)fromUser;
        if (toMove.originCol == -1) {
          int surrender=JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
          if (surrender == 0) {
            out.writeObject(new FakeMove(-2,-2,-2,-2,-2,null));
            Result r=new Result(Result.DRAW);
            r.setText("String_Node_Str");
            g.getLastMove().setResult(r);
            PlayGame.endOfGame(r);
            throw new Exception();
          }
 else {
            out.writeObject(new FakeMove(-3,-3,-3,-3,-3,null));
            continue;
          }
        }
 else {
          g.playMove(g.fakeToRealMove((FakeMove)fromUser));
          if (g.getLastMove().getResult() != null)           continue;
        }
      }
      while (g.isBlackMove() == false && PlayNetGame.running) {
        while (PlayNetGame.netMove == null && !png.drawRequested && PlayNetGame.running)         Thread.sleep(0);
        if (png.drawRequested) {
          fromUser=in.readObject();
          FakeMove toMove=(FakeMove)fromUser;
          if (toMove.originCol == -2) {
            Result r=new Result(Result.DRAW);
            r.setText("String_Node_Str");
            g.getLastMove().setResult(r);
            PlayGame.endOfGame(r);
            png.drawRequested=false;
            throw new Exception();
          }
 else           if (toMove.originCol == -3) {
            JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE);
            png.drawRequested=false;
            continue;
          }
        }
        fromServer=PlayNetGame.netMove;
        PlayNetGame.netMove=null;
        if (((FakeMove)fromServer).originCol == -1)         png.drawRequested=true;
        out.writeObject(fromServer);
        out.flush();
        if (g.getLastMove().getResult() != null)         break;
      }
    }
  }
 catch (  SocketException e) {
    e.printStackTrace();
    JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
    Driver.getInstance().fileMenu.setVisible(true);
    Driver.getInstance().gameOptions.setVisible(false);
    Driver.getInstance().revertPanel();
    serverSocket.close();
    return;
  }
catch (  EOFException e) {
    e.printStackTrace();
    if (g.getHistory().size() != 0 && g.getHistory().get(g.getHistory().size() - 1).getResult() != null)     return;
    JOptionPane.showMessageDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
    g.getBlackTimer().stop();
    g.getWhiteTimer().stop();
    Driver.getInstance().fileMenu.setVisible(true);
    Driver.getInstance().gameOptions.setVisible(false);
    Driver.getInstance().revertPanel();
    serverSocket.close();
    return;
  }
catch (  Exception e) {
    e.printStackTrace();
  }
  out.close();
  in.close();
  clientSocket.close();
  serverSocket.close();
}