You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2016/11/07 20:47:58 UTC

[jira] [Commented] (APLO-398) NullPointerException when Client Identifier not set

    [ https://issues.apache.org/jira/browse/APLO-398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15645400#comment-15645400 ] 

Timothy Bish commented on APLO-398:
-----------------------------------

Recommend you try the ActiveMQ 5.14.1 release or give ActiveMQ Artemis a spin, ActiveMQ Apollo is not actively maintained any longer.  

> 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
>              Labels: patch
>             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)