This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
If a cookie change is fired (Node.fireCookieChange()) from a thread other than AWT-event-queue, an IllegalStateException is thrown. The problem is that the change causes some action (probably Save action) to be enabled/disabled which must be done in the AWT-event-queue. And because it is called from another thread, the exception is thrown.
The exception is available at http://www.netbeans.org/issues/showattachment.cgi?attach_id=13929&file=Exception.txt (the second attachment of bug #37524).
Assigned to new owner.
Yes, the IllegalStateExceptio is thrown if the action's is changes outside of EventQueue. You have to replan firing this change to EQ in properties module. See fix of issue 41500.
I do not agree the problem should be fixed in module Properties. The reason is that the action's state change is initiated in the OpenIDE's part of code, outside of the Preperties module's scope. I suggest that the check for the current thread (and possible redirection to the AWT-event-queue thread) should be performed at the moment it is apparent the cookie change would change the action's state change. I think the right place is in method org.openide.util.actions.CookieAction.CookiesChangeListener .propertyChange(...) See the attached diff.
Created attachment 14647 [details] suggested patch
I can apply Marian's patch and I'll do it tomorrow, if nobody closes this bug as wontfix by then.
Should be OK for D. In the future, the property change would always arrive from EQ anyway, so this call to Mutex.EVENT could just be replaced with an assertion.
cvs -q ci -m "#40937: Cookies can change in any thread" Checking in src/org/openide/util/actions/CookieAction.java; /cvs/openide/src/org/openide/util/actions/CookieAction.java,v <-- CookieAction.java new revision: 1.26; previous revision: 1.25 done Processing log script arguments... More commits to come... Checking in test/unit/src/org/openide/util/actions/CookieAction2Test.java; /cvs/openide/test/unit/src/org/openide/util/actions/CookieAction2Test.java,v <-- CookieAction2Test.java new revision: 1.2; previous revision: 1.1
Verified. The exceptions are not thrown any more.