Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.3309 :

Posted: Thu Jan 07, 2021 9:35 pm
by teodorj
This is a good approach to exception handling because it can handle new exceptions without affecting caller code.
I did not choose this option because java.rmi.ServerException is a checked exception (because of throws) so caller must handle or declare it

Re: About Question enthuware.ocpjp.ii.v11.2.3309 :

Posted: Thu Jan 07, 2021 10:19 pm
by admin
Yes, but the method already has "throws ServerException" clause. So, any existing client is already dealing with it. You can change the method code to anything and the resulting exception will be wrapped inside a ServerException. No change for the client.

Re: About Question enthuware.ocpjp.ii.v11.2.3309 :

Posted: Thu Jan 07, 2021 10:35 pm
by teodorj
Got it. Thanks :)