Hey all,

I just wanted to tie this email from Pierre Bernard into the whole awkeFromInsertion() thread, as this can have some quite unexpected and hard-to-trace impacts for Java Client projects (Mr. Peabody, please start the WABAC machine...):


-----Original Message-----
From: Pierre Bernard
Sent: Friday, May 2, 2003 2:13 PM
To: Apple WebObjects Dev
Subject: Re: IllegalStateException: undo: undo manager is in invalid state -
Huh?


Hi!

I finally got hold of the root cause of my problem. You really have to like those stack traces which point to no line of code of your own. So all you get is a cryptic error message and the information that one of your many thousand lines of code somehow got the framework into a state it does not like. That is if the cause is not within the framework itself.

This is where a mailing list like this becomes invaluable by sharing hints and pointers. So I hope some day someone with the same problem will find this message in the archives and thus have one more possible solution to his/her problem to explore.

My mistake came from initializing attributes and relationships in awakeFromInsertion without first checking if these were not already initialized. I must have figured nothing much could have happened before awakeFromInsertion. Yet working with JavaClient awakeFromInsertion on the server side gets called after the EO gets saved from the client to the server. Thus what I thought to be initialization actually overwrote values I entered in the client interface. What's more I used the same EO class on the client and on the server. Both created a new EO to attach to a to-one relationship. The one created on the server side overrode the one created by the client. This must have confused the undo manager. Actually it lead to a whole lot of bizarre behavior.

Thus the correct wa to initialize an attribute in awakeFromInsertion is:

        if (attribute() == null)
                setAttribute(myDefaultValue);

Now I wonder why I never ran into the same problem when working with nested editing contexts on the server. Is the behavior different? Has it changed recently? Or did I just plainly not see the problems.

Pierre.

-----Original Message-----
From: Pierre Bernard
Sent: Friday, April 25, 2003 5:42 PM
To: Apple WebObjects Dev
Subject: IllegalStateException: undo: undo manager is in invalid state -
Huh?


Hi!

Lately I'm occasionally seeing the below exception in my JavaClient application and have no clue what the exact problem is or where to look for it. So I am hoping for someone on the list to already have seen this one.

This is with WebObjects 5.2. I do not use the undo manager explicitely. The exception occurs on a save after deleting an object and creating a new one of the same type.

TIA for any pointers.

Best regards
Pierre Bernard

So here it comes:

[2003-04-25 17:35:49 CEST] <WorkerThread5> <com.webobjects.appserver._private.WOComponentRequestHandler>: Exception occurred while handling request: java.lang.IllegalStateException: undo: undo manager is in invalid state, undo was called with too many nested undo groups [2003-04-25 17:35:49 CEST] <WorkerThread5> java.lang.IllegalStateException: undo: undo manager is in invalid state, undo was called with too many nested undo groups at com.webobjects.foundation.NSUndoManager.undo (NSUndoManager.java:567) at com.webobjects.eodistribution.EODistributionContext.responseToClientM essage(EODistributionContext.java:622) at com.webobjects.eodistribution.WOJavaClientComponent.handleClientReque st(WOJavaClientComponent.java:1089) at com.webobjects.eodistribution.WOJavaClientComponent.invokeAction (WOJavaClientComponent.java:338) at com.webobjects.appserver._private.WOComponentReference.invokeAction (WOComponentReference.java:113) at com.webobjects.appserver._private.WODynamicGroup.invokeChildrenAction (WODynamicGroup.java:101) at com.webobjects.appserver._private.WODynamicGroup.invokeAction (WODynamicGroup.java:110) at com.webobjects.appserver.WOComponent.invokeAction (WOComponent.java:950) at com.webobjects.appserver.WOSession.invokeAction(WOSession.java: 1136) at com.webobjects.appserver.WOApplication.invokeAction (WOApplication.java:1313) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatch WithPreparedPage(WOComponentRequestHandler.java:196) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatch WithPreparedSession(WOComponentRequestHandler.java:287) at com.webobjects.appserver._private.WOComponentRequestHandler._dispatch WithPreparedApplication(WOComponentRequestHandler.java:322) at com.webobjects.appserver._private.WOComponentRequestHandler._handleRe quest(WOComponentRequestHandler.java:358) at com.webobjects.appserver._private.WOComponentRequestHandler.handleReq uest(WOComponentRequestHandler.java:432) at com.webobjects.appserver.WOApplication.dispatchRequest (WOApplication.java:1244) at com.webobjects.appserver._private.WOWorkerThread.runOnce (WOWorkerThread.java:167) at com.webobjects.appserver._private.WOWorkerThread.run (WOWorkerThread.java:248)
        at java.lang.Thread.run(Thread.java:484)

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to