Program: 111562
Project: 111562
Buggy source:
public CConn(VncViewer viewer_,java.net.Socket sock_,String vncServerName,boolean reverse){
  serverHost=null;
  serverPort=0;
  sock=sock_;
  viewer=viewer_;
  currentEncoding=Encodings.encodingTight;
  lastServerEncoding=-1;
  fullColour=viewer.fullColour.getValue();
  lowColourLevel=2;
  autoSelect=viewer.autoSelect.getValue();
  shared=viewer.shared.getValue();
  formatChange=false;
  encodingChange=false;
  sameMachine=false;
  fullScreen=viewer.fullScreen.getValue();
  menuKey=Keysyms.F8;
  options=new OptionsDialog(this);
  options.initDialog();
  clipboardDialog=new ClipboardDialog(this);
  firstUpdate=true;
  pendingUpdate=false;
  setShared(shared);
  upg=this;
  msg=this;
  String encStr=viewer.preferredEncoding.getValue();
  int encNum=Encodings.encodingNum(encStr);
  if (encNum != -1) {
    currentEncoding=encNum;
  }
  cp.supportsDesktopResize=true;
  cp.supportsExtendedDesktopSize=true;
  cp.supportsClientRedirect=true;
  cp.supportsDesktopRename=true;
  cp.supportsLocalCursor=viewer.useLocalCursor.getValue();
  cp.customCompressLevel=viewer.customCompressLevel.getValue();
  cp.compressLevel=viewer.compressLevel.getValue();
  cp.noJpeg=viewer.noJpeg.getValue();
  cp.qualityLevel=viewer.qualityLevel.getValue();
  initMenu();
  if (sock != null) {
    String name=sock.getRemoteSocketAddress() + "String_Node_Str" + sock.getPort();
    vlog.info("String_Node_Str" + name);
  }
 else {
    if (vncServerName != null) {
      serverHost=Hostname.getHost(vncServerName);
      serverPort=Hostname.getPort(vncServerName);
    }
 else {
      ServerDialog dlg=new ServerDialog(options,vncServerName,this);
      if (!dlg.showDialog() || dlg.server.getSelectedItem().equals("String_Node_Str")) {
        System.exit(1);
      }
      vncServerName=(String)dlg.server.getSelectedItem();
      serverHost=Hostname.getHost(vncServerName);
      serverPort=Hostname.getPort(vncServerName);
    }
    try {
      sock=new java.net.Socket(serverHost,serverPort);
    }
 catch (    java.io.IOException e) {
      throw new Exception(e.toString());
    }
    vlog.info("String_Node_Str" + serverHost + "String_Node_Str"+ serverPort);
  }
  sameMachine=(sock.getLocalSocketAddress() == sock.getRemoteSocketAddress());
  try {
    sock.setTcpNoDelay(true);
    sock.setTrafficClass(0x10);
    setServerName(serverHost);
    jis=new JavaInStream(sock.getInputStream());
    jos=new JavaOutStream(sock.getOutputStream());
  }
 catch (  java.net.SocketException e) {
    throw new Exception(e.toString());
  }
catch (  java.io.IOException e) {
    throw new Exception(e.toString());
  }
  setStreams(jis,jos);
  initialiseProtocol();
}

Fixed version (ground truth):
public CConn(VncViewer viewer_,java.net.Socket sock_,String vncServerName,boolean reverse){
  serverHost=null;
  serverPort=0;
  sock=sock_;
  viewer=viewer_;
  currentEncoding=Encodings.encodingTight;
  lastServerEncoding=-1;
  fullColour=viewer.fullColour.getValue();
  lowColourLevel=2;
  autoSelect=viewer.autoSelect.getValue();
  shared=viewer.shared.getValue();
  formatChange=false;
  encodingChange=false;
  sameMachine=false;
  fullScreen=viewer.fullScreen.getValue();
  menuKey=Keysyms.F8;
  options=new OptionsDialog(this,this);
  options.initDialog();
  clipboardDialog=new ClipboardDialog(this);
  firstUpdate=true;
  pendingUpdate=false;
  setShared(shared);
  upg=this;
  msg=this;
  String encStr=viewer.preferredEncoding.getValue();
  int encNum=Encodings.encodingNum(encStr);
  if (encNum != -1) {
    currentEncoding=encNum;
  }
  cp.supportsDesktopResize=true;
  cp.supportsExtendedDesktopSize=true;
  cp.supportsClientRedirect=true;
  cp.supportsDesktopRename=true;
  cp.supportsLocalCursor=viewer.useLocalCursor.getValue();
  cp.customCompressLevel=viewer.customCompressLevel.getValue();
  cp.compressLevel=viewer.compressLevel.getValue();
  cp.noJpeg=viewer.noJpeg.getValue();
  cp.qualityLevel=viewer.qualityLevel.getValue();
  initMenu();
  if (sock != null) {
    String name=sock.getRemoteSocketAddress() + "String_Node_Str" + sock.getPort();
    vlog.info("String_Node_Str" + name);
  }
 else {
    if (vncServerName != null) {
      serverHost=Hostname.getHost(vncServerName);
      serverPort=Hostname.getPort(vncServerName);
    }
 else {
      ServerDialog dlg=new ServerDialog(options,vncServerName,this);
      if (!dlg.showDialog() || dlg.server.getSelectedItem().equals("String_Node_Str")) {
        System.exit(1);
      }
      vncServerName=(String)dlg.server.getSelectedItem();
      serverHost=Hostname.getHost(vncServerName);
      serverPort=Hostname.getPort(vncServerName);
    }
    try {
      sock=new java.net.Socket(serverHost,serverPort);
    }
 catch (    java.io.IOException e) {
      throw new Exception(e.toString());
    }
    vlog.info("String_Node_Str" + serverHost + "String_Node_Str"+ serverPort);
  }
  sameMachine=(sock.getLocalSocketAddress() == sock.getRemoteSocketAddress());
  try {
    sock.setTcpNoDelay(true);
    sock.setTrafficClass(0x10);
    setServerName(serverHost);
    jis=new JavaInStream(sock.getInputStream());
    jos=new JavaOutStream(sock.getOutputStream());
  }
 catch (  java.net.SocketException e) {
    throw new Exception(e.toString());
  }
catch (  java.io.IOException e) {
    throw new Exception(e.toString());
  }
  setStreams(jis,jos);
  initialiseProtocol();
}