Program: 72447
Project: 72447
Buggy source:
/** 
 * Create a server that can accept socket connection requests on behalf of the specified JavaScript SocketServer object. After this is called, the specified JavaScript SocketServer object will emit the following events: <ul> <li> listening: Emitted when the server is listening. This will be passed the port number that the server is listening on (this is useful if the port is specified to be 0). <li> connection: Emitted when a new connection is established after a request from (possibly remote) client. This will be passed an instance of the JavaScript Socket class that is defined in the socket.js module. That instance has a send() and close() function that can be used to send data or to close the socket. It is also an event emitter that emits 'close', 'data', and 'error' events. <li> error: If this server fails to start listening. An error message will be passed to any event handler. </ul>
 * @param socketServer The JavaScript SocketServer instance.
 * @param options The options (see the socket.js JavaScript module).
 */
public void openServer(final ScriptObjectMirror socketServer,final Map<String,Object> options){
  ClientAuth auth=ClientAuth.NONE;
  String authSpec=(String)options.get("String_Node_Str");
  if (authSpec.toLowerCase().trim().equals("String_Node_Str")) {
    auth=ClientAuth.REQUEST;
  }
 else   if (authSpec.toLowerCase().trim().equals("String_Node_Str")) {
    auth=ClientAuth.REQUIRED;
  }
  final NetServerOptions serverOptions=new NetServerOptions().setClientAuth(auth).setHost((String)options.get("String_Node_Str")).setIdleTimeout((Integer)options.get("String_Node_Str")).setTcpKeepAlive((Boolean)options.get("String_Node_Str")).setPort((Integer)options.get("String_Node_Str")).setReceiveBufferSize((Integer)options.get("String_Node_Str")).setSendBufferSize((Integer)options.get("String_Node_Str")).setSsl((Boolean)options.get("String_Node_Str")).setTcpNoDelay((Boolean)options.get("String_Node_Str"));
  if (serverOptions.isSsl()) {
    PfxOptions pfxOptions=new PfxOptions();
    String pfxKeyCertPath=(String)options.get("String_Node_Str");
    File pfxKeyCertFile=FileUtilities.nameToFile(pfxKeyCertPath,null);
    if (pfxKeyCertFile == null) {
      _error(socketServer,"String_Node_Str");
      return;
    }
    try {
      pfxOptions.setPath(pfxKeyCertFile.getCanonicalPath());
    }
 catch (    IOException e) {
      _error(socketServer,"String_Node_Str" + pfxKeyCertFile);
      return;
    }
    String pfxKeyCertPassword=(String)options.get("String_Node_Str");
    pfxOptions.setPassword(pfxKeyCertPassword);
    serverOptions.setPfxKeyCertOptions(pfxOptions);
    if (serverOptions.getClientAuth() != ClientAuth.NONE) {
      PemTrustOptions pemTrustOptions=new PemTrustOptions();
      String caCertPath=(String)options.get("String_Node_Str");
      File caCertFile=FileUtilities.nameToFile(caCertPath,null);
      if (caCertFile == null) {
        _error(socketServer,"String_Node_Str");
        return;
      }
      try {
        pemTrustOptions.addCertPath(caCertFile.getCanonicalPath());
        serverOptions.setPemTrustOptions(pemTrustOptions);
      }
 catch (      IOException e) {
        _error(socketServer,"String_Node_Str" + caCertFile);
        return;
      }
    }
  }
  submit(() -> {
    final NetServer server=_vertx.createNetServer(serverOptions);
    _issueResponse(() -> {
      socketServer.callMember("String_Node_Str",server);
    }
);
    server.connectHandler(socket -> {
      _issueResponse(() -> {
        socketServer.callMember("String_Node_Str",socket);
      }
);
    }
);
    try {
      server.listen(result -> {
        _issueResponse(() -> {
          if (result.succeeded()) {
            socketServer.callMember("String_Node_Str","String_Node_Str",server.actualPort());
          }
 else {
            _error("String_Node_Str" + result);
          }
        }
);
      }
);
    }
 catch (    Throwable ex) {
      _error(socketServer,"String_Node_Str" + ex);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Create a server that can accept socket connection requests on behalf of the specified JavaScript SocketServer object. After this is called, the specified JavaScript SocketServer object will emit the following events: <ul> <li> listening: Emitted when the server is listening. This will be passed the port number that the server is listening on (this is useful if the port is specified to be 0). <li> connection: Emitted when a new connection is established after a request from (possibly remote) client. This will be passed an instance of the JavaScript Socket class that is defined in the socket.js module. That instance has a send() and close() function that can be used to send data or to close the socket. It is also an event emitter that emits 'close', 'data', and 'error' events. <li> error: If this server fails to start listening. An error message will be passed to any event handler. </ul>
 * @param socketServer The JavaScript SocketServer instance.
 * @param options The options (see the socket.js JavaScript module).
 */
public void openServer(final ScriptObjectMirror socketServer,final Map<String,Object> options){
  ClientAuth auth=ClientAuth.NONE;
  String authSpec=(String)options.get("String_Node_Str");
  if (authSpec.toLowerCase().trim().equals("String_Node_Str")) {
    auth=ClientAuth.REQUEST;
  }
 else   if (authSpec.toLowerCase().trim().equals("String_Node_Str")) {
    auth=ClientAuth.REQUIRED;
  }
  final NetServerOptions serverOptions=new NetServerOptions().setClientAuth(auth).setHost((String)options.get("String_Node_Str")).setIdleTimeout((Integer)options.get("String_Node_Str")).setTcpKeepAlive((Boolean)options.get("String_Node_Str")).setPort((Integer)options.get("String_Node_Str")).setReceiveBufferSize((Integer)options.get("String_Node_Str")).setSendBufferSize((Integer)options.get("String_Node_Str")).setSsl((Boolean)options.get("String_Node_Str")).setTcpNoDelay((Boolean)options.get("String_Node_Str"));
  if (serverOptions.isSsl()) {
    PfxOptions pfxOptions=new PfxOptions();
    String pfxKeyCertPath=(String)options.get("String_Node_Str");
    File pfxKeyCertFile=FileUtilities.nameToFile(pfxKeyCertPath,null);
    if (pfxKeyCertFile == null) {
      _error(socketServer,"String_Node_Str");
      return;
    }
    try {
      pfxOptions.setPath(pfxKeyCertFile.getCanonicalPath());
    }
 catch (    IOException e) {
      _error(socketServer,"String_Node_Str" + pfxKeyCertFile);
      return;
    }
    String pfxKeyCertPassword=(String)options.get("String_Node_Str");
    pfxOptions.setPassword(pfxKeyCertPassword);
    serverOptions.setPfxKeyCertOptions(pfxOptions);
    if (serverOptions.getClientAuth() != ClientAuth.NONE) {
      PemTrustOptions pemTrustOptions=new PemTrustOptions();
      String caCertPath=(String)options.get("String_Node_Str");
      File caCertFile=FileUtilities.nameToFile(caCertPath,null);
      if (caCertFile == null) {
        _error(socketServer,"String_Node_Str");
        return;
      }
      try {
        pemTrustOptions.addCertPath(caCertFile.getCanonicalPath());
        serverOptions.setPemTrustOptions(pemTrustOptions);
      }
 catch (      IOException e) {
        _error(socketServer,"String_Node_Str" + caCertFile);
        return;
      }
    }
  }
  submit(() -> {
    final NetServer server=_vertx.createNetServer(serverOptions);
    _issueResponse(() -> {
      socketServer.callMember("String_Node_Str",server);
    }
);
    server.connectHandler(socket -> {
      socketServer.callMember("String_Node_Str",socket);
    }
);
    try {
      server.listen(result -> {
        _issueResponse(() -> {
          if (result.succeeded()) {
            socketServer.callMember("String_Node_Str","String_Node_Str",server.actualPort());
          }
 else {
            _error("String_Node_Str" + result);
          }
        }
);
      }
);
    }
 catch (    Throwable ex) {
      _error(socketServer,"String_Node_Str" + ex);
    }
  }
);
}