powered by Jive Software

Bug in .getMode() on Presence Packets?

Is it possible that there is a null-pointer exception which is catched in a strange way when trying to use .getMode() on Presence Packets that appear when user comes online (or back online from away)?

When someone comes online, it’'s usually not displayed as a “mode” attribute in the packets. but they are type=available and NO mode

According to http://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/ smack/packet/Presence.Mode.html there is a mode attribute called “available”, but I haven’'t received that mode on my tests.

On those packets, the method should at least return an empty string or null. But as soon as I touch .getMode() on one of those packets, my current method simply seems to “break()”. (no stacktrace)

Is it a bug or did I do something wrong?

Just stumbled across the same thing.

I could get xa, dnd but just no available in Presence.Mode.

After reading your post, I watched again at the JavaDocs and there it reads:

“A null presence mode value is interpreted to be the same thing as Presence.Mode.available”.

This interpretation gives you ‘‘available’’ with all offline contacts.

I guess we’'re supposed to go around that by using the new convenience methods isAway() and

isAvailable(). isAway() first checks if Presence.Type is available and if so checks the Presence.Mode,

isAvailable() only the Presence.Type.

But I got no idea why you don’'t get a null value, I do.

Hope I could help a little,

with greetings from Berlin,


Message was edited by: schurwool

Message was edited by: schurwool