File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "SecurityException" Watch "SecurityException" New topic


Chris Bicnal
Ranch Hand

Joined: Aug 17, 2005
Posts: 80
Hi all,

I'm in the midst of B&S 2.2.1 and have a question about peoples' interpretation of SecurityException.

In the provided DBAccess class the description of SecurityException is...

Throws SecurityException if the record is locked with a cookie other than lockCookie.

...this is fine, although let's take a look at the unlock method. What happens if the record number passed in doesn't represent a locked record?

I know it's a subtle point, but there is a difference between...

i. Record x being locked with cookie y and us trying to unlock it with cookie z.


ii. Record x not being locked, but attempted to be unlocked with cookie y.

Does that make sense? What have you guys done about this?

Roel De Nijs

Joined: Jul 19, 2004
Posts: 8360

Hi Chris,

I didn't have a lockCookie or SecurityException in the required interface, but this is what I did: trying to unlock a record without having a lock on that record resulted in an IllegalStateException being thrown.

Kind regards,

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
Chris Bicnal
Ranch Hand

Joined: Aug 17, 2005
Posts: 80
Hi Roel,

That's an interesting approach - I think I might adopt a similar approach.


I agree. Here's the link:
subject: SecurityException
It's not a secret anymore!