Bug 140750 - java.lang.IllegalStateException: zip file closed on typing while "Computing additional info"
Summary: java.lang.IllegalStateException: zip file closed on typing while "Computing a...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.2 RC4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-09 04:19 EDT by Martin Probst CLA
Modified: 2006-06-19 15:18 EDT (History)
4 users (show)

See Also:


Attachments
Proposed fix (868 bytes, patch)
2006-05-09 13:33 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Probst CLA 2006-05-09 04:19:29 EDT
I'm running Eclipse 3.2RC3 on the Apple JVM 1.5.0_06. On typing in a JDT editor, everytime context assist comes up, an error in a dialog window is raised, saying "An internal error occurred while "Computing additional info"".

The workbench log contains this stacktrace:
!ENTRY org.eclipse.core.jobs 4 2 2006-05-09 09:57:25.969
!MESSAGE An internal error occurred during: "Computing additional info".
!STACK 0
java.lang.IllegalStateException: zip file closed
        at java.util.zip.ZipFile.ensureOpen(ZipFile.java:518)
        at java.util.zip.ZipFile.getEntry(ZipFile.java:251)
        at java.util.jar.JarFile.getEntry(JarFile.java:200)
        at sun.net.www.protocol.jar.URLJarFile.getEntry(URLJarFile.java:90)
        at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:112)
        at sun.net.www.protocol.jar.JarURLConnection.getJarFile(JarURLConnection.java:69)
        at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:792)
        at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1086)
        at org.eclipse.jdt.internal.core.BinaryMethod.getAttachedJavadoc(BinaryMethod.java:531)
        at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getHTMLContentReader(ProposalInfo.java:112)
        at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.extractJavadoc(ProposalInfo.java:99)
        at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.computeInfo(ProposalInfo.java:76)
        at org.eclipse.jdt.internal.ui.text.java.ProposalInfo.getInfo(ProposalInfo.java:59)
        at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getAdditionalProposalInfo(AbstractJavaCompletionProposal.java:458)
        at org.eclipse.jface.text.contentassist.AdditionalInfoController$3.run(AdditionalInfoController.java:100)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
(END) 

It happens in a reproducable fashion every time I access documentation for something in the JDK class library. I've set the JavaDoc location for that to a zipfile on my hard drive, which is existent and readable and the corresponding dialog says it's ok when I click "Validate". If I unzip the files from the documentation and point Eclipse to that, the error vanishes.
Comment 1 Dani Megert CLA 2006-05-09 04:29:53 EDT
Should be investigated for RC4.
Comment 2 Olivier Thomann CLA 2006-05-09 13:05:37 EDT
In the worse case, we should throw a JME not an IllegalStateException.
Comment 3 Olivier Thomann CLA 2006-05-09 13:15:21 EDT
The failure occurs when trying to close the jarFile from the JarURLConnection.
On Windows or Linux, the file is not closed when the stream is closed.
I could add a catch for runtime exception or IllegalStateException around this call to silently eat this exception since we simply want to be sure that the file handle is released.
Comment 4 Olivier Thomann CLA 2006-05-09 13:33:57 EDT
Created attachment 40781 [details]
Proposed fix
Comment 5 Dani Megert CLA 2006-05-09 14:01:53 EDT
+1 to add this workaround for RC4 - the patch is of very low riks.
Comment 6 Philipe Mulet CLA 2006-05-10 10:07:23 EDT
+1 for 3.2RC4.

Martin - pls cast your vote
Comment 7 Martin Probst CLA 2006-05-10 11:52:10 EDT
Well, I'm certainly for fixing the problem, but I don't have a working Eclipse build system around (I tried, but it apparently didn't like me...) so I cannot test the patch. Fix sounds good though :-)
Comment 8 Martin Aeschlimann CLA 2006-05-10 12:26:30 EDT
+ 1 for 3.2 RC4. patch looks good.
Comment 9 Olivier Thomann CLA 2006-05-10 13:01:54 EDT
Fixed and released in HEAD.
No regression test available since this is MacOS specific.
To verify, simply check that the IllegalStateException are handled in the source code.
Comment 10 Olivier Thomann CLA 2006-05-11 22:06:02 EDT
Verified with I20060511-2000 for 3.2RC4
Comment 11 Bryan Obright CLA 2006-06-19 15:05:48 EDT
(In reply to comment #10)
> Verified with I20060511-2000 for 3.2RC4

This bug appears in 3.2RC7.  It is appearing when attempting to get the JavaDoc via the JavaDoc view or hover in the Java Editor.

The related JAR file has the JavaDoc in the JAR and is configured using the JavaDoc Location specified against the JAR with a local file system path and the archive specific (doc) folder.  The location passes validation.

The JavaDoc for the related JAR appears the first time it is accessed, and the exception it throw thereafter.

java.lang.IllegalStateException: zip file closed
	at java.util.zip.ZipFile.ensureOpen(ZipFile.java:398)
	at java.util.zip.ZipFile.getEntry(ZipFile.java:145)
	at java.util.jar.JarFile.getEntry(JarFile.java:194)
	at sun.net.www.protocol.jar.URLJarFile.getEntry(URLJarFile.java:89)
	at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:95)
	at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:107)
	at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:734)
	at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1086)
	at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:998)
	at org.eclipse.jdt.ui.JavadocContentAccess.getHTMLContentReader(JavadocContentAccess.java:120)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:153)
	at org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getHoverInfo(AbstractJavaEditorTextHover.java:121)
	at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo(BestMatchHover.java:102)
	at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo(JavaEditorTextHoverProxy.java:69)
	at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:160)
Comment 12 Olivier Thomann CLA 2006-06-19 15:15:20 EDT
This is a different issue.
Comment 13 Olivier Thomann CLA 2006-06-19 15:18:56 EDT
I opened bug 147771.
Could you please add yourself on the cc list and confirm that you are on MacOS?
Thanks.