[jsword-devel] Applying patch
DM Smith
dmsmith555 at yahoo.com
Fri Jun 25 12:36:48 MST 2004
Joe Walker wrote:
> DM Smith wrote:
>
>> WRT the semantic change, Joe, you had noted that you wanted getData(Key)
>> to return null if the verse could not be found. Right now it throws a
>> BookException. This would be for OT lookups in the NT, the reverse or
>> for input mistakes. Is this still something that you think is a good
>> idea. I have implemented the change, but it would be easy to back out.
>
>
> I'm not sure I've ever really thought about it properly.
> If a Key is invalid or for a different type of Book then clearly we
> should throw an Exception, but for valid keys for which we have no data
> then perhaps a better response would be to return a BookData that
> contains nothing.
>
> Do you have any idea why I thought null was a good idea?!
>
I don't know why null is a better idea than an empty BookData. There is
a slight advantage of an empty BookData in that the code would not have
to test for null. But it may need to test for an empty BookData.
I think that either null or an empty BookData is better than throwing a
BookException.
If you wish, I will change my changes to return an empty BookData. Or I
can revert the code back to what it was.
More information about the jsword-devel
mailing list