• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FBN: Data class

 
Karthik Jayaprakasham
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to sun's documentation that Data class in the suncertify.db is a fully functional one.
But the tests I run against adding, deleting or modifying a record makes the db corrupt.
The version of the data class I have is @version 1.1 17-Nov-1997.
Did any of you face the same problem?
Karthik
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does it corrupt the db? Does it do so because your program is faulty, or by some fault of the db itself? There MAY be problems with the db initially, that the graders expect you to resolve or work around or something.
Perhaps you can tell us more about what happens to the db, and what the symptoms are before we start blaming the poor folks at Sun.
 
Karthik Jayaprakasham
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about that...
It's the deprectaed method in writeRecord(String[])
newData[i].getBytes(0, toCopy, buffer, offset); //-deprecated
I tried using the buffer = newData[i].getBytes() instead and then immediately
calling db.write(buffer) inside a for loop to interate through every string in a string[] array. This is the ones that is corrupting the db.
 
Ian Roberts
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik,
I have just checked my notes on the assignment and my Data class was the same version.
Obviously, the right deprecated method solution will work without corrupting the database.
I hope you have found the answer?
Ian R.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic