SCJP | SCJD | SCWCD | SCBCD | SCEA
i think when there are no record to return , the best is to return an array of int value with zero size rather than null , becuase the caller for this method expect any array and he will loop on this array , if the array have no element so the loop will not enter , but when the find method return null , may be the caller will throw NullPointerException if the caller don't know that this method will return null if the records not found or record don't match .
SCJP | SCJD | SCWCD | SCBCD | SCEA
SCJP | SCJD | SCWCD | SCBCD | SCEA
Originally posted by Simon O'Brien:
Great, that is what I was thinking, I just needed clarification! Thanks for all your help.
Simon
SCJP<br />SCJD
Originally posted by Alex Belisle Turcot:
I agree with you Mark, which is why I choose to throw RecordNotFound from my find method...
Do you throw "DuplicateKeyException" in your create method ? (its a dilemma if you use recNo as your key which easily leads to the impossibility of having a duplicate key.. (ex: key = maxRecNo + 1).
I don't know if I should still add the code to throw DuplicateKeyException and insert a comment stating that "it is currently not possible to meet this condition, but it is kept in order to support future modifications..."
Do you understand my point ? What's your opinion on that ?
Regards,
Alex
SCJP<br />SCJD
JLuis Iturbide
SC(JP|JD|WCD|BCD|EA5.0), OC(PJP8|WCD6|MJEA6) - http://www.linkedin.com/in/jiturbide
Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.
Thanks,<br />Lucas
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|