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

Bug 334837

Summary: Ordering of Library list entries incorrect after migration
Product: [Tools] Target Management Reporter: San <sansu>
Component: CoreAssignee: David McKnight <dmcknigh>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: normal    
Priority: P3 CC: dmcknigh
Version: 3.1.1   
Target Milestone: 3.3 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 335504    
Attachments:
Description Flags
Screen capture
none
sample workspace
none
patch to use LinkedHashMap instead of HashMap
none
additional patch to use LinkedHashMap in PropertySetContainer none

Description San CLA 2011-01-19 16:58:00 EST
After a workspace from WDSC 7.0 is migrated, the library list of an IBMi connection is incorrect.

The attached an image (Library_List_err.gif) shows the incorrect library list in the UI. 

The attachment workspace_70_Migr.zip is a very simply workspace from WDSC 7.0.
You can use it to reproduce the problem following these steps:
1) Un-zip the workspace
2) Launch RD Power 8.0.0.1 against this workspace
   Migration should occur automatically.
3) After migration, right-click on the connection > Properties  to show the library list. The order is incorrect. 


The class org.eclipse.rse.core.model.PropertySet.java in plugin org.eclipse.rse.core is using a HashMap to store the library list entries.
HashMap does not guantantee the ordering of the map so the library list could be in an order. The fix is to replace the usage of HashMap with LinkedHashMap which does guarantee the ordering (insertion-order) of the map entries. 

I found 2 PropertySet contstructor where this change should be made:
//_properties = new HashMap();      //old
_properties = new LinkedHashMap();  //new


Please include this change in the R3_2_maintenance stream so we can pick it up for a fixpack.
Comment 1 San CLA 2011-01-19 16:58:53 EST
Created attachment 187154 [details]
Screen capture
Comment 2 San CLA 2011-01-19 16:59:58 EST
Created attachment 187155 [details]
sample workspace
Comment 3 David McKnight CLA 2011-01-26 15:01:47 EST
Created attachment 187678 [details]
patch to use LinkedHashMap instead of HashMap
Comment 4 David McKnight CLA 2011-01-26 15:02:32 EST
San, could you verify the the patch I've attached here solves the problem?  Thanks.
Comment 5 David McKnight CLA 2011-01-26 15:27:13 EST
Created attachment 187681 [details]
additional patch to use LinkedHashMap in PropertySetContainer
Comment 6 San CLA 2011-01-26 15:39:46 EST
I verified the patch solves the problem.
Comment 7 David McKnight CLA 2011-01-26 15:48:53 EST
Thanks San, I've committed the change to cvs.  I'll follow up with the 3.2.x backport (bug 335504) when it has been reviewed.