It's not a secret anymore!
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Removing RecordNotFoundException from subclass 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 "Removing RecordNotFoundException from subclass" Watch "Removing RecordNotFoundException from subclass" New topic

Removing RecordNotFoundException from subclass

Jonathan Elkharrat
Ranch Hand

Joined: Dec 31, 2008
Posts: 170

i think the RecordNotFoundException in the writing methods is not necessary and here's why:

since the lock method already check that the record exist, and the writing methods
make sure the record is locked, that mean one thing ---> the record exist!

just making a point..

Roel De Nijs

Joined: Jul 19, 2004
Posts: 8408

But you are not the first one, that point is already made several times (I made the same remark more than 2 years ago, and not onlt for the write methods, but also for unlock-method )

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
Jonathan Elkharrat
Ranch Hand

Joined: Dec 31, 2008
Posts: 170

now that you mention it, it's quite contradictory to have a RecordNotFoundException in the unlock method.
suppose someone lock a record, delete it and then call the unlock.
i just found a bug in my code now thanks to you
I agree. Here's the link:
subject: Removing RecordNotFoundException from subclass
It's not a secret anymore!