• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EOCustomObject valueForKey avoiding infinite recursion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOCustomObject valueForKey avoiding infinite recursion


  • Subject: Re: EOCustomObject valueForKey avoiding infinite recursion
  • From: John Pollard <email@hidden>
  • Date: Fri, 12 Sep 2014 09:18:55 +0100

Hmm, hairy palms, not sure I want that, but thanks for this anyway. The related attribute is a to-one relationship, does that mean it is a FK attribute? It is the to-one relationship that becomes null against my will and I need to find out where/why.

I have now cobbled some code up in takeStoredValueForKey() which avoids the recursion when checking the existing value using storedValueForKey() and ignores the (temp) null value caused by clearProperties() when the EO is invalidated. Hence I believe I now have the code to scream if my property is set to null from a pre-existing value and I should get an email + stack trace to report the exciting news. These intermittents are about once every two months so will have to wait.

On 11 Sep 2014, at 23:04, Chuck Hill <email@hidden> wrote:

You are going to grow hair on your palms doing this but…

willRead();
Object value = __dictionary().valueForKey(“your attribute”);

Should, I think, do what you want.  Of course, it is package protected so you will need to use reflection to get access.  And the result may be null if the object is still a fault.  

Is this an FK or PK by chance?


Chuck





On 2014-09-11, 12:22 PM, "John Pollard" wrote:

Apologies, I meant takeStoredValueForKey(). Within there, how can I safely see what the value currently is when when this method is called, before I invoke super. takeStoredValueForKey() to take on the new value?
John

On 11 Sep 2014, at 18:10, John Huss <email@hidden> wrote:

The order of calls is:

takeValueForKey -> setXXX -> takeStoredValueForKey

All of these maybe skipped except for takeStoredValueForKey, so that is the only one you should override to see what is getting saved.


On Thu, Sep 11, 2014 at 8:55 AM, John Pollard <email@hidden> wrote:
Hi List,

In some debugging within takeValueForKey() I want to find out if the key already has a value set. If I call valueForKey() or storedValueForKey() and the value isn't already set I get infinite recursion as it triggers a fault and tries to load with takeValueForKey() and so on.

I am trying to debug where a value is being set to null, but apparently not going via validateXXX() or setXXX() methods, so I want to trap the case where the takeValueForKey() is passed null when the key value was previously non-null and log a stack trace.

Thanks
John
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: EOCustomObject valueForKey avoiding infinite recursion
      • From: Chuck Hill <email@hidden>
References: 
 >EOCustomObject valueForKey avoiding infinite recursion (From: John Pollard <email@hidden>)
 >Re: EOCustomObject valueForKey avoiding infinite recursion (From: John Huss <email@hidden>)
 >Re: EOCustomObject valueForKey avoiding infinite recursion (From: John Pollard <email@hidden>)
 >Re: EOCustomObject valueForKey avoiding infinite recursion (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: EOCustomObject valueForKey avoiding infinite recursion
  • Next by Date: Re: EOCustomObject valueForKey avoiding infinite recursion
  • Previous by thread: Re: EOCustomObject valueForKey avoiding infinite recursion
  • Next by thread: Re: EOCustomObject valueForKey avoiding infinite recursion
  • Index(es):
    • Date
    • Thread