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

Bug 347546

Summary: [model] role creation wizard leaks working copies
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTDTAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P2    
Version: 0.8   
Target Milestone: 2.0 RC3   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Test harness and fix none

Description Stephan Herrmann CLA 2011-05-28 11:47:58 EDT
This issue manifested itself as regressions in otdt.ui.tests:
When running the full suite three tests in OTSubHierarchyContentProviderTests
failed. The failure could not be reproduced when running only the affected test.

First analysis showed the immediate cause of failure:
The hierarchy builder bailed out due to a single JavaModelException
(see bug 347408).

That JavaModelException was caused by a stale working copy returned by
JavaModelManager.getWorkingCopies(..) (the copy's project had already
been deleted).

It turned out that the stale working copy is a regression introduced by the
fix for bug 346163: Inside TypeCreator.createType(..) we now have one
path where two working copies are allocated but only one is discarded.
Comment 1 Stephan Herrmann CLA 2011-05-28 11:57:03 EDT
Created attachment 196830 [details]
Test harness and fix

The added test harness captures which test exactly was leaking the 
working copy.

The fix simply collects all created working copies in a list so all get discarded.
Comment 2 Stephan Herrmann CLA 2011-05-28 12:00:18 EDT
A leak is a bad thing to have, which could cause all different kinds of trouble 
and since this is a regression I'm releasing this patch for RC3.
Comment 3 Stephan Herrmann CLA 2011-06-02 11:41:38 EDT
Verified using build 201105311237:

- build failures never again happened.
- all fixes for bug 346163 and friends are still good.