Java caching properly disabled, this should prevent the AppletLoader from continuing to load jars from the java cache which have become corrupt.

The infamous "Fatal Error occured (5): null" bug should now go away on refresh as the files are redownloaded.
This commit is contained in:
kappa1 2009-09-03 20:15:46 +00:00
parent 02f54eb831
commit 58703c742d

View file

@ -52,6 +52,7 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.SocketPermission;
import java.net.URL;
@ -779,11 +780,15 @@ public class AppletLoader extends Applet implements Runnable, AppletStub {
state = STATE_DOWNLOADING;
URLConnection urlconnection;
// disable the java caching
Field field = URLConnection.class.getDeclaredField("defaultUseCaches");
field.setAccessible(true);
field.setBoolean(URLConnection.class, false);
// calculate total size of jars to download
for (int i = 0; i < urlList.length; i++) {
urlconnection = urlList[i].openConnection();
urlconnection.setDefaultUseCaches(false);
totalSizeDownload += urlconnection.getContentLength();
}