aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes general qeustion about exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "general qeustion about exceptions" Watch "general qeustion about exceptions" New topic
Author

general qeustion about exceptions

Peter Aarum
Ranch Hand

Joined: Jan 14, 2010
Posts: 44
Hello everybody!

I have a kind of general qeustion about exceptions. I use this aproach: for instance, the RandomAccessFile constructor throws FileNotFoundException. I wrap this exception in my facade with my own DatabaseAccessException to hide implementation to the next tier, the Service tier.

Your view on this?

Best ragards
Peter
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4349

(I did exactly the same, you should always hide implementation details, so you can easily switch from a flat file to a RDBMS for example)

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Prasanna Puttappa
Ranch Hand

Joined: Jul 21, 2003
Posts: 54
This is a correct approach in case you do not want to expose system exception to calling program. Similar approach is used when calling EJB methods from the client/business delegate classes. Instead of exposing system exceptions such as RemotException, CreateException to client you can throw custom application exception like ResourceNotAvaiableException.


~Prasanna (SCJP5.0, SCWCD5)
Peter Aarum
Ranch Hand

Joined: Jan 14, 2010
Posts: 44
Thanks for the reply Roel! You are tha man!

Thanks Prasanna as well (took long time writing message so...)

A releaf to know I am not off base totally

BR
Peter
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 220

Hi All,

Good question ... So far the only Data class exception I have is InvalidDatabaseException for when I run into
a Database File Format problem reading the cookie, record flag, etc.

I didn't think of this case.


Thanks,

Carlos.


SCSA, OCA, SCJP 5.0, SCJD http://www.linkedin.com/in/carlosamorillo
 
I agree. Here's the link: jrebel
 
subject: general qeustion about exceptions
 
Similar Threads
JSP Specs, Chap 5, Qeustion?????
Servlet Qeustion on VAJava Cert
Quick Qeustion
need your help about a access qeustion.