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

Bug 337009

Summary: [Import/Export] Import project from archive silently loses files
Product: [Eclipse Project] Platform Reporter: Mike Bernat <mike.bernat>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Andreas.Gronert, daniel_megert, prakash, remy.suen
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
Failing archive file. none

Description Mike Bernat CLA 2011-02-11 16:37:53 EST
Created attachment 188819 [details]
Failing archive file.

When importing a project from an archive file, some of the files are not added to the project. There are not error messages, exceptions, or log entries related to the missing files.

Problem seems to be caused by two factors: 
First, the archive was not created with eclipse export, but rather is simply a zip file created from part of the workspace.
Second, there are some unicode characters in the failing file names.

Using the attached file, choose Import... -> Existing Project into Workspace -> Select archive file and browse to this file.

All of the files in the archive with the "actiondatamodel" extension are lost.

Note that if the archive is first unzipped to a directory, and that directory is used as the source of the import, the files are not lost.

I think the biggest issue here is the fact that there are no errors raised.
Comment 1 Prakash Rangaraj CLA 2011-02-14 00:51:21 EST
zipFile.getInputStream(zipEntry) returns null for those files. This also explains why unzipping and importing works. I assume that this is not an Eclipse problem, but a Java problem. But yes, Eclipse should at least show a warning/error in the Error Log. The ImportOperation does adds to a multi status, but that is not being used in the WizardProjectsImportPage.createExistingProject() method.

Targeting for 3.7. But mostly this will get fixed only in 3.8.
Comment 2 Dani Megert CLA 2011-02-14 06:47:32 EST
There are known issues with ZipEntry, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4244499. Not sure whether we get enough information to at least report an error.
Comment 3 Dani Megert CLA 2011-02-14 07:20:38 EST
Note that when using EA Java 7 JRE from Oracle the importer will not even find the project. Instead it will throw exceptions:

Debug options:
    file:/C:/eclipse/workspaces/Development_HEAD/plugins/.metadata/.plugins/org.eclipse.pde.core/eoe (Sun)/.options loaded

osgi> Time to load bundles: 47
Starting application: 7766
Application Started: 12188
!SESSION 2011-02-14 13:17:55.342 -----------------------------------------------
eclipse.buildId=N20110213-2000
java.version=1.7.0-ea
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.sdk.ide -keyring c:\eclipse\.keyring
Command-line arguments:  -product org.eclipse.sdk.ide -data C:\eclipse\workspaces\Development_HEAD\plugins/../eoe -dev file:C:/eclipse/workspaces/Development_HEAD/plugins/.metadata/.plugins/org.eclipse.pde.core/eoe (Sun)/dev.properties -debug C:\eclipse\workspaces\Development_HEAD\plugins\.metadata\.plugins\org.eclipse.pde.core\eoe (Sun)/.options -os win32 -ws win32 -arch x86 -console -consolelog -clean -keyring c:\eclipse\.keyring

!ENTRY org.eclipse.ui.ide 4 4 2011-02-14 13:19:06.046
!MESSAGE java.lang.reflect.InvocationTargetException
!STACK 0
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421)
	at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1029)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage.updateProjectsList(WizardProjectsImportPage.java:870)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage.handleLocationArchiveButtonPressed(WizardProjectsImportPage.java:1226)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage$8.widgetSelected(WizardProjectsImportPage.java:699)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4126)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3715)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.handlers.WizardHandler$Import.executeHandler(WizardHandler.java:150)
	at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:277)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
	at org.eclipse.ui.internal.actions.CommandAction.run(CommandAction.java:171)
	at org.eclipse.ui.actions.ImportResourcesAction.run(ImportResourcesAction.java:97)
	at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4126)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3715)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2700)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2664)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2498)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: java.lang.IllegalArgumentException: MALFORMED[1]
	at java.util.zip.ZipCoder.toString(ZipCoder.java:53)
	at java.util.zip.ZipFile.getZipEntry(ZipFile.java:498)
	at java.util.zip.ZipFile.access$800(ZipFile.java:53)
	at java.util.zip.ZipFile$2.nextElement(ZipFile.java:480)
	at java.util.zip.ZipFile$2.nextElement(ZipFile.java:450)
	at org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider.initialize(ZipLeveledStructureProvider.java:215)
	at org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider.getChildren(ZipLeveledStructureProvider.java:112)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage.collectProjectFilesFromProvider(WizardProjectsImportPage.java:1144)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage.access$13(WizardProjectsImportPage.java:1135)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage$15.run(WizardProjectsImportPage.java:923)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Root exception:
java.lang.IllegalArgumentException: MALFORMED[1]
	at java.util.zip.ZipCoder.toString(ZipCoder.java:53)
	at java.util.zip.ZipFile.getZipEntry(ZipFile.java:498)
	at java.util.zip.ZipFile.access$800(ZipFile.java:53)
	at java.util.zip.ZipFile$2.nextElement(ZipFile.java:480)
	at java.util.zip.ZipFile$2.nextElement(ZipFile.java:450)
	at org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider.initialize(ZipLeveledStructureProvider.java:215)
	at org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider.getChildren(ZipLeveledStructureProvider.java:112)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage.collectProjectFilesFromProvider(WizardProjectsImportPage.java:1144)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage.access$13(WizardProjectsImportPage.java:1135)
	at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage$15.run(WizardProjectsImportPage.java:923)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 4 Prakash Rangaraj CLA 2011-02-15 05:22:18 EST
This bug has two issues:

(1) not able to import the files
     This is not Eclipse. It is the JRE bug which Dani pointed to. Not sure of what could be done here. I don't see any workarounds as well. Investigating ...

(2) nothing shows up in the Error Log about (1)
     Can be addressed - most probably in 3.8 only.
Comment 5 Prakash Rangaraj CLA 2011-03-18 05:59:10 EDT
(In reply to comment #4)
> (2) nothing shows up in the Error Log about (1)
>      Can be addressed - most probably in 3.8 only.

   (2) is addressed by Bug# 293950
Comment 6 Prakash Rangaraj CLA 2011-03-23 07:08:48 EDT
Not for this release. Will revisit later.
Comment 7 Lars Vogel CLA 2019-11-27 07:15:39 EST
This bug hasn't had any activity in quite some time. Maybe the problem got
resolved, was a duplicate of something else, or became less pressing for some
reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it.
The information can be, for example, that the problem still occurs, that you
still want the feature, that more information is needed, or that the bug is
(for whatever reason) no longer relevant.

If the bug is still relevant, please remove the stalebug whiteboard tag.
Comment 8 Andreas Gronert CLA 2022-10-26 06:39:13 EDT
Hello Lars,
we still do have this problem. More precise, I have a script to export selective projects via 7zip. My colleagues import it manually via eclipse. This worked fine for many years.

Lately we did add a file named §AG.CLLE, that was needed for a project. With this file the import is not possible. After selecting the zip-file, I'm getting a message "Keine Projekte zum Importieren gefunden", what means that the import dialog or import-from-archive-file-feature must have respective problem. This is not exactly, what was written above, but most likely the same cause.

Similar like written above, unzipping the file via 7zip and importing it via "Stammverzeichnis auswählen" i.e. from file system folder that is not zipped. workes fine.

Could you please try to reproduce the problem by creating a simple project adding a file §AG.CLLE using 7zip to zip it and import it via eclipse-import-from-archive-file-feature? I guess, once you can reproduce that problem you even may be able to fix it and preventing prospective eclipse users from falling over this problem.
Kind regards
Andreas Gronert