I use the javaHelp framework in an applet to display html pages. Until java 1.6 the full text search worked great, but it fails since java 1.6. Apparently the problem comes from a jar file (with the html data) being not load. I post the following bug in the database but since I hade no information back, I would be glad is someone could test my code below.
Thanks
Francois
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05) Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Tested with Firefox Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9
A DESCRIPTION OF THE PROBLEM :
With java 1.6 an applet cannot read a jar file in the same directory if "Keep the temporary files on my computer" is checked in the java console (in XP control Panel)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Create a jar file named test.jar with a file named msg2.txt in it. Placed in a server in the same directory then the applet class file.
3) Compile the java file geven below (adapted from bug 6456667) and placed the class file in the same directory then the jar file on the server. Here the directory is dokpe/procedures
the java console gives the following output
Good: test2.txt doesn't exist.
msg2 available: 2686
java.util.zip.ZipException: ZipFile closed
at java.util.zip.ZipFile.ensureOpenOrZipException(Unknown Source)
at java.util.zip.ZipFile.access$1100(Unknown Source)
at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
at java.util.zip.ZipFile$1.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at ApJarUrls.init(ApJarUrls.java:31)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The java console gives
ACTUAL -
the line test1Stream.read() throws a ZipFile closed exception
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.util.zip.ZipException: ZipFile closed
at java.util.zip.ZipFile.ensureOpenOrZipException(Unknown Source)
at java.util.zip.ZipFile.access$1100(Unknown Source)
at java.util.zip.ZipFile$ZipFileInputStream.read(Unknown Source)
at java.util.zip.ZipFile$1.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at ApJarUrls.init(ApJarUrls.java:31)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
REPRODUCIBILITY :
This bug can be reproduced always.
BEGIN SOURCE
//Change the path to the directory in the server and compile:
//ApJarUrls.java
//code from from 6456667
import java.io.;
import java.net.;
import javax.swing.JApplet;
public class ApJarUrls extends JApplet {
public ApJarUrls(){super();}
public void init() {
InputStream test1Stream=null;
URL test2 = null;
try {
// public static void main(String[] args) throws Exception {
File jarFile = new File("test.jar");
String jarUrl = "jar:http://localhost/dokpe/procedures/test.jar!/";
URL test1 = new URL(jarUrl "msg2.txt");
test1Stream = new BufferedInputStream(test1.openStream());
test2 = new URL(jarUrl "test2.txt");
System.err.println("msg2 available: " test1Stream.available());
System.err.println("msg2 read: " test1Stream.read());
} catch (IOException e){e.printStackTrace();}
}//init
}
END SOURCE
CUSTOMER SUBMITTED WORKAROUND :
In the Control Panel open Java, turn off "Keep temporary files on my computer" and the applet works as expected.