powered by Jive Software

BookmarkManager causes disconnect if bookmark has null name

I’m using Smack 4.3.4

According to https://xmpp.org/extensions/xep-0048.html#format-conference ‘name’ attribute in bookmarked conference is recommended but not required. Scenario - I use my xmpp account with some other software and it created bookmarked conference with empty name. Then I open this account in a program based on Smack. If I add or remove another bookmark with BookmarkManager the existing null-name bookmark will cause Bookmarks.toXML() to create empty attribute:

            buf.attribute("name", conference.getName());
            buf.attribute("autojoin", Boolean.toString(conference.isAutoJoin()));

and connection will be lost on null pointer exception in

Suggested solution - make attribute optional:

buf.optAttribute(“name”, conference.getName());