This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes SecurityException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "SecurityException" Watch "SecurityException" New topic
Author

SecurityException

Martin Rea
Greenhorn

Joined: May 04, 2004
Posts: 12
The interface I was given in my assignment throws a SecurityException in the update, delete and unlock method.

The description says "..if the record is locked with a cookie other than lockCookie".

My first thought was to use java.lang.SecurityException, but this is a runtime Exception and I believe it is bad practice to throw a runtime exception in the middle of the code?

So I made my own SecurityException - does this seems ok?
YungSheng Chang
Ranch Hand

Joined: Jul 28, 2003
Posts: 44
For me, I just use java.lang.SecurityException since that is what the instruction specifies.

It is ok to get RuntimeException in the middle of code, as long as you expect it to happen, such as ArithmeticException.

I do no see any benefits of making your own SecurityException class; but for DuplicatedException and RecordNotFoundException class you should make your own.


I play Java for fun.<br /> <br />SCJP / SCJD / SCWCD / SCBCD
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: SecurityException