• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S: Unimplemented exceptions

 
Aaron John
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, sorry if this has been brought up before, but I wasn't able to find anything regarding the following.

The assignment specification says.

Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package.

So my interface contains RecordNotFoundException and DuplicateKeyException. To my understanding member classes do not have any visibility outside of the package it belongs to. So RecordNotFoundException is only visible in the db package. Does that mean I must define my exceptions as the following?



If that's the case, how can I handle a RecordNotFoundException in my business layer?

Also in my business layer I defined new interfaces, is it necessary to put this interface in the suncertiy.db package as per the specification, or put the new interface in my business package?

thanks
[ June 06, 2008: Message edited by: Aaron John ]
 
Aaron John
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe I've answered my own question with this link

http://www.coderanch.com/t/188630/java-developer-SCJD/certification/Exceptions-created-as-member-classes

A member class is not a class that has visibility within a given package. This clears up my misunderstanding.

So obviously it makes sense to have these exceptions as public.

However for my other question, if I defined an exception in my business layer, would it be best to put that exception in the suncertify.db package or put that exception in my business layer package?
 
Soroj Margun
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I think you should put your exception class where it's belong to. This is an OO design concept.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic