Name: gm110360 Date: 01/12/2003
FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows NT ver 4.0
EXTRA RELEVANT SYSTEM CONFIGURATION :
Latest plug-in installed. IE as default browser
A DESCRIPTION OF THE PROBLEM :
We are running an application that uses applets. We have
used Java script to calculate some parameters and pass them
to the applet. The applet used to load correctly in the
previous version of Java Plug-In i.e. 1.4.0_01.
The same applet does not load when we install the new plug-
in i.e 1.4.1
REGRESSION. Last worked in version 1.4
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a sample applet that accepts params for height,
width, alignment.
2. In the JSP, use JavaScript to dynamically calculate the
above params and pass the params to the applet.
3. Run the JSP. It will not load.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The expected results were to see the applet loaded and
running on the IE screen.
The actual result is a gray-screen with the error seen on
the Java console.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
at sun.plugin.viewer.context.IExplorerAppletContext.getJSObject(Unknown
Source)
at sun.plugin.AppletViewer.getDocumentBase(Unknown Source)
at sun.plugin.AppletViewer.getCodeBase(Unknown Source)
at sun.plugin.AppletViewer.appletInit(Unknown Source)
at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)
netscape.javascript.JSException
at netscape.javascript.JSObject.getWindow(Unknown Source)
at com.mypkg.myappl.CPApplet.jbInit(CPApplet.java:45)
at com.mypkg.myappl.CPApplet.init(CPApplet.java:36)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
The following code is of the JSP that hosts the applet. The applet code is not
provided since it is easy to create a sample applet that will replicate the
problem
JSP Code
========
<%@ page language="java" session="true" %>
<% String sClassName = "com.mypkg.myappl.HomeCard";
String serverScheme = request.getScheme();
String serverName = request.getServerName();
int serverPort = request.getServerPort();
String contextPath = request.getContextPath();
String finalUrl = serverScheme + "://" + serverName + ":" + serverPort +
contextPath;
%>
<html>
<head>
<title> </title>
</head>
<script language="javascript">
function SetCookie (name, value)
{
var expires = new Date();
expires.setTime( expires.getTime() + (24 * 60 * 60 * 1000) * 180 ); // 6
months from now
var secure = false;
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires.toGMTString() : "");
}
function getCookie1(name) {
var arg = name+"=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function setapplet()
{
var innerStr = "";
var appheight = screen.availHeight / 1.305;
var appwidth = screen.availWidth - 20;
innerStr = "<applet codebase='<%=request.getContextPath() + "/classes/"%
>'"
+"code = 'com.mypkg.myappl.CPApplet.class'"
+"archive = 'CP.jar'"
+"name = 'CPApplet'"
+"width = '"+appwidth+"'"
+"height = '"+appheight+"'"
+"hspace = '0'"
+"vspace = '0'"
+"align = 'middle' MAYSCRIPT>"
+"<param name='serverUrl' value='<%=finalUrl
+ "/"%>'>"
+"<param name='loadClass' value='<%=sClassName%
>'>"
+"<param name='homePageLinkText'
value='LH.pdf'>"
+"<param name='appletwidth' value="+appwidth+">"
+"<param name='appletheight'
value="+appheight+">"
+"<param name='appletName' value='home'>"
+"</applet>"
document.getElementById("applettag").innerHTML = innerStr;
}
</script>
<body topmargin="0" leftmargin="0" onload="javascript:setapplet();">
<div id="applettag">
</div>
</body>
</html>
Note: The applet is a signed applet.
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Use the old plug-in
(Review ID: 178955)
======================================================================
- duplicates
-
JDK-4800257 NPE while access JSObject
- Closed
-
JDK-4751259 Java->JS crashes IE with JPI 1.4.0_02/ NPE with 1.4.1
- Closed