Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Calling isConnected in MqttAndroidClient soon after initialization causes NPE

Hi,

sorry your question hasn't been answered earlier - I've been on vacation for a month. 

I'm Ian Craggs, the Paho project lead.  The work items and plans are described in a few places:

https://wiki.eclipse.org/Paho/Project_Plan - broad descriptions and new features/work being considered
https://wiki.eclipse.org/Paho#Development - development status
https://projects.eclipse.org/projects/technology.paho - official release plan

I hope these give you a good idea.  Please feel free to ask questions here.

If there is any contribution you would like to make, or improvements you would like to see made, you can start by proposing on this mailing list.

Thanks

Ian



On 12/03/2014 06:52 AM, osiso g wrote:
Hi all,

I recently joined this group and am new to DSRC dev.  Is there a good starting point to start up and catching up with what's going on in this space and what you guys are working on?


To: paho-dev@xxxxxxxxxxx
CC: paho-dev-bounces@xxxxxxxxxxx
From: zhbinbj@xxxxxxxxxx
Date: Wed, 3 Dec 2014 10:34:29 +0800
Subject: Re: [paho-dev] Calling isConnected in MqttAndroidClient soon after initialization causes NPE

Hi,

This NPE issue should be already fixed in https://bugs.eclipse.org/bugs/show_bug.cgi?id=444318


Best Regards,
Bin Zhang(张斌)
--------------------------------------------------------------------------------------------
WebSphere MQ, IBM China Software Development Lab
Notes:   Bin BJ Zhang/China/IBM
E-Mail:  zhbinbj@xxxxxxxxxx
Address: Ring Building 3F, ZhongGuanCun Software Park,

DongBeiWang West Road No.8, Haidian District, Beijing, 100193, China
-------------------------------------------------------------------------------------------


Ranhiru Cooray ---12/02/2014 07:07:19 PM---Hello everyone! I am calling

From: Ranhiru Cooray <ranhiru@xxxxxxxxx>
To: paho-dev@xxxxxxxxxxx
Date: 12/02/2014 07:07 PM
Subject: [paho-dev] Calling isConnected in MqttAndroidClient soon after initialization causes NPE
Sent by: paho-dev-bounces@xxxxxxxxxxx





Hello everyone!

I am calling

client = new MqttAndroidClient(context, "tcp://
192.168.123.177:1883", "XXXX");

and then soon after I call my method connectToMqttServer() which checks if (!client.isConnected()) before attempting to connect.

Going through the source code I see that isConnected is implemented as follows.

public boolean isConnected() {
    mqttService.isConnected(clientHandle);
}


However because I haven't called connect, mqttService will be null and it will thrown a NullPointerException.

I changed it as follows.

return mqttService != null && mqttService.isConnected(clientHandle);

Are there any potential pitfalls in doing this ? Is this the correct way ?

I personally think that it's natural to call isConnected() before calling connect()

Any ideas/comments would be appreciated.

Thanks!

Ranhiru
_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

_______________________________________________ paho-dev mailing list paho-dev@xxxxxxxxxxx To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/paho-dev


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


Back to the top