Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 033B1200BC5 for ; Mon, 7 Nov 2016 21:45:02 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 01F4F160AE0; Mon, 7 Nov 2016 20:45:02 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4C088160B11 for ; Mon, 7 Nov 2016 21:45:01 +0100 (CET) Received: (qmail 25319 invoked by uid 500); 7 Nov 2016 20:45:00 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 25042 invoked by uid 99); 7 Nov 2016 20:44:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Nov 2016 20:44:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id B476A2C2ABA for ; Mon, 7 Nov 2016 20:44:59 +0000 (UTC) Date: Mon, 7 Nov 2016 20:44:59 +0000 (UTC) From: "Himer MARTINEZ (JIRA)" To: commits@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (APLO-398) NullPointerException when Client Identifier not set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 07 Nov 2016 20:45:02 -0000 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)