SCEA, SCJD, SCDJWS, SCWCD, SCJP
Originally posted by Edwin Dalorzo:
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
An IOException is not A RecordNotFoundException.
how will you know if it was an IOException that occurred and not a RecordNotFoundException
I personally didn't have this problem because I have a method that loads the database records into a Map structure; this way, the methods provided in Sun's interface only throw exactly the exceptions of their signatures.
SCEA, SCJD, SCDJWS, SCWCD, SCJP
Some exception message might be helpful to user but some aren't.
how do you handle those exception which are not necessary showed to user?
I consider to log these error in a text file but I don't think examiner will take a look this log file.
SCEA, SCJD, SCDJWS, SCWCD, SCJP
SCEA, SCJD, SCDJWS, SCWCD, SCJP
"Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file"
Originally posted by Edwin Dalorzo:
Well, I am following a very simple approach, I throw a RecordNotFound exception, and I pass the IOException as parameter for the RecordNotFoundException constructor, so that I still keep information of the underlaying cause of error.
Somewhat like this:
After all, if an IOException happens while trying to read or write a record I may just as well say the record was not found.
I hope that helps!
[ April 23, 2008: Message edited by: Edwin Dalorzo ]
SCJP, SCJD
SCEA, SCJD, SCDJWS, SCWCD, SCJP
Thanks
---------------------------------------
Naveen Hegde, SCJP5.0, SCJD...
---------------------------------------
Originally posted by Naveen Hegde:
(...snip...)To achieve this, wrap all these exceptions into a custom exception (...snip...)
Hold that thought. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|