• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird 1.3.3 - Last Valid Flag is missing?!

 
RIO YOU
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I've been trying to read the database you supplied, there is one problem which I ask to.

The original filesize is below,
2003-04-08 AM 11:51 4,856 db-1x3.db

As I read that file, there is EOFException at the last read time.
The last one char(last Valid Flag) is missing so that I get the EOFException.

I've been wondering it is OK and Doing how to solve it.

Please, give me advice.

Regards,
 
Roy Mallard
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open the file in a hex editor. It seems unlikely Sun would give a corrupt .db file.
 
Cindy Rogers
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had URLyBird 1.2.3, with that identical file (based on the file properties), and had no problems reading it.

With my file, the last two records were:

Castle Lendmarch 4 Y$240.00 2004/04/19
Bed & Breakfast & Business Lendmarch 6 Y$170.00 2005/03/10

I used jEdit's hex editor plug-in (both free software).
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I, too, was vexed by that flag. Definitely use a hex editor. I use Hex Workshop, also free. You will see the flag is at the beginning of each record. It will appear in hex as "0000", and in ASCII as "..". This is how I stepped through the records.


I am still stuck on how to properly loop through this. I know there are 29 records from using the hex editor. I would be hopelessly lost without that thing!
 
Chris Be
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anne Crace:
int[] FIELD_LENGTHS = {2,64,64,4,1,8,10,8};


Check if your array should be
int[] FIELD_LENGTHS = {1,64,64,4,1,8,10,8};

The flag in my assignment is only 1 byte, not 2.
 
John Stone
Ranch Hand
Posts: 332
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thread is over year old,.. I guess Anne Crace is already SCJD :-).
 
Chris Be
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by John Stone:
This thread is over year old,.. I guess Anne Crace is already SCJD :-).


Agree, but I find that I often search the threads by keyword, not date. So if someone has posted a response to a problem that already exitsted in 2003 and I ran into again, I do appreciate a post to an outdated post. Why not share experiences this way.
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, unfortunately Anne Crace is not yet SCJD. I have made major progress towards that goal recently. My flag is indeed 2 bytes. There are supposed to be subtle differences in the assignments. Method signatures, etc. I guess the db file, too.
 
Naveen Narayanan
Ranch Hand
Posts: 114
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am in initial stage of URLybird(1.2.2) , checked the db-1x2.db with UltraEdit hexeditor,
made a quick read of it (not a tidy one),

locationInFile =74;
while (locationInFile+RECORD_LENGTH<=dbFile.length()){
dbFile.seek(locationInFile);
dbFile.readFully(input);
System.out.println(formatPrint(input));
locationInFile+=159+2; // 2 byte flag
offset=0;
}

Seems reading works without exception , I am not exactly sure if this going to help in all cases.
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naveen, it is certainly going to help. You probably have the same db as I do. I have 1.2.2 also. My records are 161 (159+2) bytes long. I have very little left of that original read in my application, but used it intensively in getting my implementation to work. I now have something very similar to the DVDFileAccess class Andrew used in his book. I used my original reader to cut and paste from to make my new implementation. If you choose to go that route, you will have to make changes to Andrew's code to get it to work for your class because of differences, mainly in the provided interface. That is the trick to this assignment, I think...getting it to work while honoring the provided interface.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic