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

Bug 301151

Summary: Duplicate Containers returned from FlatVirtualComponent fetchResources()
Product: [WebTools] WTP Java EE Tools Reporter: Jason Peterson <jasonpet>
Component: jst.j2eeAssignee: Rob Stryker <stryker>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P3 CC: ccc, stryker
Version: 3.2   
Target Milestone: 3.2 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard: Flexible Modules
Bug Depends on:    
Bug Blocks: 299576    
Attachments:
Description Flags
The Fix ;)
none
Try Again none

Description Jason Peterson CLA 2010-01-28 11:28:42 EST
Getting duplicate folder when using the AddMappedOutputFoldersParticipant.  This is occurring on the call to the following:

VirtualComponentFlattenUtility.addContainerInternal(IContainer container, IPath
path)

The getExistingModuleResource calls for the container and its parent are both
properly getting the existing containers.  However, the problem occurs in
addMembersToModuleFolder(parent, new IFlatResource[] {mf}) where the existing
members and new members of the parent container are combined.

You can recreate this by running the JUnit EARExportOperationTest using the patch located in Bug 299576
Comment 1 Rob Stryker CLA 2010-02-02 02:18:00 EST
Created attachment 157872 [details]
The Fix ;) 

If the folder is already found, clearly it's not necessary to add it again. doh.
Comment 2 Rob Stryker CLA 2010-02-02 02:23:40 EST
Created attachment 157873 [details]
Try Again

Jason: 

In your patch, the utility class does not need to add the method VirtualComponentFlattenUtility.extractFileFromFlatFile(IFlatFile). 

All you need to do is File f = (File)manifest.getAdapter(File.class); If you look at the FlatFile code, the adapter method already checks for a file, and if not found, an IFile.
Comment 3 Rob Stryker CLA 2010-02-02 02:25:30 EST
Committed to head. =]