In Distributable environment,what happens if our component throws an exception(may be checked/unchecked) to others who r using our component. we must handle here itself or let it leave to others to handle? plz. reply soon
RE: In Distributable environment,what happens if our c...
Hi
With my little knowledge i think we need to handle it. In a distributed environment the object which is been called will be a proxy object to the remote object. So it will be better to handle the error in your component.
RE: In Distributable environment,what happens if our c...
You know how the exception is to be handled so handle the exception. You however need to let the caller know that an exception had occurred and to take appropriate actions inform the user of the error.
RE: In Distributable environment,what happens if our c...
It depends on the context of the exception. But usually you may want to wrap the exception in a meaningful way and let the caller know about it. (That's the transparent way of working.) Make sure that the message that the client sees is something that makes sense to the client. For example if your component uses a configuration file then it will obviously throw a FileNotFoundException when it does not find the file. It's a good idea to let the client know which component needed that file and possibly the purpose i.e. configuration. So a message like Component XXX is not able to find its configuration file at this location: YYY is better than the default FileNotFoundException message.
RE: In Distributable environment,what happens if our c...
If your component throws an exception in most cases we should not catch the exception otherwise the calling component will never know that an exception has occured.
What we should do is to force the user of our component to handle the exception so that we can use the stack trace for debugging purpose.
RE: In Distributable environment,what happens if our c...
In exception handling we should use throw clause to throw the exception because exceptions in java are throwable. If any method calls the throw clause it(throw clause) will tell If you call me You must have handle the exception .
So in this situation the caller of that method must have that exception.