RE: IllegalStateException: undo: undo manager is in invalid state [SOLVED]
RE: IllegalStateException: undo: undo manager is in invalid state [SOLVED]
- Subject: RE: IllegalStateException: undo: undo manager is in invalid state [SOLVED]
- From: "Pierre Bernard" <email@hidden>
- Date: Fri, 2 May 2003 11:12:16 +0200
- Thread-topic: 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.responseToClientMessage(EODistributionContext.java:622)
at com.webobjects.eodistribution.WOJavaClientComponent.handleClientRequest(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._dispatchWithPreparedPage(WOComponentRequestHandler.java:196)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedSession(WOComponentRequestHandler.java:287)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:322)
at com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:358)
at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(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)
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.