Hello Andrew,
As suggested, I added the following three lines of code to the methods lock, unlock, islocked, read, update, delete.
You wrote:
Personally I agree that unlock() should not throw RecordNotFoundException. Since the lock had been granted, there should be no reason for the unlock not to work. And it will cause an exception to be thrown every time if you use the lock-delete-unlock sequence (does this mean that delete does an implicit unlock? or you just document this issue?). But my feelings are irelevant - Sun have told us what they want.
I find this rather alarming! Should we assume that Sun will be grading our submissions so much by the book? You are right, if we use lock - delete - unlock sequence, how will the unlock method not throw RecordNotFound exception? Will pointing this out in the documentation be enough?
Note that I check two things in my validateRecord method:
1. That the record is within the range. I do that by doing on the spot computation of number of records in the file at that point in time. Therefore, should validateRecord method be synchronized?
2. That this is not a deleted record. Again, the same question.
Another thing, should I keep persuing the exception handling (I am beginning to move on it, got side-tracked in getting the GUI piece going) here or would you and Max prefer to answer questions in the
thread Hugh has started?
Thanks for all your help thus far. You don't mind me answering questions on the forum which I can do you? I figure that takes a few off your shoulders. If you want me to follow a particular protocol while answering questions, feel free to point out. No offense will be taken.
Regards.
Bharat