Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exceptions = member classes ?

 
Andy Jung
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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


"Java in a Nutshell" defines member classes this way:
A member class is a class that is declared as a non-static member of a containing class.


I just placed those exceptions (RecordNotFoundException, DuplicateKeyException, SecurityException) in package suncertify.db,
without making them inner classes to any containing class.

Did I violate this requirement ?

Kind regards,
Andy
 
Roel De Nijs
Sheriff
Posts: 10223
129
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your exception classes should just be classes inside the db-package, not as inner classes of the Data class.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:Your exception classes should just be classes inside the db-package, not as inner classes of the Data class.


Agreed. And do not forget the constructors specified in the assignment!
 
Andy Jung
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... ok, that's fine, I submitted the project yesterday anyways ...
 
Matheus Mendes
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The spec says:
" ... member classes of the suncertify.db package..."
. Just put inside the package and it's alright.

Good lucky and keep on touch to let us know the positive result.
 
David Kachen
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I do not think that the use of javax.ejb.DuplicateKeyException - is good. I think that we should make a new Exception.

I did as follows:
SecurityException already exists (in java.lang). RecordNotFoundException and DuplicateKeyException I have extends from java.lang.IllegalArgumentException.

A javax.ejb.DuplicateKeyException designed specifically for the EJB.

Best Regards..
 
David Kachen
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I was a little mistaken. I'm new at this forum, please forgive me if I'm wrong. In the first message I passed on the link and got to DuplicateKeyException javax.ejb.DuplicateKeyException. I thought that the developer decided not to create a DuplicateKeyException and instead use javax.ejb.DuplicateKeyException.
And as it turned out, the editor himself makes reference to the message.

Best Regards
 
Roel De Nijs
Sheriff
Posts: 10223
129
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Kachen wrote:I did as follows:
SecurityException already exists (in java.lang).

Javadoc of the SecurityException says:
Thrown by the security manager to indicate a security violation.
So i think you should create your own SecurityException instead of reusing this one (because your code will throw the exception and not a security manager)

Kind regards,
Roel
 
David Kachen
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roel, I think that you are right.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic