Uploaded image for project: 'ActiveMQ Apollo (Retired)'
  1. ActiveMQ Apollo (Retired)
  2. APLO-398

NullPointerException when Client Identifier not set

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Blocker
    • Resolution: Won't Do
    • 1.7
    • 1.7.1
    • apollo-mqtt
    • All
    • Patch, Important

    Description

      Hello,

      In some cases, some specific MQTT clients does not set the Client Identifier when stablishing a connection, in this case the client_id.toString is generating a NullPointerException,

      I saw this with some specific MQTT clients from IoT manufacturers like Adafruit, they provide a C API and do not check if the client identifier is set.

      Because the Client Identifier is mandatory, I think it could be better to check if is set and, if not, exit gracefully with a specific error.

      This can be blocking for people (it was my case) because they do not understand why the connection is not stablished and they have juste a NullPointerException.

      I could submit a patch but since a I'm not still contributor, I think it will be faster you do it,

      -----------------------

      public void on_mqtt_connect() {

      final CONNACK connack = new CONNACK();

      if (connect_message.version() != 3)

      { connack.code(CONNACK.Code.CONNECTION_REFUSED_UNACCEPTED_PROTOCOL_VERSION); die(connack, "Unsupported protocol version: " + connect_message.version()); }

      UTF8Buffer client_id = connect_message.clientId();
      security_context.user_$eq(Scala2Java.toString(connect_message.userName()));
      security_context.password_$eq(Scala2Java.toString(connect_message.password()));
      security_context.session_id_$eq(client_id.toString());
      .................

      Attachments

        Activity

          People

            Unassigned Unassigned
            Himer Himer MARTINEZ
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: