On Thu, 11 Sep 2014 14:55:16 +0100 John Pollard <[email protected]> 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 ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
