A DESCRIPTION OF THE PROBLEM :
When a page with applets is refreshed frequently, IE hangs. Nothing can be done with IE and IE can be closed only in Task Manager.
I tried with a simple applet and the JSP refreshes with a certain wait time. The Applet gives the following error after some time.
java.lang.NullPointerException
at sun.plugin.AppletViewer.loadJarFiles(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Later after little more time, the browser freezes to respond.
The hang occurs sooner
1. if there are more number of applets in a page.
2. if the refresh frequency is more (the wait time between refresh is less)
3. if the applet jar file is heavy.
4. if the windows system is busy.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Refresh frequently a page with applets.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No hang in the browser.
ACTUAL -
Browser hang.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
at sun.plugin.AppletViewer.loadJarFiles(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*Source code of the applet.
*/
package test;
import javax.swing.JApplet;
public class MyApplet extends JApplet
{
private static final long serialVersionUID = 1L;
// Initialize the applet
public void init()
{
super.init();
System.out.println("MyApplet - init()");
}
public void start() {
super.start();
System.out.println("MyApplet - start()");
}
public void stop() {
super.stop();
System.out.println("MyApplet - stop()");
}
public void destroy() {
super.destroy();
System.out.println("MyApplet - destroy()");
}
}
<%--
Source code of the JSP containing applet.
--%>
<%
Long retryAttempt = (Long)session.getAttribute("attempt");
if(retryAttempt == null)
{
retryAttempt = new Long(1);
} else
{
retryAttempt = new Long(retryAttempt.longValue()+1);
}
session.setAttribute("attempt", retryAttempt);
%>
<html>
<head>
<title>Testing Applet Reloaded <%=retryAttempt%></title>
</head>
<body onLoad="setTimeout('document.forms[0].submit()', 100)">
<form>
<input type=submit name="but1" value="Reload">
</form>
<OBJECT classid="clsid:CAFEEFAC-0015-0000-0005-ABCDEFFEDCBA" name="MyApplet" width="50" height="50" align="middle">
<param name="java_code" value="test.MyApplet">
<param name="java_codebase" value="/test/applets">
<param name="type" value="application/x-java-applet;version=1.5.0_05">
<param name="java_type" value="application/x-java-applet;jpi-version=1.5.0_05">
<param name="name" value="MyApplet">
<param name="cache_archive" value="MyApplet.jar">
</OBJECT>
<br><h1>so far <%=retryAttempt%> times</h1>
</body>
</html>
---------- END SOURCE ----------