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

Bug 367096

Summary: [dstore] DataElement.isSpirit() may return true for newly created DStore objects
Product: [Tools] Target Management Reporter: Petar Petrov <petar.petrov>
Component: RSEAssignee: David McKnight <dmcknigh>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: dmcknigh, petar.petrov
Version: 3.3   
Target Milestone: 3.4 M5   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 367097    
Attachments:
Description Flags
patch to clear spirit bit when getting a recycled DataElement none

Description Petar Petrov CLA 2011-12-19 11:22:54 EST
Build Identifier: I20110613-1736

DataElement.isSpirit() may return true for newly created DataElement objects if they were retrieved from the cache of recycled elements.

Reproducible: Always

Steps to Reproduce:
In our code we call one of the DataStore.createObject() methods. It will call DataStore.createElement() which will try to retrieve an element from a cache of recycled elements. This cache may contain spirits - elements that were handled by DataElementRemover.
The problem is that createObject() will never change the spirit state of elements retrieved from the cache of recycled elements. This means that your newly created DataElement instance will return true for isSpirit() although that is obviously incorrect.
Comment 1 David McKnight CLA 2011-12-19 11:34:47 EST
Created attachment 208566 [details]
patch to clear spirit bit when getting a recycled DataElement
Comment 2 David McKnight CLA 2011-12-19 11:35:08 EST
Petar, does this patch solve the problem?
Comment 3 David McKnight CLA 2011-12-19 11:36:55 EST
I've created bu 367097 to backport the fix to the 3.2.x version.
Comment 4 Petar Petrov CLA 2011-12-20 03:14:46 EST
(In reply to comment #2)
> Petar, does this patch solve the problem?

Looks like it should solve it. We've implemented a similar workaround in our code for the time being - call setSpirit(false) after every call to createObject(). I'll be able to retest once the patch is released as part of an official release and we upgrade our target platform to it.
Comment 5 David McKnight CLA 2011-12-20 10:10:39 EST
Okay, I've committed the patch to the HEAD stream.