powered by Jive Software

Bookmarks do not escape Strings for XML

Hi,

I just saw this in the Openfire logs:

org.xmlpull.v1.XmlPullParserException: expected = after attribute name (position: START_TAG seen … xmlns=“storage:bookmarks”><conference name=“Ich liebe **”**Deutsche L… @1:136)
at org.xmlpull.mxp1.MXParser.parseAttribute(MXParser.java:2004)

It seems like Smack does not escape XML correctly in Bookmarks.java:

for(BookmarkedConferenceconference:getBookmarkedConferences()){
            if(conference.isShared()) {
                continue;
            }
            buf.append("<conference ");
            buf.append("name=\"").append(conference.getName()).append("\" ");
            buf.append("autojoin=\"").append(conference.isAutoJoin()).append("\" ");
            buf.append("jid=\"").append(conference.getJid()).append("\" ");
            buf.append(">");             if (conference.getNickname() != null) {
                buf.append("<nick>").append(conference.getNickname()).append("</nick>");
            }             if (conference.getPassword() != null) {
                buf.append("<password>").append(conference.getPassword()).append("</password>");
            }
            buf.append("</conference>");
}

The same is true for FormField.java#toXML()

Thanks for reporting. SMACK-577

Fixed in todays aSmack Snapshot.