I think it does. XMPPException is thrown on errors on the XMPP protocol layer, SmackException is thrown in case of internal Smack errors, The other two are standard.
I understand they are different exceptions. However, if any of those exceptions happen, there is no way to recover from the error. It means the user could not connect or login, so the client application cant proceed. The recommendation is to use unchecked exceptions.
In any of those cases, the only error message we could show to the user is either “It was not possible to connect: (host not found, timeout, etc)” or “It was not possible to login: (incorrect username/password, inactive account, etc)”.
Although I don’t think that this is a good practice, Java’s try/multi-catch makes it easy to do so.
Multi-catch is a bad practice when you have the option to handle each exception in a different way but you are doing the same thing for all of them instead. If there is an error in the XMPP protocol layer or an internal Smack error during connection or login, the client app simply cannot proceed.
Unchecked exceptions for a network library are a permanent cause of surprise. Hence I decided against them
You can use JavaDoc to document any exception a method may throw, if it’s checked or not. This way, there will be no surprise. The developer will have to handle them somewhere. He/she has the option to handle individually or in a multi-catch. The point in using unchecked exceptions is that you give freedom for the developer and make things easier.
Correct me if I am wrong, but it appears that at least some exceptions in javax.security.auth.login
are checked exceptions
Oh, yeah. But anyway, the method could throw some specific exception as those, but preferably, unchecked ones. However, if those Java.security exceptions are used, at least they are very specific.