Program: 72330
Project: 72330
Buggy source:
/** 
 * Create a client-side socket on behalf of the specified JavaScript SocketClient object. After this is called, the specified socketClient will emit the following events: * open: Emitted when the connection has been established with the server. This will not be passed any arguments. * data: Emitted when data is received on the socket. The received data will be an argument to the event. * close: Emitted when a socket is closed. This will not be passed any arguments. * error: Emitted when an error occurs. This will be passed an error message.
 * @param socketClient The JavaScript SocketClient instance.
 * @param port The remote port to connect to.
 * @param host The remote host to connect to.
 * @param options The options (see the socket.js JavaScript module).
 */
public void openClientSocket(final ScriptObjectMirror socketClient,final int port,final String host,Map<String,Object> options){
  if ((Boolean)options.get("String_Node_Str")) {
    if (!MessageHandler.yesNoQuestion("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str")) {
      return;
    }
  }
  final NetClientOptions clientOptions=new NetClientOptions().setConnectTimeout((Integer)options.get("String_Node_Str")).setIdleTimeout((Integer)options.get("String_Node_Str")).setReceiveBufferSize((Integer)options.get("String_Node_Str")).setReconnectAttempts((Integer)options.get("String_Node_Str")).setReconnectInterval((Integer)options.get("String_Node_Str")).setSendBufferSize((Integer)options.get("String_Node_Str")).setSsl((Boolean)options.get("String_Node_Str")).setTcpKeepAlive((Boolean)options.get("String_Node_Str")).setTcpNoDelay((Boolean)options.get("String_Node_Str")).setTrustAll((Boolean)options.get("String_Node_Str"));
  if (clientOptions.isSsl() && !clientOptions.isTrustAll()) {
    PemTrustOptions pemTrustOptions=new PemTrustOptions();
    String caCertPath=(String)options.get("String_Node_Str");
    File caCertFile=FileUtilities.nameToFile(caCertPath,null);
    if (caCertFile == null) {
      _error(socketClient,"String_Node_Str");
      return;
    }
    try {
      pemTrustOptions.addCertPath(caCertFile.getCanonicalPath());
      clientOptions.setPemTrustOptions(pemTrustOptions);
    }
 catch (    IOException e) {
      _error(socketClient,"String_Node_Str" + caCertFile);
      return;
    }
  }
  String pfxKeyCertPath=(String)options.get("String_Node_Str");
  File pfxKeyCertFile=FileUtilities.nameToFile(pfxKeyCertPath,null);
  if (pfxKeyCertFile != null) {
    PfxOptions pfxOptions=new PfxOptions();
    try {
      pfxOptions.setPath(pfxKeyCertFile.getCanonicalPath());
    }
 catch (    IOException e) {
      _error(socketClient,"String_Node_Str" + pfxKeyCertFile);
      return;
    }
    String pfxKeyCertPassword=(String)options.get("String_Node_Str");
    pfxOptions.setPassword(pfxKeyCertPassword);
    clientOptions.setPfxKeyCertOptions(pfxOptions);
  }
  submit(() -> {
    NetClient client=_vertx.createNetClient(clientOptions);
    client.connect(port,host,response -> {
      if (response.succeeded()) {
        NetSocket socket=response.result();
synchronized (_actor) {
          socketClient.callMember("String_Node_Str",socket,client);
        }
      }
 else {
        String message="String_Node_Str";
        Throwable cause=response.cause();
        while (cause != null) {
          message=message + "String_Node_Str" + cause.getMessage();
          cause=cause.getCause();
        }
        String errorMessage="String_Node_Str" + message;
        _error(socketClient,errorMessage,cause);
      }
    }
);
  }
);
}

Fixed version (ground truth):
/** 
 * Create a client-side socket on behalf of the specified JavaScript SocketClient object. After this is called, the specified socketClient will emit the following events: * open: Emitted when the connection has been established with the server. This will not be passed any arguments. * data: Emitted when data is received on the socket. The received data will be an argument to the event. * close: Emitted when a socket is closed. This will not be passed any arguments. * error: Emitted when an error occurs. This will be passed an error message.
 * @param socketClient The JavaScript SocketClient instance.
 * @param port The remote port to connect to.
 * @param host The remote host to connect to.
 * @param options The options (see the socket.js JavaScript module).
 */
public void openClientSocket(final ScriptObjectMirror socketClient,final int port,final String host,Map<String,Object> options){
  if ((Boolean)options.get("String_Node_Str")) {
    if (!MessageHandler.yesNoQuestion("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str")) {
      return;
    }
  }
  final NetClientOptions clientOptions=new NetClientOptions().setConnectTimeout((Integer)options.get("String_Node_Str")).setIdleTimeout((Integer)options.get("String_Node_Str")).setReceiveBufferSize((Integer)options.get("String_Node_Str")).setReconnectAttempts((Integer)options.get("String_Node_Str")).setReconnectInterval((Integer)options.get("String_Node_Str")).setSendBufferSize((Integer)options.get("String_Node_Str")).setSsl((Boolean)options.get("String_Node_Str")).setTcpKeepAlive((Boolean)options.get("String_Node_Str")).setTcpNoDelay((Boolean)options.get("String_Node_Str")).setTrustAll((Boolean)options.get("String_Node_Str"));
  if (clientOptions.isSsl() && !clientOptions.isTrustAll()) {
    PemTrustOptions pemTrustOptions=new PemTrustOptions();
    String caCertPath=(String)options.get("String_Node_Str");
    File caCertFile=FileUtilities.nameToFile(caCertPath,null);
    if (caCertFile == null) {
      _error(socketClient,"String_Node_Str");
      return;
    }
    try {
      pemTrustOptions.addCertPath(caCertFile.getCanonicalPath());
      clientOptions.setPemTrustOptions(pemTrustOptions);
    }
 catch (    IOException e) {
      _error(socketClient,"String_Node_Str" + caCertFile);
      return;
    }
  }
  String pfxKeyCertPath=(String)options.get("String_Node_Str");
  File pfxKeyCertFile=FileUtilities.nameToFile(pfxKeyCertPath,null);
  if (pfxKeyCertFile != null) {
    PfxOptions pfxOptions=new PfxOptions();
    try {
      pfxOptions.setPath(pfxKeyCertFile.getCanonicalPath());
    }
 catch (    IOException e) {
      _error(socketClient,"String_Node_Str" + pfxKeyCertFile);
      return;
    }
    String pfxKeyCertPassword=(String)options.get("String_Node_Str");
    pfxOptions.setPassword(pfxKeyCertPassword);
    clientOptions.setPfxKeyCertOptions(pfxOptions);
  }
  submit(() -> {
    NetClient client=_vertx.createNetClient(clientOptions);
    client.connect(port,host,response -> {
      if (response.succeeded()) {
        NetSocket socket=response.result();
synchronized (_actor) {
          socketClient.callMember("String_Node_Str",socket,client);
        }
      }
 else {
        StringBuffer message=new StringBuffer();
        Throwable cause=response.cause();
        Throwable initialCause=cause;
        while (cause != null) {
          message.append("String_Node_Str" + cause.getMessage());
          cause=cause.getCause();
        }
        String errorMessage="String_Node_Str" + message;
        _error(socketClient,errorMessage,initialCause);
      }
    }
);
  }
);
}