home *** CD-ROM | disk | FTP | other *** search
- package com.ms.applet;
-
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.io.InputStream;
- import java.net.URL;
- import java.net.URLConnection;
- import java.util.Hashtable;
-
- class AppletClassLoader extends AppletBaseClassLoader {
- boolean verboseClassLoading = false;
- Hashtable classes = new Hashtable();
-
- AppletClassLoader(URL var1) {
- super.base = var1;
- }
-
- private Class loadClass(URL var1) throws IOException {
- InputStream var2 = null;
-
- try {
- Class var18;
- try {
- URLConnection var5 = var1.openConnection();
- var5.setAllowUserInteraction(false);
- var5.setUseCaches(true);
- var2 = var5.getInputStream();
- int var6 = var5.getContentLength();
- byte[] var7 = new byte[var6 == -1 ? 4096 : var6];
- int var8 = 0;
- Thread var10 = Thread.currentThread();
-
- int var9;
- while((var9 = var2.read(var7, var8, var7.length - var8)) >= 0 && !var10.isInterrupted()) {
- if ((var8 += var9) == var7.length) {
- if (var6 >= 0) {
- break;
- }
-
- byte[] var11 = new byte[var8 * 2];
- System.arraycopy(var7, 0, var11, 0, var8);
- var7 = var11;
- }
- }
-
- if (var10.isInterrupted()) {
- throw new IOException("class loading interrupted: " + var1);
- }
-
- var18 = ((ClassLoader)this).defineClass(var7, 0, var8);
- } finally {
- if (var2 != null) {
- var2.close();
- }
-
- }
-
- return var18;
- } catch (IOException var16) {
- ((Throwable)var16).printStackTrace();
- throw var16;
- } catch (Throwable var17) {
- var17.printStackTrace();
- throw new IOException("class not loaded: " + var1);
- }
- }
-
- public Class loadClass(String var1) throws ClassNotFoundException {
- return this.loadClass(var1, true);
- }
-
- protected Class loadClass(String var1, boolean var2) throws ClassNotFoundException {
- Class var3 = (Class)this.classes.get(var1);
- if (var3 == null) {
- SecurityManager var4 = System.getSecurityManager();
- if (var4 != null) {
- int var5 = var1.lastIndexOf(46);
- if (var5 >= 0) {
- var4.checkPackageAccess(var1.substring(0, var5));
- }
- }
-
- try {
- Class var7 = ((ClassLoader)this).findSystemClass(var1);
- return var7;
- } catch (Throwable var6) {
- var3 = this.findClass(var1);
- }
- }
-
- if (var3 == null) {
- throw new ClassNotFoundException(var1);
- } else {
- if (var2) {
- ((ClassLoader)this).resolveClass(var3);
- }
-
- return var3;
- }
- }
-
- void errorMsg(String var1, String var2) {
- }
-
- void errorMsg(String var1, String var2, String var3) {
- }
-
- private synchronized Class findClass(String var1) {
- Class var2 = (Class)this.classes.get(var1);
- if (var2 != null) {
- return var2;
- } else {
- SecurityManager var3 = System.getSecurityManager();
- if (var3 != null) {
- int var4 = var1.lastIndexOf(46);
- if (var4 >= 0 && !((AppletBaseClassLoader)this).getSecureState()) {
- var3.checkPackageDefinition(var1.substring(0, var4));
- }
- }
-
- String var24 = var1.replace('.', '/') + ".class";
-
- try {
- URL var5 = new URL(super.base, var24);
- BrowserAppletFrame var6 = ((AppletBaseClassLoader)this).currentAppletFrame();
-
- try {
- ((AppletBaseClassLoader)this).showDownloadUI(var6, 260, var5);
- var2 = this.loadClass(var5);
- } finally {
- ((AppletBaseClassLoader)this).hideDownloadUI(var6);
- }
-
- if (!var1.equals(var2.getName())) {
- Class var7 = var2;
- Object var23 = null;
- throw new ClassFormatError(var1 + " != " + var7.getName());
- }
-
- this.classes.put(var1, var2);
- } catch (FileNotFoundException var17) {
- this.errorMsg("filenotfound", var1);
- } catch (ClassFormatError var18) {
- this.errorMsg("fileformat", var1);
- } catch (IOException var19) {
- this.errorMsg("fileioexception", var1);
- } catch (Exception var20) {
- this.errorMsg("fileexception", ((Throwable)var20).toString(), var1);
- } catch (ThreadDeath var21) {
- this.errorMsg("filedeath", var1);
- throw var21;
- } catch (Error var22) {
- this.errorMsg("fileerror", ((Throwable)var22).toString(), var1);
- }
-
- return var2;
- }
- }
- }
-