Bug 240917 - createDocument() in EMF2DOMSSERenderer hardcodes forWrite var
Summary: createDocument() in EMF2DOMSSERenderer hardcodes forWrite var
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Jason Peterson CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-07-15 12:30 EDT by Jason Peterson CLA
Modified: 2008-08-01 02:24 EDT (History)
2 users (show)

See Also:
cbridgha: review+
thatnitind: review+


Attachments
Patch (1000 bytes, patch)
2008-07-15 12:30 EDT, Jason Peterson CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Peterson CLA 2008-07-15 12:30:20 EDT
Created attachment 107486 [details]
Patch

Seeing an issue where reference counts are out of sync after generating a deployment descriptor for a project and them attempting to cancel an edit.
The problem is that when the generated deployment descriptor is created and saved the code path for creating the file goes thru EMF2DOMSSERenderer.createDocument()
When initializing the xml model in this method it does the following call:
   
    initializeXMLModel(file, true);

It hardcodes the forWrite variable to true even though the resource's write count is currently 0.  In initilizeXMLModel the method syncReferenceCounts(id, forWrite) is called passing in the hardcoded true for the forWrite var.  In this method the write index is incremented by one due to the hard coded value even though the resource's write count is still set to 0.  

To fix this I have updated the hardcoded true to a calculated value: 

    initializeXMLModel(file, resource.getWriteCount() != 0);
Comment 1 Chuck Bridgham CLA 2008-07-16 10:17:35 EDT
I approve
Comment 2 Jason Sholl CLA 2008-07-16 10:36:26 EDT
please note that when applying patches for the build, this patch is also contained in bug 240606
Comment 3 Nitin Dahyabhai CLA 2008-07-23 20:38:11 EDT
Approved.