XMPPConnection.login() discrepancy in javadoc

The javadoc says for login(): “For compatibility and easiness of use the connection will automatically connect to the server if not already connected.” But the code shows

public synchronized void login(String username, String password, String resource) throws XMPPException {

if (!isConnected()) {

           throw new IllegalStateException("Not connected to server.");


Please correct either the javadoc or the code.

I suggest that you keep the behaviour and change the javadoc. Because the XMPPExceptions that the login() and connect() method throw are not good to parse: They are to generic. It would be nice if they where easier to distinguish. At least for the following cases:

  • Connection failed because of a network problem
  • Login failed because of authoritative login errors (ie, bad password, bad username)
  • Login failed because some other problem

Then the login method could do the connect too.


Just found out, that this topic was already discussed a while ago: http://community.igniterealtime.org/message/150094#150094

But nothing has changed since then. Please fix this. The documentation bug has coast me a few hours finding out that .login() does not what the docu says. :frowning:


It has been updated. It will appear in the next release.