Program: 152241
Project: 152241
Buggy source:
/** 
 * Get the data socket. In case of error returns null.
 */
private synchronized Socket createDataSocket() throws Exception {
  dataSoc=null;
  DataConnectionConfiguration dataConfig=session.getListener().getDataConnectionConfiguration();
  try {
    if (!passive) {
      if (secure) {
        LOG.debug("String_Node_Str");
        SslConfiguration ssl=getSslConfiguration();
        if (ssl == null) {
          throw new FtpException("String_Node_Str");
        }
        SSLContext ctx=ssl.getSSLContext();
        SSLSocketFactory socFactory=ctx.getSocketFactory();
        SSLSocket ssoc=(SSLSocket)socFactory.createSocket();
        ssoc.setUseClientMode(false);
        if (ssl.getEnabledCipherSuites() != null) {
          ssoc.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
        }
        dataSoc=ssoc;
      }
 else {
        LOG.debug("String_Node_Str");
        dataSoc=new Socket();
      }
      dataSoc.setReuseAddress(true);
      InetAddress localAddr=resolveAddress(dataConfig.getActiveLocalAddress());
      if (localAddr == null) {
        localAddr=((InetSocketAddress)session.getLocalAddress()).getAddress();
      }
      SocketAddress localSocketAddress=new InetSocketAddress(localAddr,dataConfig.getActiveLocalPort());
      LOG.debug("String_Node_Str",localSocketAddress);
      dataSoc.bind(localSocketAddress);
      dataSoc.connect(new InetSocketAddress(address,port));
    }
 else {
      if (secure) {
        LOG.debug("String_Node_Str");
        SslConfiguration ssl=getSslConfiguration();
        if (ssl == null) {
          throw new FtpException("String_Node_Str");
        }
        SSLContext ctx=ssl.getSSLContext();
        SSLSocketFactory ssocketFactory=ctx.getSocketFactory();
        Socket serverSocket=servSoc.accept();
        SSLSocket sslSocket=(SSLSocket)ssocketFactory.createSocket(serverSocket,serverSocket.getInetAddress().getHostName(),serverSocket.getPort(),true);
        sslSocket.setUseClientMode(false);
        if (ssl.getClientAuth() == ClientAuth.NEED) {
          sslSocket.setNeedClientAuth(true);
        }
 else         if (ssl.getClientAuth() == ClientAuth.WANT) {
          sslSocket.setWantClientAuth(true);
        }
        if (ssl.getEnabledCipherSuites() != null) {
          sslSocket.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
        }
        dataSoc=sslSocket;
      }
 else {
        LOG.debug("String_Node_Str");
        dataSoc=servSoc.accept();
      }
      DataConnectionConfiguration dataCfg=session.getListener().getDataConnectionConfiguration();
      dataSoc.setSoTimeout(dataCfg.getIdleTime() * 1000);
      LOG.debug("String_Node_Str");
    }
  }
 catch (  Exception ex) {
    closeDataConnection();
    LOG.warn("String_Node_Str",ex);
    throw ex;
  }
  dataSoc.setSoTimeout(dataConfig.getIdleTime() * 1000);
  if (dataSoc instanceof SSLSocket) {
    ((SSLSocket)dataSoc).startHandshake();
  }
  return dataSoc;
}

Fixed version (ground truth):
/** 
 * Get the data socket. In case of error returns null.
 */
private synchronized Socket createDataSocket() throws Exception {
  dataSoc=null;
  DataConnectionConfiguration dataConfig=session.getListener().getDataConnectionConfiguration();
  try {
    if (!passive) {
      if (secure) {
        LOG.debug("String_Node_Str");
        SslConfiguration ssl=getSslConfiguration();
        if (ssl == null) {
          throw new FtpException("String_Node_Str");
        }
        SSLContext ctx=ssl.getSSLContext();
        SSLSocketFactory socFactory=ctx.getSocketFactory();
        SSLSocket ssoc=(SSLSocket)socFactory.createSocket();
        ssoc.setUseClientMode(false);
        if (ssl.getEnabledCipherSuites() != null) {
          ssoc.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
        }
        dataSoc=ssoc;
      }
 else {
        LOG.debug("String_Node_Str");
        dataSoc=new Socket();
      }
      dataSoc.setReuseAddress(true);
      InetAddress localAddr=resolveAddress(dataConfig.getActiveLocalAddress());
      if (localAddr == null) {
        localAddr=((InetSocketAddress)session.getLocalAddress()).getAddress();
      }
      SocketAddress localSocketAddress=new InetSocketAddress(localAddr,dataConfig.getActiveLocalPort());
      LOG.debug("String_Node_Str",localSocketAddress);
      dataSoc.bind(localSocketAddress);
      dataSoc.connect(new InetSocketAddress(address,port));
    }
 else {
      if (secure) {
        LOG.debug("String_Node_Str");
        SslConfiguration ssl=getSslConfiguration();
        if (ssl == null) {
          throw new FtpException("String_Node_Str");
        }
        SSLContext ctx=ssl.getSSLContext();
        SSLSocketFactory ssocketFactory=ctx.getSocketFactory();
        Socket serverSocket=servSoc.accept();
        SSLSocket sslSocket=(SSLSocket)ssocketFactory.createSocket(serverSocket,serverSocket.getInetAddress().getHostAddress(),serverSocket.getPort(),true);
        sslSocket.setUseClientMode(false);
        if (ssl.getClientAuth() == ClientAuth.NEED) {
          sslSocket.setNeedClientAuth(true);
        }
 else         if (ssl.getClientAuth() == ClientAuth.WANT) {
          sslSocket.setWantClientAuth(true);
        }
        if (ssl.getEnabledCipherSuites() != null) {
          sslSocket.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
        }
        dataSoc=sslSocket;
      }
 else {
        LOG.debug("String_Node_Str");
        dataSoc=servSoc.accept();
      }
      DataConnectionConfiguration dataCfg=session.getListener().getDataConnectionConfiguration();
      dataSoc.setSoTimeout(dataCfg.getIdleTime() * 1000);
      LOG.debug("String_Node_Str");
    }
  }
 catch (  Exception ex) {
    closeDataConnection();
    LOG.warn("String_Node_Str",ex);
    throw ex;
  }
  dataSoc.setSoTimeout(dataConfig.getIdleTime() * 1000);
  if (dataSoc instanceof SSLSocket) {
    ((SSLSocket)dataSoc).startHandshake();
  }
  return dataSoc;
}