aspose file tools*
The moose likes Distributed Java and the fly likes How does RMI handle exceptions? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "How does RMI handle exceptions?" Watch "How does RMI handle exceptions?" New topic
Author

How does RMI handle exceptions?

Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Hi all,
I did a quick troll through the RMI spec, and unless I overlooked something I couldn't find the answer to the following question.
What does RMI do if the server code results in an exception or error? Does the client receive the exact same kind of error? For example, would the client get an ArithmeticException for an integer divide-by-zero on the server? Or do all exceptions get wrapped in into some kind of RemoteException?


Reid - SCJP2 (April 2002)
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

Without looking I would assume the client will receive the exact exception. If its a checked exception I believe the client would be forced to catch it anyway, so why not pass along the unchecked exceptions too? I think remoteExceptions are reserved for things related the the remote nature of a specific issue that causes the exception and not something like arithmetic.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How does RMI handle exceptions?