File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes planning RecordNotFoundException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "planning RecordNotFoundException" Watch "planning RecordNotFoundException" New topic

planning RecordNotFoundException

Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
This is my planning:

1. subclass RNFE to Exception.
2. in the place of create rnfe object, explicitly set the cause and message;
3. in the place that throws rnfe but actual cause is from some other type, e.g., IOException, still refer to 2 with different values;
4. in db server, if any catch of rnfe, just pass up and eventually client will catch it.
5. it is client's job to decode the error and decide what to do with them (may involve user's interaction and we as developer may give suggestion to user.).

Any comments? I haven't look at SecurityException, DuplicateException, but may apply the same strategy if my previous scheme stands.

Thanks very much for any input.

--------<br />Andy Zhu<br />scjp 1.4<br />scjd 1.4<br />SAS Certified Programmer 9.0
Ben Zung
Ranch Hand

Joined: Mar 25, 2004
Posts: 109
Andy. You can find lots of topics on the exception handling in this forum by doing a search on whatever you want to know.
To me, your point 1,2,4,5 seems fine but point 3 may need more discussion.
There was a topic exactly talking about it I just could not find it.

I'll post it here if I do.

[ June 01, 2004: Message edited by: Bing Yuen ]
Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
Thank you, Bing. I am very interested in the message you referred to.
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1066
Exception chaining is a good idea. There is already a java.lang.SecurityException of type RuntimeException defined in the JDK API. I am using that in my assignment.
I agree. Here's the link:
subject: planning RecordNotFoundException
It's not a secret anymore!