aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Error Messages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Error Messages" Watch "Error Messages" New topic
Author

Error Messages

Amit Kr Kumar
Ranch Hand

Joined: Feb 08, 2002
Posts: 100
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

Joined: Feb 05, 2001
Posts: 17257
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

} 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

Joined: Feb 05, 2001
Posts: 17257
    
    6

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
 
 
subject: Error Messages