|
Quick Lists
|
|
Bug ID:
|
4406042
|
|
Votes
|
0
|
|
Synopsis
|
File.deleteOnExit() doesn't work in java plug-in.
|
|
Category
|
java_plugin:plugin
|
|
Reported Against
|
1.3
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Not a Defect,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
4166799
|
|
Submit Date
|
19-JAN-2001
|
|
Description
|
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
i have write the follow code and try to run it in appletviewer and plug-in
--- VcApplet.java ---
/*
<applet archive=VcApplet.jar code=VcApplet.class
width=100 height=100>
</applet>
*/
import java.io.*;
import javax.swing.*;
import java.awt.*;
public class VcApplet extends JApplet {
public void init() {
System.out.println("Calling init()...");
File tmpFile;
FileOutputStream fos;
DataOutputStream dos;
byte b[];
int rc;
b = new byte[200];
try {
tmpFile = File.createTempFile("abc", ".tmp");
System.out.println("Path=" + tmpFile.getPath() + "Name=" + tmpFile.getName());
tmpFile.deleteOnExit();
fos = new FileOutputStream(tmpFile);
dos = new DataOutputStream(fos);
dos.write(b, 0, 200);
dos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public void destroy() {
System.out.println("Calling destroy()...");
}
}
--- end here ---
I signed it and run it in both appletviewer and customer with Java plug-in
1.3.0-C.
The 'tmpFile' is not removed when run in Java plug-in even after I completely
closed the customer . It works find with appletviewer.
(Review ID: 108361)
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
Code specified in the beginning of VcApplet uses <applet> tag. In order to use Java Plug-in OBJECT/EMBED tag should be used instead of <applet> tag.
I converted user's applet with HTMLConverter, so that it would use OBJECT/EMBED tags, and tried to reproduce this bug. When Java Plug-in is used, VcApplet creates file, file exists while vm is running. Once you started the vm, it will be running until you close the browser. When I closed the browser, the file was deleted.
Note: in JDK tutorial there is a condition for File.deleteOnExit() function - vm must terminate normally. So, if the browser crushes or vm dies, the file VcApplet created might not be deleted.
xxxxx@xxxxx 2001-02-15
|
|
Comments
|
Submitted On 14-NOV-2006
Poor_Sitar_player
This is still a bug and Im using 1.5.0_09, has this ever worked??
Submitted On 19-JAN-2007
tom_guyette
Still broken from what I can tell too.
Submitted On 28-MAR-2007
hbarua
Still broken on plugin 1.5.0_11 ...wonder why these bugs are closed without proper evaluation.
Submitted On 25-OCT-2007
I tried the test case in jre 1.5.0_11 and jre6 and I see that the file is not being deleted on exit.
I used HTMLConverter, so that it would use OBJECT/EMBED tags, still the problem persists.
Please re-open the bug.
Submitted On 25-OCT-2007
Jose_paul
The Issue can be replicated in JDK 1.5 and 1.6 .
There is a change in the browser closing timings ,before browser used to provide sufficient time to JVM to close it correctly ,but now closing is bit fast and JVM is not geting sufficient time to close itself.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |