activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Himer MARTINEZ (JIRA)" <j...@apache.org>
Subject [jira] [Created] (APLO-398) NullPointerException when Client Identifier not set
Date Mon, 07 Nov 2016 20:44:59 GMT
Himer MARTINEZ created APLO-398:
-----------------------------------

             Summary: NullPointerException when Client Identifier not set
                 Key: APLO-398
                 URL: https://issues.apache.org/jira/browse/APLO-398
             Project: ActiveMQ Apollo
          Issue Type: Improvement
          Components: apollo-mqtt
    Affects Versions: 1.7
         Environment: All
            Reporter: Himer MARTINEZ
            Priority: Blocker
             Fix For: 1.7.1


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());
.................



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message