Hi All,

I have an issue where a NullPointerException is thrown within EOCustomObject.willReadRelationship(). Before I log a radar, I want to see if anyone else has had a similar issue and if so, what you did to resolve it.

I believe the issue is that EOCustomObject.willReadRelationship() is called firing a fault on a deleted EO. The only way that EOCustomObject.willReadRelationship() will throw a NPE is if editingContext() returns null and 'object' is a fault (ie. EOFaultHandler.isFault(object) returns true).

What am I doing to cause this sequence of events you ask? it's relatively simple:

- I have a class (path.to.class.listening.to.editingcontext.notification.MyClass from stack trace below) that listens to EOEditingContext.EditingContextDidSaveChangesNotification notifications and does some processing. - The NPE occurs in a debug statement that prints the NSNotification object passed to my MyClass.editingContextDidSaveChanges() method before any processing occurs. - I tracked down the culprits to be 3 of 10 deleted objects in the NSNotification's "deleted" userInfo key value, throwing NPE's in their EOCustomObject.toString() method.

Obviously deleted EO's shouldn't have editingContext()'s, but I believe that EOCustomObject.eoDescription() should not fire _any_ faults or EOCustomObject.willReadRelationship() should check to see if editingContext() is null when 'object' is a fault.

I can override EOCustomObject.willReadRelationship() in my super class and return null when "editingContext() == null && EOFaultHandler.isFault(object)", but I want to know what other potential issues this will cause.

Model:

Entity1 ----> Entity2 <<----> Entity3

- There are 3 similar relationships between Entity2 & Entity3 (used for different purposes)

Stacktrace:

java.lang.NullPointerException
at com .webobjects .eocontrol.EOCustomObject.willReadRelationship(EOCustomObject.java:1293) at com.webobjects.eocontrol._EOMutableKnownKeyDictionary$Initializer $ _LazyGenericRecordBinding .valueInObject(_EOMutableKnownKeyDictionary.java:560) at com .webobjects .eocontrol.EOCustomObject.storedValueForKey(EOCustomObject.java:1736) at path .to.my.eo.class._Entity3.myToManyRelationshipToEntity2(_AnEntity.java: 492)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun .reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun .reflect .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25)
        at java.lang.reflect.Method.invoke(Method.java:597)
at com.webobjects.foundation.NSKeyValueCoding$ValueAccessor $1.methodValue(NSKeyValueCoding.java:684) at com.webobjects.foundation.NSKeyValueCoding $_MethodBinding.valueInObject(NSKeyValueCoding.java:1160) at com .webobjects.eocontrol.EOCustomObject.valueForKey(EOCustomObject.java: 1559) at com .webobjects.eocontrol.EOCustomObject.eoDescription(EOCustomObject.java: 793) at com.webobjects.eocontrol.EOCustomObject.toString(EOCustomObject.java: 239)
        at com.webobjects.foundation.NSArray.toString(NSArray.java:920)
        at java.lang.String.valueOf(String.java:2827)
        at java.lang.StringBuffer.append(StringBuffer.java:219)
at com.webobjects.foundation.NSDictionary.toString(NSDictionary.java: 541)
        at java.lang.String.valueOf(String.java:2827)
        at java.lang.StringBuffer.append(StringBuffer.java:219)
at com.webobjects.foundation.NSNotification.toString(NSNotification.java: 175) at path .to .class .listening .to .editingcontext .notification .MyClass.editingContextDidSaveChanges(EOCacheChangeCollector.java:141)

Regards

Peter Vandoros
Software Engineer
Etech Group Pty Ltd
Level 3/21 Victoria St
Melbourne VIC 3000
Australia

Ph: +61 3 9639 9677
Fax: +61 3 9639 9577
----------------------------------
IMPORTANT: This e-mail message and any attachments are confidential and may be privileged. If received in error, please reply to this message and destroy all copies and any attachments. You should check this message and any attachments for viruses or defects. Our liability is limited to resupplying any affected message or attachments. For more information about Etech Group, please visit us at http://www.etechgroup.com.au .




_______________________________________________
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 arch...@mail-archive.com

Reply via email to