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.
Flow