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.halfOpenElement("conference");
            buf.attribute("name", conference.getName());
            buf.attribute("autojoin", Boolean.toString(conference.isAutoJoin()));
...

and connection will be lost on null pointer exception in
org.jivesoftware.smack.util.XmlStringBuilder.write(XmlStringBuilder.java:570)

Suggested solution - make attribute optional:

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

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.