File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SecurityException

 
Martin Rea
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic