United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6753665 Applet.stop() not called when launching dragged applet from desktop
JDK-6753665 : Applet.stop() not called when launching dragged applet from desktop

Details
Type:
Bug
Submit Date:
2008-09-29
Status:
Closed
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2009-01-23
Component:
deploy
OS:
windows_xp
Sub-Component:
plugin
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:
6u12 (b01)

Related Reports
Relates:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0_10-rc2"
Java(TM) SE Runtime Environment (build 1.6.0_10-rc2-b32)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Service Pack 3 Japanese
Firefox 3.0.1


A DESCRIPTION OF THE PROBLEM :
When dragged applets launched from the desktop, Applet.stop() is not called.  Probably Applet.destroy() is not either.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Put NewJApplet.class into SwingApplet1.jar.
2. Place SwingApplet1.jar, NewJApplet.jnlp, and test.html on Glassfish V2 server with JnlpDownloadServlet enabled.
3. Open test.html from Firefox 3.
4. Drag the applet out of the browser.
5. Close test.html.
6. Accept the desktop integration.
7. Enable the debug logging on Java Control Panel.
8. Launch NewJApplet from the desktop.
9 Close it.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The debug log contains one entry for "start() called" and one for "stop() called".
ACTUAL -
The debug log contains only one entry for "start() called".

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
== NewJApplet.java

import javax.swing.JApplet;

public class NewJApplet extends JApplet
{
    @Override
    public void start ()
    {
        System.err.println ("start() called");
    }

    @Override
    public void stop ()
    {
        System.err.println ("stop() called");
    }
}

== NewJApplet.jnlp

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="6.0+" codebase="$$codebase" href="$$name">
  <information>
    <title>NewJApplet</title>
    <vendor>vx68k.org</vendor>
    <offline-allowed/>
    <shortcut>
      <desktop/>
    </shortcut>
  </information>
  <resources>
    <java version="1.5+"/>
    <jar href="SwingApplet1.jar" main="true"/>
  </resources>
  <applet-desc main-class="NewJApplet"
               name="applet" width="150" height="100">
  </applet-desc>
</jnlp>

== test.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title></title>
    </head>
    <body>
        <applet code="NewJApplet" width="150" height="100">
            <param name="jnlp_href" value="TestApplet.jnlp">
            <param name="draggable" value="true">
        </applet>
    </body>
</html>

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
None as far as I know.

                                    

Comments
WORK AROUND

applet code can use setAppletCloseListener() to set up its own ActionListener to perform applet lifecycle methods as a temp. workaround.
                                     
2008-09-29
EVALUATION

The default dragged-out applet CloseListener does not perforce applet.stop() and applet.destroy() before dispose the applet frame. This need be fixed.
                                     
2008-09-29



Hardware and Software, Engineered to Work Together