From 9dcf59dab597289881bd9466a09c051b0860dadd Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Fri, 20 Nov 2009 23:06:24 +0000 Subject: [PATCH] workaround for missing certificate for AppletLoader if cached --- src/java/org/lwjgl/util/applet/AppletLoader.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/java/org/lwjgl/util/applet/AppletLoader.java b/src/java/org/lwjgl/util/applet/AppletLoader.java index 8415bb63..dc53d311 100644 --- a/src/java/org/lwjgl/util/applet/AppletLoader.java +++ b/src/java/org/lwjgl/util/applet/AppletLoader.java @@ -54,6 +54,7 @@ import java.io.Writer; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.net.HttpURLConnection; +import java.net.JarURLConnection; import java.net.SocketPermission; import java.net.URL; import java.net.URLClassLoader; @@ -1045,6 +1046,16 @@ public class AppletLoader extends Applet implements Runnable, AppletStub { // get the current certificate to compare against native files Certificate[] certificate = AppletLoader.class.getProtectionDomain().getCodeSource().getCertificates(); + + // workaround for bug where cached applet loader does not have certificates!? + if (certificate == null) { + URL location = AppletLoader.class.getProtectionDomain().getCodeSource().getLocation(); + + // manually load the certificate + JarURLConnection jurl = (JarURLConnection) (new URL("jar:" + location.toString() + "!/org/lwjgl/util/applet/AppletLoader.class").openConnection()); + jurl.setDefaultUseCaches(true); + certificate = jurl.getCertificates(); + } // create native folder File nativeFolder = new File(path + "natives");