• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SecurityException

 
Ranch Hand
Posts: 100
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

and

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?

Chris
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
Roel
 
Chris Bicnal
Ranch Hand
Posts: 100
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roel,

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

Thanks!

Chris
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic