Bug 31168 - Trying to open Java-source file with Java editor fails with I/O Exception.
Summary: Trying to open Java-source file with Java editor fails with I/O Exception.
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Linux
: P3 blocker (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-06 16:51 EST by Jarkko Lietolahti CLA
Modified: 2003-02-24 04:51 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jarkko Lietolahti CLA 2003-02-06 16:51:03 EST
Build id: 200302060800 
Linux RH 8.0 
Trying to open a java file for editing with Java Editor fails and gives a pop-up
window titled "Problems Opening Editor" with contents "I/O Exception." and
OK-button. Nothing is printed to .log. I think the same effect is happening with
few previous builds too (I20030205 and with most nigthly builds since 15th-jan.) 

Opening the same file with Text Editors works fine.
Comment 1 Jarkko Lietolahti CLA 2003-02-06 17:05:33 EST
Ok, it fails when trying to open a Java file from an old project. If i create a
new project and add a new class the Java editor works just fine. 
Comment 2 Jarkko Lietolahti CLA 2003-02-06 17:15:09 EST
Gets even more odd; Trying to copy&paste the file which won't open with Java
Editor doesn't like to be copy-pasted. Also trying to copy&paste a file which
opens with Java Editor doesn't have "Paste" active when trying to paste it to
the same package where the no-go Java file is located.
Comment 3 Jarkko Lietolahti CLA 2003-02-06 17:17:34 EST
Trying to do "Organize imports" with the no-go file gives an error-pop up, a
message in a log and opens the file in text editor.
!ENTRY org.eclipse.jdt.ui 4 10001 helmi 07, 2003 00:11:40.289
!MESSAGE Internal Error
!STACK 1
org.eclipse.jdt.core.JavaModelException[-1]: java.util.zip.ZipException:
Tiedostoa tai hakemistoa ei ole
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:112)
        at java.util.zip.ZipFile.<init>(ZipFile.java:72)
        at
org.eclipse.jdt.internal.core.JavaModelManager.getZipFile(JavaModelManager.java:1057)
        at
org.eclipse.jdt.internal.core.JarPackageFragmentRoot.getJar(JarPackageFragmentRoot.java:220)
        at
org.eclipse.jdt.internal.core.JarPackageFragmentRoot.computeJarChildren(JarPackageFragmentRoot.java:90)
        at
org.eclipse.jdt.internal.core.JarPackageFragmentRoot.computeChildren(JarPackageFragmentRoot.java:71)
        at
org.eclipse.jdt.internal.core.PackageFragmentRoot.generateInfos(PackageFragmentRoot.java:442)
        at org.eclipse.jdt.internal.core.Openable.buildStructure(Openable.java:71)
        at org.eclipse.jdt.internal.core.Openable.openWhenClosed(Openable.java:394)
        at
org.eclipse.jdt.internal.core.PackageFragmentRoot.openWhenClosed(PackageFragmentRoot.java:782)
        at org.eclipse.jdt.internal.core.Openable.open(Openable.java:346)
        at
org.eclipse.jdt.internal.core.JarPackageFragment.openWhenClosed(JarPackageFragment.java:150)
        at org.eclipse.jdt.internal.core.Openable.openParent(Openable.java:369)
        at
org.eclipse.jdt.internal.core.CompilationUnit.openParent(CompilationUnit.java:751)
        at
org.eclipse.jdt.internal.core.WorkingCopy.openParent(WorkingCopy.java:398)
        at org.eclipse.jdt.internal.core.Openable.openWhenClosed(Openable.java:385)
        at org.eclipse.jdt.internal.core.Openable.open(Openable.java:346)
        at org.eclipse.jdt.internal.core.WorkingCopy.open(WorkingCopy.java:354)
        at
org.eclipse.jdt.internal.core.CompilationUnit.getWorkingCopy(CompilationUnit.java:609)
        at
org.eclipse.jdt.internal.core.CompilationUnit.getSharedWorkingCopy(CompilationUnit.java:581)
        at
org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createElementInfo(CompilationUnitDocumentProvider.java:850)
        at
org.eclipse.ui.texteditor.AbstractDocumentProvider.connect(AbstractDocumentProvider.java:302)
        at
org.eclipse.jdt.internal.corext.textmanipulation.TextBufferFactory.acquire(TextBufferFactory.java:85)
        at
org.eclipse.jdt.internal.corext.textmanipulation.TextBuffer.acquire(TextBuffer.java:371)
        at
org.eclipse.jdt.internal.corext.codemanipulation.ImportsStructure.aquireTextBuffer(ImportsStructure.java:538)
        at
org.eclipse.jdt.internal.corext.codemanipulation.ImportsStructure.create(ImportsStructure.java:517)
        at
org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.run(OrganizeImportsOperation.java:527)
       at
org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:34)
        at
org.eclipse.jdt.internal.core.JavaModelOperation.execute(JavaModelOperation.java:343)
        at
org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:671)
        at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1588)
     at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:2633)
        at
org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:32)
        at
org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.internalRun(BusyIndicatorRunnableContext.java:107)
        at
org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.run(BusyIndicatorRunnableContext.java:74)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65)
        at
org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext.run(BusyIndicatorRunnableContext.java:120)
        at
org.eclipse.jdt.ui.actions.OrganizeImportsAction.run(OrganizeImportsAction.java:375)
        at
org.eclipse.jdt.ui.actions.OrganizeImportsAction.run(OrganizeImportsAction.java:257)
        at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:191)
        at
org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:169)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:804)
        at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:450)
        at
org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:398)
        at
org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:392)
        at
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:72)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:897)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1502)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1319)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1289)
        at org.eclipse.ui.internal.Workbench.run(Workbench.java:1272)
        at
org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:845)
        at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
        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:324)
        at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
        at org.eclipse.core.launcher.Main.run(Main.java:703)
        at org.eclipse.core.launcher.Main.main(Main.java:539)
Comment 4 Jarkko Lietolahti CLA 2003-02-06 17:18:19 EST
"Tiedostoa tai hakemistoa ei ole" means File or directory doesn't exists.
Comment 5 Jarkko Lietolahti CLA 2003-02-06 17:26:57 EST
In Java perspective using "Hierarchical Layout" displays only directories
(src/MyApp.ear/AccountEjb.jar). If you click directory name the little triangle
(open/collapse) disappears from before the name. Changing back to Flat-layout
brings back the little triangles and it's possible to navigate under the
directory and find the packages and classes in it. But if trying to open the
file with Java Editor you still get I/O-exception.
Comment 6 Philipe Mulet CLA 2003-02-06 17:34:32 EST
Could you provide your testcase ? I suspect some JAR is corrupted, and causes 
some trouble to our tooling (when editing, we will try to resolve references, 
so as to determine errors as you type).

We would need the project causing grief and indications about how to set it up.
Comment 7 Jarkko Lietolahti CLA 2003-02-06 17:46:54 EST
This has something to do with Java source folders setup. All the source code is
located in few directories under src/MyEar.ear/FirstEJB.jar/,
src/MyEar.ear/SecondEJB.jar/ etc. If i remove all Java source folders from Java
Build Path->Source i can edit any Java file in Java Editor if browsed from
Resource's Navigator. None of the Java-files are visible from Java Perpective
(naturally).
Here's the original trouble causing .classpath for the project:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/openport-std.jar"
path="src/IntraFrame.ear/openport-std.jar"/>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/openport-ejb.jar"
path="src/IntraFrame.ear/openport-ejb.jar"/>
    <classpathentry kind="src" path="src/IntraFrame.ear/Navigation-ejb.jar"/>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/NewsCategory-ejb.jar"
path="src/IntraFrame.ear/NewsCategory-ejb.jar"/>
    <classpathentry kind="src" output="src/IntraFrame.ear/News-ejb.jar"
path="src/IntraFrame.ear/News-ejb.jar"/>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/NewsRoleRestrictions-ejb.jar"
path="src/IntraFrame.ear/NewsRoleRestrictions-ejb.jar"/>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/NewsSection-ejb.jar"
path="src/IntraFrame.ear/NewsSection-ejb.jar"/>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/SiteNewsCategory-ejb.jar"
path="src/IntraFrame.ear/SiteNewsCategory-ejb.jar"/>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/SiteSection-ejb.jar"
path="src/IntraFrame.ear/SiteSection-ejb.jar"/>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/SiteSectionNews-ejb.jar"
path="src/IntraFrame.ear/SiteSectionNews-ejb.jar"/>
    <classpathentry kind="src"
        output="src/IntraFrame.ear/Template-ejb.jar"
path="src/IntraFrame.ear/Template-ejb.jar"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
... few more J2EE-jars etc..
Comment 8 Jarkko Lietolahti CLA 2003-02-06 17:50:16 EST
Is there code somewhere which assumes file system entries ending with .jar are
always files and not directories? If you give a directory named "MyEjb.jar" to
java.util.zip you'd most certainly get file does not exists-exception.

> java.util.zip.ZipException:
> Tiedostoa tai hakemistoa ei ole
>        at java.util.zip.ZipFile.open(Native Method)
Comment 9 Jarkko Lietolahti CLA 2003-02-06 17:56:02 EST
This seems to be the case. I renamed directory IntraFrame.ear to IntraFrame,
also renamed directory Navigation-ejb.jar to Navigation-ejb and things started
working. Java Editor can open the classes inside Navigation-ejb.
Comment 10 Jarkko Lietolahti CLA 2003-02-06 18:03:59 EST
Renamed the middle directory IntraFrame back to IntraFrame.ear, (kept name of
NavigationEjb -directory as is) things worked fine.
Renamed IntraFrame.ear/NavigationEjb to IntraFrame.ear/NavigationEjb.jar and
things went broke. 
So it's seems that a directory ending with .jar is considered to be a normal
jar-library and is tried to open (for the purpose of searching the classes in it).
Comment 11 Philipe Mulet CLA 2003-02-07 11:35:02 EST
I see. We got tricked into thinking the folder was actually a JAR based on its 
extension. Note that note all code was assuming so, but one path did actually 
not protected as it should have.

Fixed in latest
Comment 12 David Audel CLA 2003-02-24 04:51:03 EST
Verified.