Bug 229038 - [build path] When adding an archive we should check whether the format is valid ZIP
Summary: [build path] When adding an archive we should check whether the format is val...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 314887 (view as bug list)
Depends on: 229042 321170
Blocks:
  Show dependency tree
 
Reported: 2008-04-28 09:51 EDT by Dani Megert CLA
Modified: 2022-10-04 04:25 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2008-04-28 09:51:33 EDT
I20080427-2000.

When adding an archive we should check whether the format is valid  ZIP. This can be done by calling new ZipFile(localFile).

Currently nothing happens when choosing and adding the archive. When expanding it in the Package Explorer an exception (see below) is logged but no feedback at all in the UI.

org.eclipse.core.runtime.CoreException: I/O exception
	at org.eclipse.jdt.internal.core.JavaModelManager.getZipFile(JavaModelManager.java:2204)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.getJar(JarPackageFragmentRoot.java:152)
	at org.eclipse.jdt.internal.core.JarPackageFragmentRoot.computeChildren(JarPackageFragmentRoot.java:78)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.buildStructure(PackageFragmentRoot.java:154)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:257)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:514)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:251)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:237)
	at org.eclipse.jdt.internal.core.JavaElement.getChildren(JavaElement.java:192)
	at org.eclipse.jdt.ui.StandardJavaElementContentProvider.getPackageFragmentRootContent(StandardJavaElementContentProvider.java:264)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider.getPackageFragmentRootContent(PackageExplorerContentProvider.java:226)
	at org.eclipse.jdt.ui.StandardJavaElementContentProvider.getChildren(StandardJavaElementContentProvider.java:186)
	at org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider.getChildren(PackageExplorerContentProvider.java:295)
	at org.eclipse.jface.viewers.AbstractTreeViewer.getRawChildren(AbstractTreeViewer.java:1352)
	at org.eclipse.jface.viewers.TreeViewer.getRawChildren(TreeViewer.java:380)
	at org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer.getFilteredChildren(ProblemTreeViewer.java:258)
	at org.eclipse.jface.viewers.AbstractTreeViewer.getSortedChildren(AbstractTreeViewer.java:602)
	at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractTreeViewer.java:799)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:776)
	at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:629)
	at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand(AbstractTreeViewer.java:1442)
	at org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeViewer.java:922)
	at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded(AbstractTreeViewer.java:1453)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:125)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1002)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1026)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1011)
	at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:7182)
	at org.eclipse.swt.widgets.Control.wmNotify(Control.java:4712)
	at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:1756)
	at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4342)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3835)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4485)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2260)
	at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1521)
	at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:6134)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3816)
	at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5676)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4498)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2346)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3377)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2351)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2315)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2181)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:477)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:472)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:112)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
	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:379)
	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:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
	at org.eclipse.core.launcher.Main.main(Main.java:30)
Caused by: java.util.zip.ZipException: error in opening zip file
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(ZipFile.java:114)
	at java.util.zip.ZipFile.<init>(ZipFile.java:131)
	at org.eclipse.jdt.internal.core.JavaModelManager.getZipFile(JavaModelManager.java:2198)
	... 66 more
Comment 1 Dani Megert CLA 2008-04-28 09:56:32 EDT
See also bug 229042.
Comment 2 Martin Aeschlimann CLA 2008-04-29 11:10:32 EDT
It was always possible to add JARs and ZIPs that were no real archives.
Best is if jdt.core can correctly handle it. Maybe with a build marker or just by seeing in the package explorer that the 'archive' has no entries.
Comment 3 Markus Keller CLA 2008-07-10 12:17:51 EDT
Should try to open the ZipFile in the validator and disable OK if it can't be
read.
Comment 4 Markus Keller CLA 2010-05-28 12:26:47 EDT
*** Bug 314887 has been marked as a duplicate of this bug. ***
Comment 5 Luciana Moreira CLA 2010-06-03 03:00:41 EDT
Just an additional information for future reference. The message I saw when I pressed F3 to open a class was: Current text selection cannot be opened in an editor

This error message turned out to be caused by the incorrectly entered txt files as jar file.
Comment 6 Ralf Hauser CLA 2010-06-03 12:10:37 EDT
suggestions:

1) whenever the "Current text selection cannot be opened in an editor" is shown and the cause is the jar/zip error
a) cite in the error message the first corrupt jar file
b) offer a quick-fix to work on the build path

2) it appears that once the first corruptly zipped jar is found, no further jar files are scanned..., i.e. F3 won't work on classes that come out of perfectly ok jar files...
==> except for the corrupt jar, continue to scan all others and don't to a fast-fail when working on the build path
Comment 7 Ralf Hauser CLA 2010-06-11 03:24:55 EDT
see also bug 316573
Comment 8 Dani Megert CLA 2010-06-11 03:28:42 EDT
>see also bug 316573
Why do you think it is related? Do you have more steps than written in said bug? I can't see any indication there. Also, said bug says there wasn't anything in the .log.
Comment 9 Eclipse Genie CLA 2020-08-09 18:49:38 EDT
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.

--
The automated Eclipse Genie.
Comment 10 Eclipse Genie CLA 2022-10-04 04:25:17 EDT
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.

--
The automated Eclipse Genie.