The fix for 6632521 fails on some machines. The reason is that the Environment class is being statically initialized much earlier on these machines. The reason for this is that the deployment.system.cachedir property is set in the deployment.properties file. This causes the Cache.reset() method to go down a different code path which initializes the Environment class much earlier.
Here is a stack trace indicating where the Environment class was initialized on the machine where the fix for 6632521 was originally developed:
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Thread.java:1206)
at com.sun.deploy.Environment.<clinit>(Environment.java:18)
at com.sun.deploy.cache.Cache.getCacheEntry(Cache.java:1382)
at com.sun.deploy.net.DownloadEngine.isUpdateAvailable(DownloadEngine.java:670)
at com.sun.deploy.cache.DeployCacheHandler.get(DeployCacheHandler.java:132)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:681)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:654)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:977)
at sun.plugin.PluginURLJarFileCallBack.downloadJAR(PluginURLJarFileCallBack.java:72)
at sun.plugin.PluginURLJarFileCallBack.access$000(PluginURLJarFileCallBack.java:46)
at sun.plugin.PluginURLJarFileCallBack$1.run(PluginURLJarFileCallBack.java:106)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin.PluginURLJarFileCallBack.retrieve(PluginURLJarFileCallBack.java:94)
at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:186)
at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:50)
at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:78)
at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.connect(CachedJarURLConnection.java:189)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFileInternal(CachedJarURLConnection.java:144)
at sun.plugin.net.protocol.jar.CachedJarURLConnection.getJarFile(CachedJarURLConnection.java:90)
at sun.misc.URLClassPath$JarLoader.getJarFile(URLClassPath.java:647)
at sun.misc.URLClassPath$JarLoader.access$600(URLClassPath.java:538)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:605)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:597)
at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:559)
at sun.misc.URLClassPath$3.run(URLClassPath.java:331)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:320)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:297)
at sun.misc.URLClassPath.getResource(URLClassPath.java:167)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Applet2ClassLoader.java:171)
at java.security.AccessController.doPrivileged(Native Method)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Applet2ClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at sun.plugin2.applet.Applet2ClassLoader.loadCode(Applet2ClassLoader.java:845)
at sun.plugin2.applet.Applet2Manager.createApplet(Applet2Manager.java:2832)
at sun.plugin2.applet.Applet2Manager.access$2000(Applet2Manager.java:87)
at sun.plugin2.applet.Applet2Manager$AppletExecutionRunnable.run(Applet2Manager.java:1399)
at java.lang.Thread.run(Thread.java:619)
and here is a stack trace from a machine on which the Environment class is being initialized much earlier:
java.lang.Exception: Stack trace
at java.lang.Thread.dumpStack(Unknown Source)
at com.sun.deploy.Environment.<clinit>(Environment.java:18)
at com.sun.deploy.cache.Cache.reset(Cache.java:133)
at com.sun.deploy.cache.Cache.<clinit>(Cache.java:82)
at sun.plugin.util.UserProfile.getTempDirectory(UserProfile.java:71)
at sun.plugin.util.UserProfile.<clinit>(UserProfile.java:32)
at sun.plugin.AppletViewer.loadPropertiesFiles(AppletViewer.java:142)
at sun.plugin.JavaRunTime.initEnvironment(JavaRunTime.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.plugin2.applet.Applet2Environment.initJavaRunTime(Applet2Environment.java:579)
at sun.plugin2.applet.Applet2Environment.initialize(Applet2Environment.java:94)
at sun.plugin2.main.client.PluginMain.mainLoop(PluginMain.java:326)
at sun.plugin2.main.client.PluginMain.run(PluginMain.java:215)
at sun.plugin2.main.client.PluginMain.main(PluginMain.java:1201)