powered by Jive Software

Null Roster!

From the Javadocs:

getRoster

> public abstract Roster **getRoster**()

Returns the roster for the user.
This method will never return null, instead if the user has not yet logged into the server or is logged in anonymously all modifying methods of the returned roster object like Roster.createEntry(String, String, String[]), Roster.removeEntry(RosterEntry) , etc. except adding or removing RosterListeners will throw an IllegalStateException.

Returns:
the user’s roster.

From my code:

try {
    connection = new XMPPConnection(config);
    Roster roster = connection.getRoster();
    if (roster == null) {
        LOGGER.severe("Roster is null! THAT'S IMPOSSIBLE!!11!1!");
    }
    roster.addRosterListener(this);
    connection.connect();
    connection.login(userName, password);
} catch (XMPPException ex) {
    connection = null;
    throw new Exception("Failed to establish a connection", ex);
}

Output: Roster is null! THAT’S IMPOSSIBLE!!11!1!

Why?