Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 134238

Summary: [Undo] TriggeredOperations should close open operation on RuntimeExceptions
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: UIAssignee: Susan McCourt <susan>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 134227    

Description Dani Megert CLA 2006-03-31 04:35:42 EST
I20060331-2000

See bug 134227 comment 0, step 8:
8. Do the multi quick fix again:
->
Caused by: java.lang.IllegalStateException: Cannot open an operation while one
is already open

An exception in Platform Text causes the DefaultOperationHistory to be in an illegal state which causes exceptions later. The operation history should clean up upon errors e.g. if an open operation is performed it should make sure to close it in case of errors.
Comment 1 Eric Moffatt CLA 2006-04-04 11:27:04 EDT
Susan, I think I got this one right (at least you're active on this class...) let me know if you wnat it reassigned...
Comment 2 Susan McCourt CLA 2006-04-04 11:52:46 EDT
Marking for RC1.
Comment 3 Susan McCourt CLA 2006-04-08 15:29:58 EDT
The problem is in TriggeredOperations.  It catches ExecutionException and cleans up the open operation, but does not catch runtime exceptions.  In the platform text case, an AssertionFailedException interrupted the undo, and the TriggeredOperation did not catch this.

During discussions in bug #87675, we noted that the operation history should not attempt to fix or hide the illegal state, but to throw the exception.  It's up to the clients to do the right thing.  In this case, the offending client is TriggeredOperations.  The undo, redo, and execute methods need to close the operation on runtime exceptions.
Comment 4 Susan McCourt CLA 2006-04-10 16:38:23 EDT
Fixed >20060410.

TriggeredOperations now catches RuntimeException in addition to ExecutionException.  I could not reproduce the problem reported in bug #134227 (I think it has been worked around on the text side), but I was able to write a test case, OperationsAPITest.testExceptionDuringOpenOperation(), that demonstrates the history being left in an illegal state by a runtime exception during the undo of a TriggeredOperations.
Comment 5 Susan McCourt CLA 2006-04-13 15:53:52 EDT
verified on I20060413-0010.
Test case passed.