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

Bug 96704

Summary: [Import/Export] Import doesn't import empty directories
Product: [Eclipse Project] Platform Reporter: Aaron Luchko <aaron>
Component: UIAssignee: Karice McIntyre <Karice_McIntyre>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: billy.biggs, knut_radloff, pombredanne, pwebster, Tod_Creasey
Version: 3.1   
Target Milestone: 3.2 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
fix
none
fixed patch
none
put archive in data/org.eclipse.datatransferArchives folder
none
put archive in data/org.eclipse.datatransferArchives folder
none
patch for ImportExistingTests.java none

Description Aaron Luchko CLA 2005-05-25 16:58:26 EDT
in org.eclipse.ui.internal.wizards.datatransfer TarLeveledStructureProvider.java
and ZipLeveledStructureProvider use an essentially identical initialize() method.

This method searches down into a directory until it finds a file (not a
directory) and then adds that to Map children.

Thus in a directory structure
foo/bar/something/somethingelse/file.java

The only entry will be an element with key "foo/bar/something/somethingelse/"
and value "file.java"

However in the case of a directory with no files inside
foo/bar/something/somethingelse/

A file is never found, thus no entry of foo/bar/something/somethingelse/ is ever
added to the Map children and this directory structure will never be imported.


A possible fix is probably as simple as adding the element
key="foo/bar/something/" value="somethingelse/" in the case that no file is
found at the end.
Comment 1 Aaron Luchko CLA 2005-05-25 17:35:23 EDT
This behavior also occurs with file system imports.  As a side note eclipse does
allow you to create empty directories so this is a case where a project exported
and reimported will not match the original project.
Comment 2 Michael Fraenkel CLA 2005-05-26 08:05:47 EDT
This is a dupe of Bug 33171 and Bug 69565.

There is a slight issue with the UI and what it allows you to select.  I
prototyped a fix a few months back and ran into some issues with the UI which is
why you don't see any patch available.
Comment 3 Aaron Luchko CLA 2005-05-26 10:07:30 EDT
Okay though those bugs seem slightly different as they're referring only to File
System and Archive imports, this bug also refers to Existing Projects.

I'll hold off looking at the File System/Archive part of it but do you see any
issues with a patch to Import Existing Projets (I think I've found one)?
Comment 4 Aaron Luchko CLA 2005-05-27 19:19:21 EDT
Created attachment 21912 [details]
fix

This patch fixes the functionality in Zip and Tar imports of Existing Project,
the bug didn't exist with Existing Projects from the file system so behavior
among the three is now consistent.

I also removed an extraneous comment from WizardProjectsImportPage.java
Comment 5 Billy Biggs CLA 2005-06-08 14:37:06 EDT
This would be a nice fix, but since the problem exists in the other wizards I
don't think this is critical for 3.1.  The patch seems reasonable though.
Comment 6 Aaron Luchko CLA 2005-08-02 12:04:37 EDT
Should this fix be considered for 3.1.1 and/or 3.2?
Comment 7 Billy Biggs CLA 2005-08-26 11:26:05 EDT
*** Bug 33171 has been marked as a duplicate of this bug. ***
Comment 8 Karice McIntyre CLA 2005-08-26 16:22:24 EDT
I have tried the patch and it is not working for me.  When I do Import Existing 
Project and select an archive file (that I created using Export>Archive wizard) 
with a project in it, my project is not showing up in the list.

Also, this fix affects the Archive Import wizard as well - when I select that 
same archive file in the Import>Archive wizard, nothing shows up to select as 
source in the tree and list viewers .  

I think the File System Import not importing empty folders will require a 
separate fix.
Comment 9 Aaron Luchko CLA 2005-09-06 17:12:15 EDT
Created attachment 26870 [details]
fixed patch

Sorry about the bug in the last one, I've fixed the bug and tested a little
more extensively in this one against both 3_1Maintainance and HEAD.


Also it should be noted this patch is meant only to affect importing existing
projects as archive files, as well I don't believe there's a way to create
archive files with empty directories from eclipse currently.
Comment 10 Karice McIntyre CLA 2005-10-28 17:31:14 EDT
I checked the latest patch (0906) and it works for me.  Note this fix only 
applies for the import existing project, archive option.  The same bug still 
exists for the file system and archive imports (see bug 33171).
Comment 11 Karice McIntyre CLA 2005-11-04 12:09:34 EST
Tod, can you check this patch?
Comment 12 Tod Creasey CLA 2005-11-07 10:06:38 EST
The patch looks fine to me but we still need a test case. If you could attach a
tar and a zip with the issue then we could use that for verification.

I have released the patch for build > 20051107
Comment 13 Karice McIntyre CLA 2005-11-08 12:20:28 EST
I was only able to create a test archive for the zip case.  Anyone know how to 
create a tar file with an empty folder?  So far my attempts have not been 
successful.
Comment 14 Karice McIntyre CLA 2005-11-09 11:57:27 EST
Created attachment 29613 [details]
put archive in data/org.eclipse.datatransferArchives folder

Test data zip file.
Comment 15 Karice McIntyre CLA 2005-11-09 11:58:01 EST
Created attachment 29615 [details]
put archive in data/org.eclipse.datatransferArchives folder

Test data tar file.
Comment 16 Karice McIntyre CLA 2005-11-09 12:00:50 EST
Created attachment 29617 [details]
patch for ImportExistingTests.java

Added 2 tests (1 each for tar and zip) to import from archive that has an empty
folder.
Comment 17 Karice McIntyre CLA 2005-11-09 12:39:59 EST
Tod, can you check the patch for the added tests?  
Comment 18 Karice McIntyre CLA 2005-11-10 16:36:42 EST
Note: The patch for this bug caused bug 115800.  
Comment 19 Paul Webster CLA 2005-11-11 15:16:02 EST
Released the tests from comment #16 into HEAD >20051111

PW
Comment 20 Karice McIntyre CLA 2005-11-11 16:56:06 EST
Thanks, Paul.
Comment 21 Karice McIntyre CLA 2005-11-14 12:22:02 EST
Marking fixed since test is released now.
Comment 22 Karice McIntyre CLA 2005-12-13 09:59:16 EST
Verified in I20051213-0010