• 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
valueForKey(...) from within takeStoredValueForKey(...) = infinite loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

valueForKey(...) from within takeStoredValueForKey(...) = infinite loop


  • Subject: valueForKey(...) from within takeStoredValueForKey(...) = infinite loop
  • From: Florijan Stamenkovic <email@hidden>
  • Date: Wed, 16 Jan 2008 15:20:52 -0400

Hi all,


I've been trying to override some EOCustomObject methods to perform event firing. However, I bumped into a problem when the objects are first being initialized with values. The thing is, i use the old value in the fired event. This meant my takeStoredValue method looks like this:



public void takeStoredValueForKey(Object object, String key){ Object oldValue = FIRE_EVENTS ? valueForKey(key) : null; super.takeStoredValueForKey(object, key); if(FIRE_EVENTS) fireDataObjectEvent(key, oldValue); }


However, during the first initialization of the EO the first line of the method (getting of the old value) triggers a fault to fire, which triggers EOF to get the value and set it on the EO using the takeStoredValueForKey(..) method. Which ends up in an infinite loop. Bummer.


What I've tried is printing a stack trace of an exception as the first line in the takeStoredValueForKey(..) method, hoping to find out which method was calling it. Then I'd override that method, to skip event firing during the initialization (by setting the FIRE_EVENTS flag to false during it's duration). But, the stack trace does not imply any method in which I could do that (I edited out all the trace elements that are not from com.webobjects...):

java.lang.Exception
at org.jbnd.eof.FiringEOFDataObject.takeStoredValueForKey (FiringEOFDataObject.java:102)
at com.webobjects.eodistribution.client.EODistributedObjectStore.initialize Object(EODistributedObjectStore.java:249)
at com.webobjects.eocontrol.EOEditingContext.initializeObject (EOEditingContext.java:3805)
at com.webobjects.eodistribution.client.EODistributedObjectStore._fireFault (EODistributedObjectStore.java:1129)
at com.webobjects.eodistribution.client.EODistributedObjectStore.initialize ReplacementObject(EODistributedObjectStore.java:814)
at com.webobjects.eodistribution.client.EODistributedObjectStore._replaceme ntObjectForDecodedObject(EODistributedObjectStore.java:788)
at com.webobjects.foundation.NSSelector._safeInvokeMethod (NSSelector.java:120)
at com.webobjects.foundation._NSDelegate._perform(_NSDelegate.java:225)
at com.webobjects.foundation._NSDelegate.perform(_NSDelegate.java:162)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder.decodeOb ject(_EOReferenceRecordingCoder.java:559)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder.decodeOb jects(_EOReferenceRecordingCoder.java:587)
at com.webobjects.foundation.NSArray.decodeObject(NSArray.java:1309)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder $_Decoder.decodeObject(_EOReferenceRecordingCoder.java:704)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder.decodeOb ject(_EOReferenceRecordingCoder.java:551)
at com.webobjects.eodistribution.common._EOServerReturnValue.decodeObject (_EOServerReturnValue.java:62)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder $_Decoder.decodeObject(_EOReferenceRecordingCoder.java:704)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder.decodeOb ject(_EOReferenceRecordingCoder.java:551)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder.decodeOb jects(_EOReferenceRecordingCoder.java:587)
at com.webobjects.foundation.NSArray.decodeObject(NSArray.java:1309)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder $_Decoder.decodeObject(_EOReferenceRecordingCoder.java:704)
at com.webobjects.eodistribution.common._EOReferenceRecordingCoder.decodeOb ject(_EOReferenceRecordingCoder.java:551)
at com.webobjects.eodistribution.client.EOHTTPChannel._responseToMessage (EOHTTPChannel.java:533)
at com.webobjects.eodistribution.client.EOHTTPChannel.responseToMessage (EOHTTPChannel.java:603)
at com.webobjects.eodistribution.client.EODistributedObjectStore._send (EODistributedObjectStore.java:594)
at com.webobjects.eodistribution.client.EODistributedObjectStore._send (EODistributedObjectStore.java:623)
at com.webobjects.eodistribution.client.EODistributedObjectStore.objectsWit hFetchSpecification(EODistributedObjectStore.java:506)
at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification( EOEditingContext.java:4114)
at com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification( EOEditingContext.java:4500)


Anyone has any idea how I could do this? If not, I am stuck with events being fired only in value setters.

Thx
Flor
_______________________________________________
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: valueForKey(...) from within takeStoredValueForKey(...) = infinite loop
      • From: Fabian Peters <email@hidden>
  • Prev by Date: Re: WOLips Component Custom Templates?
  • Next by Date: Re: valueForKey(...) from within takeStoredValueForKey(...) = infinite loop
  • Previous by thread: Re: WOLips Component Custom Templates?
  • Next by thread: Re: valueForKey(...) from within takeStoredValueForKey(...) = infinite loop
  • Index(es):
    • Date
    • Thread