JDK-6673890 : Map24 applet fails with 6u4
  • Type: Bug
  • Component: deploy
  • Sub-Component: deployment_toolkit
  • Affected Version: 6u5
  • Priority: P2
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2008-03-11
  • Updated: 2010-08-06
  • Resolved: 2008-03-12
Related Reports
Relates :  
Description
Map24.com, a CAP member, has reported that their mapping applet is broken with 6u5. The exceptions displayed in the Java Console are as follows:

java.nio.channels.ClosedChannelException
    at sun.nio.ch.FileChannelImpl.ensureOpen(Unknown Source)
    at sun.nio.ch.FileChannelImpl.lock(Unknown Source)
    at com.sun.deploy.cache.CacheEntry.lockFile(Unknown Source)
    at com.sun.deploy.cache.CacheEntry.readIndexFile(Unknown Source)
    at com.sun.deploy.cache.CacheEntry.access$000(Unknown Source)
    at com.sun.deploy.cache.CacheEntry$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.deploy.cache.CacheEntry.<init>(Unknown Source)
    at com.sun.deploy.cache.Cache.getCacheEntryFromIdxFiles(Unknown Source)
    at com.sun.deploy.cache.Cache.getCacheEntry(Unknown Source)
    at com.sun.deploy.cache.Cache.getCacheEntry(Unknown Source)
    at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(Unknown Source)
    at com.sun.deploy.cache.DeployCacheHandler.get(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.HttpURLConnection.getResponseCode(Unknown Source)
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

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)

They report that the problem only occurs in IE, but this is currently the most widely used web browser. It also occurs nearly every time the applet is run.

There was a hypothesis that some changes to the caching code in 6u5 may have introduced this regression.

Map24 reports that the problem is not reproducible with 6u10 build 12.

To reproduce, visit http://www.map24.com/ .
The hypothesis is that this is a regression caused by the fix for 6595845. Assigning responsible engineer based on this.

Comments
EVALUATION To focus our priorities appropriately I am closing this bug as "Will Not Fix". It is likely related to rapid activation / deactivation of our ActiveX control in IE, which is a longstanding problem for which we have better solutions in the new Java Plug-In.
12-03-2008

EVALUATION It is possible that some applet lifecycle related changes in 6u4 introduced changes in applet termination that are the root cause of this problem. Given that the customer has found a workaround, and that the problem is not reproducible with the new Java Plug-In in 6u10, since there doesn't appear to be a regression in the download code I recommend closing this as "Will Not Fix".
12-03-2008

EVALUATION our applets all put themself into a static hashtable with an app id (which is set as parameter in the applet tag). If an applets starts and finds an applet in this static hashtable with the same app id, it will quit the init method immediately and print E015 to the java console. Our Ajax API does never write two applet tags with the same app id into the page, so it seems that two applets with the same app id get started from just one applet tag. We use node.innerHTML to put the applet tag into the DOM tree. We had this bug earlier with Java 5 Update 11. It was fixed in Update 12.
12-03-2008

WORK AROUND we found a workaround for the problem. If we create the DOM nodes and put them into the DOM tree of the site, it works. Here is how we do it now: function writeDetectionAppletDOMElement() { window.alert('writing detection applet via DOM element'); appletNode= document.createElement("applet"); appletNode.setAttribute("name","testApplet"); appletNode.setAttribute("id","testApplet"); appletNode.setAttribute("width","1"); appletNode.setAttribute("height","1"); appletNode.setAttribute("code","MJavaDetection.class"); appletNode.setAttribute("codebase","http://maptp35.map24.com/MAP24_v3.7.07_20071121"); appletNode.setAttribute("startup_document","javascript:window.alert('applet is up and running');"); appletNode.setAttribute("startup_frame","_self"); document.getElementById("detectionApplet").appendChild(appletNode); } The problem did not occur in our tests.
12-03-2008

EVALUATION customer found a workaround themselves, confirmed problem exists since 6u4, and provided more information and simpler testcase. we've now done a test with a really simple applet and the problem still occurs sometimes if the applet gets written into the DOM tree with innerHTML or outerHTML. Here is the JavaScript part: <head> </head> <body> <h1>Java Detection Test</h1> <div id="detectionApplet"></div> <script type="text/javascript"> var detectApp="<applet name=\"testapplet\" id=\"testapplet\" width=\"1\" height=\"1\"" +"code=\"com.mapsolute.test.SimpleApplet.class\"" +"codebase=\"http://maptp11.map24.com/TestApplets\">" //+"<param name=\"document\" value=\"javascript:window.alert('applet is up and running');\">" //+"<param name=\"target\" value=\"_self\">" +"</applet>"; function writeDetectionAppletInnerHTML() { window.alert('writing detection applet via innerHTML'); document.getElementById("detectionApplet").innerHTML= detectApp; } function writeDetectionAppletOuterHTML() { window.alert('writing detection applet via outerHTML'); document.getElementById("detectionApplet").outerHTML= "<div id=\"detectionApplet\">"+detectApp+"</div>"; } function writeDetectionAppletDocWriteln() { window.alert('writing detection applet via document.writeln'); document.writeln(detectApp); } </script> <br><a href="javascript:writeDetectionAppletInnerHTML()">writeDetectionAppletInnerHTML()</a><br> <br><a href="javascript:writeDetectionAppletOuterHTML()">writeDetectionAppletOuterHTML()</a><br> <br><a href="javascript:writeDetectionAppletDocWriteln()">writeDetectionAppletDocWriteln()</a> </body> And here's the applet code: package com.mapsolute.test; import java.applet.Applet; public class SimpleApplet extends Applet { public void init() { super.init(); System.out.println(getParameter("id")+" init()"); } public void start() { super.start(); System.out.println(getParameter("id")+" start()"); } public void stop() { super.stop(); System.out.println(getParameter("id")+" stop()"); } public void destroy() { super.destroy(); System.out.println(getParameter("id")+" destroy()"); } }
12-03-2008