File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [Bodgit Scrapper] Thought regarding the DB interface and exceptions 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 "[Bodgit Scrapper] Thought regarding the DB interface and exceptions" Watch "[Bodgit Scrapper] Thought regarding the DB interface and exceptions" New topic
Author

[Bodgit Scrapper] Thought regarding the DB interface and exceptions

Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
Hello all,

What's the problem if the new exceptions in the DB interface all derive from RuntimeException? Is this a terrible thought?

Thanks, Rob


SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
Eben Hewitt
Author
Ranch Hand

Joined: Apr 16, 2004
Posts: 36
If you extend RuntimeException you don't have to declare them in the method definition. That's not a problem per se, but in my view it makes your code a little less clear.

RuntimeException extends exception, and RemoteException extends IOException, so that might be interesting to note for your design if you are using a Proxy.


Eben Hewitt. SCJP, SCWCD, SCJD, SCJWSD for JEE 5, TOGAF 8 Certified Architect, author of Java SOA Cookbook (O'Reilly, 2009) and contributor to 97 Things Every Software Architect Should Know
Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
More problematic actually is that there's an exception called SecurityException which is extended from RuntimeException and I do not have the benefit of an angry compiler telling me where I need to catch it!

I may have to create a SecurityException class as well, and derive it from Exception. You know? Does anyone think this is illegal? I do not see it as so.
 
 
subject: [Bodgit Scrapper] Thought regarding the DB interface and exceptions
 
Similar Threads
Unchecked Exceptions - Remote v Local ?
B&S db interface
PaSSED SCJD!
URLyBird : Need Suggestions on create method and update method
RMI and Adapter Pattern for URLyBird