• Post Reply Bookmark Topic Watch Topic
  • New Topic

RecordNotFoundException

 
mohini lalwani
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try {
// Determine where in the file this record should be.
// note: if this is null the record does not exist
locationInFile = recordNumbers.get(recNo);
if(locationInFile==0L)
{
throw new RecordNotFoundException("Record not found.");
}

recordNumbers is hashmap where key is recNo and value is offset of record

is it right condition to throw RecordNotFoundException ???

pleset let me know
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Your implementation seems to be okay. As per my understanding, this exception will be thrown when you provide implementation for

The above method requires the record no and will look up into the map. If the record is not available, RecordNotFoundException will be thrown.

I read your earlier posts couple of weeks ago and found the incorrect implementation of readRecord method. Check your implementation again

sat
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!