Hi all,
I have a simple design question to ask about the Method signature, expecially for the RemoteException part.
As I am planning to have one DataClient interface for both Local and Remote mode. So should I declare all the methods to throw java.io.IOException, as it is a superclass of RemoteException (to fulfil the RMI contract)?
I have read posts about changing the interface to throw java.lang.Exception. It just doesn't seem to be a good design choice, as the method signature sounds like "Use this method and expect that anything can happen". I just think it is not explicit enough.
And if I change my interface to throw IOException, is there any point to keep the custom made DatabaseException?
One of the disadvantage I can think of having throw IOException directly is that it will make the Data.java harder to change, just say that it will throw SQLException in the future....
Now I am struggling to see if I should use a more explicit Exception or a generic Exception (which makes it easier to change in the future). And is it possible to throw custom made exception?
Folks, pls comment on this one.
Thank you very much in advane.
I have a simple design question to ask about the Method signature, expecially for the RemoteException part.
As I am planning to have one DataClient interface for both Local and Remote mode. So should I declare all the methods to throw java.io.IOException, as it is a superclass of RemoteException (to fulfil the RMI contract)?
I have read posts about changing the interface to throw java.lang.Exception. It just doesn't seem to be a good design choice, as the method signature sounds like "Use this method and expect that anything can happen". I just think it is not explicit enough.
And if I change my interface to throw IOException, is there any point to keep the custom made DatabaseException?
One of the disadvantage I can think of having throw IOException directly is that it will make the Data.java harder to change, just say that it will throw SQLException in the future....
Now I am struggling to see if I should use a more explicit Exception or a generic Exception (which makes it easier to change in the future). And is it possible to throw custom made exception?
Folks, pls comment on this one.
Thank you very much in advane.