Hi Maria,
Well, I'm confused now too.
Originally posted by Maria Lepschy:
I have already read all records and displayed in a JTable. My problem is that I have read all records witch are deleted, I have not validate the records again the record indicator flag.
If I do this-if I read the records with a valid record indicator- then my table will be empty.I think, I must first create valid records an then do the read.
I recommend you start with a new copy of your original database file. To my knowledge this file contains only valid (that is, non-deleted records). So were you to read the database file, I think you would find that the validity flag for each of the records should have the value 0x00, indicating that the record is valid.
It seems to me that your read method should first determine whether the record in question is valid or not. That is, it should read the validity flag and if it's 0x00 then read the record. If the validity flag is 0xFF then
you should throw the RecordNotFoundException because the record in question has been marked for deletion.
If still believe that all the record in your database file are marked for deletion, then I would suggest that you may not be reading the validity flag correctly. Check the database file layout section of the assignment instructions again and make sure that you are reading each element specified in the correct way: the proper number of bytes and the in the proper order. If you had a one-off error in your reading you could very well be seeing 0xFF as the validity flag of every database record. It's just not reasonable (possible yes, reasonable no) that all the records in the Sun-supplied database file would be marked for deletion.
Hope this helps,
George