File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Messages

 
Amit Kr Kumar
Ranch Hand
Posts: 100
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Team
What should be the error messages to be shown to the user if any of the following error occurs while starting the server :
All these exceptions occurs while binding connection factory in to RMI registry :

1) ConnectException
2) AlreadyBoundException
3) MalformedURLException and AccessException
4) RemoteException
Amit
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well at this point we can assume that there is no clients, because they couldn't attach to the server anyway, it is not up yet.
OK, messages
1) ConnectException
2) AlreadyBoundException
3) MalformedURLException and AccessException
4) RemoteException
1) I would assume because there are no clients yet, this exception won't be thrown.
2) Use rebind, and you won't get this exception.
3) Not sure about this one.
4) This I don't think will be thrown at this point.

OK so here is my real best way I solved this issue.

Mark
 
John Smith
Ranch Hand
Posts: 2937
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

} catch (Exception e) { server.showErrorDialog(new Exception("Server could not be Started."));

Virtually any book or reference on exception handling will say "Never catch exceptions of type Exception, only subclasses of it". In my server code, I catch all possible exception and map them to my own ServerException. When the ServerException is caught, a meaningfull error description is displayed. Here is a segment of code:

Eugene.
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True, but in the case of starting up the server, any type of exception would show the same message in my case, so whether I caught just Exception or all specific excpetions and each one of those called the same method witht he same message. In this case all exceptions are handled identical, and therefore better to just catch the generalized exception.
Mark
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic