to avoid null pointer exceptions all over the place (and/or to avoid having to write lots of code to check that the relationships were non-null). I took the following steps:

You should never need to worry about that. If the to-many relationships are null, you have overridden awakeFromInsertion (and / or awakeFromFetch) and failed to call super.awakeFromInsertion / awakeFromFetch. EOF automatically sets these to empty arrays in the super implementation.

b) updated my EOGenerator templates so that the generated code checks for null in the to-many relationship accessors and returns an empty array if it is null

You should not need to do that, you still have a problem to hunt down.

I am not sure where to look next. I have double checked, and for sure I am calling super's implementation on every method that I override, but I still get null pointer exceptions if I don't explicitly check the relationship accessors. I always thought this was stupid EOF behavior, but had no choice but to override my templates, because it was the behavior I was getting. It might very well be thanks to something I'm doing elsewhere, but not sure where else to looks because I've never been violating any of the rules set forth by the vendor, and now I'm not violating any rules set forth by the non-vendor user community (that I'm aware of).

But at any rate, at least the code works in predictable ways now, and the added code in my templates shouldn't impose a noticeable overhead, even if it's theoretically unnecessary. Next time I can afford to spend a few hours researching the problem, I will have another look and see if I can track down something else, or else start an entirely new project to see if I can replicate the behavior there and work backwards from that. I'll let you know and post to the list if I find anything from those exercises. Thanks again for the help!

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

This email sent to archive@mail-archive.com

Reply via email to