In the long running debate over return null vs return page, I officially concede to Chuck :) I have long maintained that returning null really doesn't matter that much, but I just found a case where it does. If you have a repetition over an array and you have a delete method that deletes objects from that array, you can explode if you return null. The loop that calls invokeAction on all of the items in the list caches the size of the list before going into the loop. It loops while i < count && woactionresults == null. That means if you delete item #3 from a 3 item long list and return null from your delete method, you will IndexOutBoundsException when it tries to go to the 3rd item in the list (in a now 2-item-long list). I'm actually kind of surprised I haven't seen this before ... maybe just a fluke of this particular use case, but given this error, I would now maintain that it's not just an issue of performance and now an issue of correctness and therefore you should never return null. Be aware that this is what happens when you question Chuck in a public forum :)

ms

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to