Gabriel Vargas
SCJP, SCJD, now studying for SCWCD and working to be a better person
_ _ ________________________ _ _ <br /> <br />Just SCJP (but 93%)
Originally posted by Nina Binde:
Thanks Javier. The solution you mentioned would not work as is for my case since my ContractorService class does not throw RemoteException.
Instead, what I did was let the ContractorService methods all throw IOException which is a superclass of RemoteException. From there on, I could extend RemoteContractorService from ContractorService.
Initially, I had thought of this, but did not want IOException to be in my business layer. But, now looks like this is the only way I can achieve it.
Thanks again..
Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.
Originally posted by Liviu Carausu:
I also find not nice to have IOException in my business layer....
_ _ ________________________ _ _ <br /> <br />Just SCJP (but 93%)
Originally posted by Nina Binde:
Rinke, In my case, I also have SecurityException in my DB layer along with
IOExceptions. If these exceptions are propagated as is, I think it
would reveal implementation details to the client. I wouldn't want
my UI to deal with IOException and many others. Just one exception
that it can take and display in a dialog box would suffice for our kind of client. What do oyu think?
_ _ ________________________ _ _ <br /> <br />Just SCJP (but 93%)
Originally posted by rinke hoekstra:
I see more people writing this. Maybe I have some blind spot for this, but could you please explain why not? Because I cannot see a problem at all with it.
Thanks, Rinke
Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.
Originally posted by Liviu Carausu:
Somehow it looks to me that IOException is more like a low level exception that belongs to the base layers.
And we can distinguish between different types of exceptions by wrapping the original exception in the exception that we are throwing from the upper layer. There are a lot of exceptions that can be thrown by the low layer, RecordNotFoundException, SecurityException, DuplicateKeyException , IOException, InterruptedException,UnsupportedEncodingException ....
I read somewhere that is recommended to throw exceptions appropriate to the abstraction (I think it was Joshua Bloch's book Effective Java) , meaning that the current layer must catch exceptions from the lower layer and pack them into its own meaningful exceptions.
The only thing that it does not look very natural to me is throwing IOException from the business layer. I know that this is the workaround for masking the RemoteException from the Remote interface and having the Remote interface implementing the local one. But, on the other hand, if the remote interface does not implement the local one, we must only write an adapter at the client side that will allow the client to use the same interface.
I think this handling it is a matter of taste and I do not think that is very important.
Best regards,
Liviu
[ August 22, 2007: Message edited by: Liviu Carausu ]
_ _ ________________________ _ _ <br /> <br />Just SCJP (but 93%)
Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
|