So committedSnapshot records the last committed state so that as yet unsaved 
changes can be compared? My value shouldn't change at all in an update ever so 
this might be a good place to check for null -> B happening.
What I have noticed in takeStoredValueForKey is that clearProperties() is 
invoked if the EO is invalidated, which does lead to a B -> null -> B 
transition where in fact the value doesn't change, so I have to ignore the case 
where the property goes to null temporarily if an EO is invalidated. Though I 
haven't checked that willUpdate() is impacted by clearProperties() in the same 
way.

On 11 Sep 2014, at 22:54, Chuck Hill <ch...@global-village.net> wrote:

> That might not give you what you want.  committedSnapshot is set when the 
> object is first mutated.  If you if the value is changed like:
> 
> null -> B -> null
> 
> Then this won’t log what is desired.
> 
> Chuck
> 
> 
> On 2014-09-11, 12:28 PM, "Theodore Petrosky" wrote:
> 
> I have used the 
> 
> @Override
> public void willUpdate() {
> 
> )    method
> 
> then I get the original value and compare it
> 
> if (committedSnapshotValueForKey(PROJECT_DESCRIPTION_KEY) != 
> NSKeyValueCoding.NullValue) {
> setOldPD((String)committedSnapshotValueForKey(PROJECT_DESCRIPTION_KEY));
> 
> }
> 
> and in your case check for == NSKeyValueCoding.NullValue
> 
> does that do what you want?
> 
> Ted
> 
> 
> On Sep 11, 2014, at 3:20 PM, John Pollard <j...@pollardweb.com> wrote:
> 
>> Ray,
>> 
>> Thanks for the thought. I do want to log the stack trace but as I can't 
>> predict when this issue might happen and it is rare. I want to narrow down 
>> to the close circumstances first, or else I will be logging thousands of 
>> these stack traces in normal operation when there isn't a problem. What I 
>> need to do is detect when a given attribute is changed from non-null to null 
>> (which should never happen), so I need to check what it was before it is 
>> being set i.e. just check it was non-null before being set to null.
>> 
>> John
>> 
>> On 11 Sep 2014, at 18:05, Ray Kiddy <r...@ganymede.org> wrote:
>> 
>>> On Thu, 11 Sep 2014 14:55:16 +0100
>>> John Pollard <j...@pollardweb.com> 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
>>> 
>>> One way to prevent the recursion you are talking about is to actually
>>> look at the stack trace inside the method. Call the static method in
>>> Wonder, ERXUtilities.stackTrace(), and look at what is in it. If you
>>> find the method you are in, you have already been called.
>>> 
>>> Without Wonder, you can instantiate a Throwable and get the stack trace
>>> from that.
>>> 
>>> Doing this is a smell. You do not want to leave this in your code. 
>>> 
>>> But since you are putting this in to find something, having this check
>>> there temporarily can be useful.
>>> 
>>> - ray
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> 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:
>>> https://lists.apple.com/mailman/options/webobjects-dev/john%40pollardweb.com
>>> 
>>> This email sent to j...@pollardweb.com
>> 
>> 
>> _______________________________________________
>> 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:
>> https://lists.apple.com/mailman/options/webobjects-dev/tedpet5%40yahoo.com
>> 
>> This email sent to tedp...@yahoo.com
> 

 _______________________________________________
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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to