home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 June / pcx11_9706.iso / shutils / internet / browser / p32e40b5.exe / nav40.z / java40.jar / netscape / applet / AppletClassLoader.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-23  |  12.5 KB  |  735 lines

  1. package netscape.applet;
  2.  
  3. import java.io.File;
  4. import java.io.FileNotFoundException;
  5. import java.io.FileOutputStream;
  6. import java.io.IOException;
  7. import java.io.InputStream;
  8. import java.net.MalformedURLException;
  9. import java.net.URL;
  10. import java.net.URLConnection;
  11. import java.util.Enumeration;
  12. import java.util.Hashtable;
  13. import java.util.Vector;
  14. import java.util.zip.ZipEntry;
  15. import java.util.zip.ZipFile;
  16. import netscape.security.AppletSecurity;
  17. import netscape.security.AppletSecurityException;
  18. import netscape.security.Principal;
  19. import netscape.security.PrivilegeManager;
  20. import netscape.security.Target;
  21.  
  22. public class AppletClassLoader extends ClassLoader {
  23.    URL codeBaseURL;
  24.    URL archiveURL;
  25.    MozillaAppletContext context;
  26.    static boolean wantTiming;
  27.    long loaderTime;
  28.    boolean _mayScript;
  29.    Principal codeBasePrincipal;
  30.    Principal[] matchPrincipalAry;
  31.    public static final String MANIFEST_FILENAME = "META-INF/manifest.mf";
  32.    private String archiveFile;
  33.    private boolean capturedArchive;
  34.    private int nativeArchive;
  35.    private int nativeZig;
  36.    byte[] inputBuf;
  37.    static Vector classloaders = new Vector(10);
  38.    int refCount;
  39.    private static boolean capturingClasses;
  40.    private static final boolean MARIMBA_ENABLED = true;
  41.    private CastanetChannelInfo channelInfo;
  42.    private Hashtable codebaseEnv;
  43.  
  44.    String grabArchiveFile() throws IOException {
  45.       String var1 = this.archiveURL.getFile();
  46.       if (!var1.endsWith(".jar") && !var1.endsWith(".zip")) {
  47.          return null;
  48.       } else {
  49.          String var2;
  50.          if (capturingClasses) {
  51.             int var3 = var1.lastIndexOf(47);
  52.             String var4 = var1.substring(var3 + 1);
  53.             var2 = this.getCaptureDir() + "/" + var4;
  54.          } else {
  55.             var2 = this.getTempName();
  56.          }
  57.  
  58.          SecurityManager.enablePrivilege("UniversalFileAccess");
  59.          SecurityManager.enablePrivilege("UniversalConnect");
  60.          FileOutputStream var14 = new FileOutputStream(var2);
  61.          long var15 = 0L;
  62.          if (wantTiming) {
  63.             var15 = System.currentTimeMillis();
  64.          }
  65.  
  66.          InputStream var6 = null;
  67.  
  68.          try {
  69.             URLConnection var9 = this.archiveURL.openConnection();
  70.             var9.setAllowUserInteraction(false);
  71.             var6 = var9.getInputStream();
  72.             if (this.inputBuf == null) {
  73.                this.inputBuf = new byte[4096];
  74.             }
  75.  
  76.             Thread var11 = Thread.currentThread();
  77.  
  78.             int var10;
  79.             while((var10 = var6.read(this.inputBuf)) >= 0 && !var11.isInterrupted()) {
  80.                var14.write(this.inputBuf, 0, var10);
  81.             }
  82.  
  83.             if (var11.isInterrupted()) {
  84.                throw new IOException("interrupted: " + this);
  85.             }
  86.          } finally {
  87.             if (var6 != null) {
  88.                var6.close();
  89.             }
  90.  
  91.             if (var14 != null) {
  92.                var14.close();
  93.             }
  94.  
  95.          }
  96.  
  97.          SecurityManager.revertPrivilege();
  98.          if (wantTiming) {
  99.             long var7 = System.currentTimeMillis();
  100.             long var16 = var7 - var15;
  101.             this.loaderTime += var16;
  102.             System.err.println("# Archive download time: " + this.archiveURL + ": " + var16 + " (total = " + this.loaderTime + ")");
  103.          }
  104.  
  105.          if (capturingClasses) {
  106.             System.err.println("#\tCaptured archive " + var2);
  107.             this.capturedArchive = true;
  108.          } else if (this.context != null && MozillaAppletContext.debug > 1) {
  109.             System.err.println("# Loading classes from downloaded archive file: " + this.archiveURL);
  110.          }
  111.  
  112.          return var2;
  113.       }
  114.    }
  115.  
  116.    native String getTempName();
  117.  
  118.    private native int openArchive0(String var1) throws IOException;
  119.  
  120.    private native byte[] loadFromArchive0(int var1, String var2) throws IOException;
  121.  
  122.    private native void closeArchive0(int var1) throws IOException;
  123.  
  124.    void openArchive() {
  125.       try {
  126.          this.archiveFile = this.grabArchiveFile();
  127.          if (this.archiveFile == null) {
  128.             return;
  129.          }
  130.  
  131.          this.nativeArchive = this.openArchive0(this.archiveFile);
  132.          if (this.nativeArchive != 0) {
  133.             this.nativeZig = this.setupZignature();
  134.             if (this.nativeZig != 0) {
  135.                if (!this.loadManifest(this.nativeArchive, this.nativeZig, this.codeBaseURL.getFile()) || this.loadSignatures(this.nativeArchive, this.nativeZig, this.codeBaseURL.getFile()) <= 0) {
  136.                   this.nativeZig = 0;
  137.                }
  138.  
  139.                return;
  140.             }
  141.          }
  142.       } catch (IOException var2) {
  143.          ((Throwable)var2).printStackTrace();
  144.          System.err.println("# Unable to load archive " + this.archiveURL + ": " + var2);
  145.          this.nativeZig = 0;
  146.       }
  147.  
  148.    }
  149.  
  150.    byte[] loadFromArchive(String var1) throws IOException {
  151.       return this.nativeArchive != 0 ? this.loadFromArchive0(this.nativeArchive, var1) : null;
  152.    }
  153.  
  154.    void closeArchive() {
  155.       if (this.nativeArchive != 0) {
  156.          try {
  157.             this.closeArchive0(this.nativeArchive);
  158.             if (this.context != null && MozillaAppletContext.debug > 1) {
  159.                System.err.println("# Closed downloaded archive: " + this.archiveURL);
  160.             }
  161.          } catch (IOException var3) {
  162.             if (this.context != null && MozillaAppletContext.debug > 1) {
  163.                System.err.println("# Failed to close downloaded archive: " + this.archiveURL);
  164.             }
  165.          }
  166.  
  167.          this.nativeArchive = 0;
  168.          if (!this.capturedArchive) {
  169.             File var1 = new File(this.archiveFile);
  170.             SecurityManager.enablePrivilege("UniversalFileRead");
  171.             SecurityManager.enablePrivilege("UniversalFileDelete");
  172.             boolean var2 = var1.delete();
  173.             SecurityManager.revertPrivilege();
  174.             if (this.context != null && MozillaAppletContext.debug > 1) {
  175.                if (var2) {
  176.                   System.err.println("# Deleted downloaded archive: " + this.archiveFile);
  177.                   return;
  178.                }
  179.  
  180.                System.err.println("# Failed to delete downloaded archive: " + this.archiveFile);
  181.             }
  182.          }
  183.       }
  184.  
  185.    }
  186.  
  187.    static synchronized AppletClassLoader getClassLoader(MozillaAppletContext var0, URL var1, URL var2, boolean var3, boolean var4) {
  188.       AppletClassLoader var5 = null;
  189.       SecurityManager.enablePrivilege("UniversalConnect");
  190.  
  191.       for(int var6 = 0; var6 < classloaders.size(); ++var6) {
  192.          AppletClassLoader var7 = (AppletClassLoader)classloaders.elementAt(var6);
  193.          if (var1.equals(var7.codeBaseURL) && var2.equals(var7.archiveURL) && var3 == var7._mayScript && (!var3 || var0 == var7.context)) {
  194.             if (!var4) {
  195.                var5 = var7;
  196.                if (MozillaAppletContext.debug > 1) {
  197.                   System.err.println("#   reusing class loader " + var7 + "\n" + "#\tcodebase = " + var1 + "\n" + "#\tarchive = " + var2);
  198.                }
  199.             } else {
  200.                if (MozillaAppletContext.debug > 1) {
  201.                   System.err.println("#   flushing classes associated with " + var7);
  202.                }
  203.  
  204.                if (MozillaAppletContext.debug > 2 && var7.refCount > 0) {
  205.                   System.err.println("#\trefcount is still " + var7.refCount);
  206.                }
  207.             }
  208.             break;
  209.          }
  210.       }
  211.  
  212.       SecurityManager.revertPrivilege();
  213.       if (var5 == null) {
  214.          var5 = new AppletClassLoader(var0, var1, var2);
  215.          var5._mayScript = var3;
  216.          classloaders.addElement(var5);
  217.       }
  218.  
  219.       ++var5.refCount;
  220.       return var5;
  221.    }
  222.  
  223.    synchronized void releaseClassLoader() {
  224.       if (MozillaAppletContext.debug > 1) {
  225.          System.err.println("# released reference to: " + this);
  226.       }
  227.  
  228.       if (--this.refCount == 0) {
  229.          classloaders.removeElement(this);
  230.          if (MozillaAppletContext.debug > 1) {
  231.             System.err.println("# removed: " + this);
  232.          }
  233.       }
  234.  
  235.    }
  236.  
  237.    AppletClassLoader(MozillaAppletContext var1, URL var2, URL var3) {
  238.       this.capturedArchive = false;
  239.       this.refCount = 0;
  240.       this._mayScript = false;
  241.       this.codeBasePrincipal = new Principal(var2);
  242.       String var4 = var2.getFile();
  243.       int var5 = var4.lastIndexOf(47);
  244.       if (var5 > 0 && var5 < var4.length() - 1) {
  245.          try {
  246.             var2 = new URL(var2, var4.substring(0, var5 + 1));
  247.          } catch (MalformedURLException var6) {
  248.          }
  249.       }
  250.  
  251.       this.codeBaseURL = var2;
  252.       this.archiveURL = var3;
  253.       this.context = var1;
  254.       if (this.archiveURL != null) {
  255.          this.openArchive();
  256.       }
  257.  
  258.    }
  259.  
  260.    void close() {
  261.       if (this.archiveURL != null) {
  262.          this.closeArchive();
  263.       }
  264.  
  265.       if (this.channelInfo != null) {
  266.          this.channelInfo.closeZips();
  267.       }
  268.  
  269.    }
  270.  
  271.    protected void finalize() {
  272.       this.close();
  273.       if (MozillaAppletContext.debug > 1) {
  274.          System.err.println("# finalized: " + this);
  275.       }
  276.  
  277.    }
  278.  
  279.    protected AppletClassLoader(URL var1) {
  280.       this((MozillaAppletContext)null, var1, (URL)null);
  281.    }
  282.  
  283.    boolean mayScript() {
  284.       return this._mayScript;
  285.    }
  286.  
  287.    public URL getCodeBase() {
  288.       return this.codeBaseURL;
  289.    }
  290.  
  291.    private Class loadClass(String var1, URL var2, String var3) throws IOException {
  292.       SecurityManager.enablePrivilege("UniversalConnect");
  293.       byte[] var4 = var2.getData();
  294.       SecurityManager.revertPrivilege();
  295.       if (capturingClasses) {
  296.          this.captureClassFile(var1, var4);
  297.       }
  298.  
  299.       return ((ClassLoader)this).defineClass(var1, var4, 0, var4.length, this.nativeZig, var3);
  300.    }
  301.  
  302.    public Class loadClass(String var1) throws ClassNotFoundException {
  303.       return this.loadClass(var1, true);
  304.    }
  305.  
  306.    protected final Class loadClass(String var1, boolean var2) throws ClassNotFoundException {
  307.       Class var3;
  308.       if (wantTiming) {
  309.          long var4 = System.currentTimeMillis();
  310.          var3 = this.loadClass1(var1, var2);
  311.          long var6 = System.currentTimeMillis();
  312.          long var8 = var6 - var4;
  313.          this.loaderTime += var8;
  314.          System.err.println("# Class load time: " + var1 + ": " + var8 + " (total = " + this.loaderTime + ")");
  315.       } else {
  316.          var3 = this.loadClass1(var1, var2);
  317.       }
  318.  
  319.       return var3;
  320.    }
  321.  
  322.    private Class loadClass1(String var1, boolean var2) throws ClassNotFoundException {
  323.       Class var3 = ((ClassLoader)this).findLoadedClass(var1);
  324.       if (var3 == null) {
  325.          SecurityManager var4 = System.getSecurityManager();
  326.          if (var4 != null) {
  327.             int var5 = var1.lastIndexOf(46);
  328.             if (var5 >= 0) {
  329.                var4.checkPackageAccess(var1.substring(0, var5));
  330.             }
  331.          }
  332.  
  333.          try {
  334.             return ((ClassLoader)this).findSystemClass(var1);
  335.          } catch (NoClassDefFoundError var8) {
  336.             if (this.channelInfo == null) {
  337.                throw var8;
  338.             }
  339.          } catch (ClassNotFoundException var9) {
  340.          }
  341.  
  342.          var3 = this.findClass(var1);
  343.       }
  344.  
  345.       if (var3 == null) {
  346.          throw new ClassNotFoundException(var1);
  347.       } else {
  348.          if (this.nativeArchive != 0) {
  349.             System.getSecurityManager().checkURLConnect(this.codeBaseURL, this.archiveURL);
  350.          }
  351.  
  352.          if (var2) {
  353.             try {
  354.                ((ClassLoader)this).resolveClass(var3);
  355.             } catch (NoClassDefFoundError var6) {
  356.                if (this.channelInfo == null) {
  357.                   throw var6;
  358.                }
  359.  
  360.                throw new ClassNotFoundException(var1);
  361.             } catch (UnknownError var7) {
  362.                if (this.channelInfo == null) {
  363.                   throw var7;
  364.                }
  365.  
  366.                throw new ClassNotFoundException(var1);
  367.             }
  368.          }
  369.  
  370.          return var3;
  371.       }
  372.    }
  373.  
  374.    private synchronized Class findClass(String var1) throws ClassNotFoundException {
  375.       boolean var2 = true;
  376.       Class var3 = ((ClassLoader)this).findLoadedClass(var1);
  377.       if (var3 != null) {
  378.          return var3;
  379.       } else {
  380.          if (this.context != null && MozillaAppletContext.debug > 1) {
  381.             System.err.println("# Loading class " + var1);
  382.          }
  383.  
  384.          SecurityManager var4 = System.getSecurityManager();
  385.          if (var4 != null) {
  386.             int var5 = var1.lastIndexOf(46);
  387.             if (var5 >= 0) {
  388.                var4.checkPackageDefinition(var1.substring(0, var5));
  389.             }
  390.          }
  391.  
  392.          String var14 = var1.replace('.', '/') + ".class";
  393.          if (this.nativeArchive != 0) {
  394.             try {
  395.                byte[] var6 = this.loadFromArchive(var14);
  396.                if (var6 != null) {
  397.                   var3 = ((ClassLoader)this).defineClass(var1, var6, 0, var6.length, this.nativeZig, var14);
  398.                   if (var3 != null && this.context != null && MozillaAppletContext.debug > 1) {
  399.                      System.err.println("# Loaded " + var14 + " from downloaded archive.");
  400.                   }
  401.  
  402.                   var2 = false;
  403.                }
  404.             } catch (IOException var12) {
  405.                if (MozillaAppletContext.debug > 1) {
  406.                   System.err.println("# Failed to load " + var14 + " from downloaded archive.");
  407.                }
  408.             }
  409.          }
  410.  
  411.          if (var3 == null) {
  412.             URL var15;
  413.             try {
  414.                var15 = new URL(this.codeBaseURL, var14);
  415.             } catch (MalformedURLException var9) {
  416.                throw new ClassNotFoundException(var1);
  417.             }
  418.  
  419.             if (this.context != null && MozillaAppletContext.debug > 1) {
  420.                System.err.println("# Fetching " + var15);
  421.             }
  422.  
  423.             try {
  424.                var3 = this.loadClass(var1, var15, var14);
  425.                var2 = false;
  426.             } catch (IOException var10) {
  427.                if (this.channelInfo != null) {
  428.                   try {
  429.                      var3 = this.marimbaLoad(var1);
  430.                      var2 = false;
  431.                   } catch (IOException var8) {
  432.                   }
  433.                }
  434.  
  435.                if (var3 == null) {
  436.                   throw new ClassNotFoundException(var1);
  437.                }
  438.             } catch (SecurityException var11) {
  439.                if (this.context != null && MozillaAppletContext.debug > 1) {
  440.                   System.err.println("# Exception while loading " + var14 + " from downloaded archive " + var15.toString() + " exception " + ((Throwable)var11).toString());
  441.                }
  442.  
  443.                throw var11;
  444.             }
  445.          }
  446.  
  447.          if (!var1.equals(var3.getName())) {
  448.             Class var16 = var3;
  449.             Object var13 = null;
  450.             throw new ClassFormatError(var1 + " != " + var16.getName());
  451.          } else {
  452.             if (!var2) {
  453.                this.setPrincipalAry(var3, var14);
  454.             }
  455.  
  456.             return var3;
  457.          }
  458.       }
  459.    }
  460.  
  461.    static boolean getCaptureClassFiles() {
  462.       return capturingClasses;
  463.    }
  464.  
  465.    static void setCaptureClassFiles(boolean var0) {
  466.       capturingClasses = var0;
  467.    }
  468.  
  469.    String getCaptureDir() throws IOException {
  470.       String var1 = this.codeBaseURL.toString();
  471.       if (var1.startsWith("http://")) {
  472.          var1 = var1.substring(7);
  473.       }
  474.  
  475.       if (var1.endsWith("/")) {
  476.          var1 = var1.substring(0, var1.length() - 1);
  477.       }
  478.  
  479.       var1 = var1.replace('/', '_').replace(':', '_');
  480.       SecurityManager.enablePrivilege("UniversalFileRead");
  481.       SecurityManager.enablePrivilege("UniversalFileWrite");
  482.       File var2 = new File(var1);
  483.       if ((!var2.exists() || !var2.isDirectory()) && !var2.mkdir()) {
  484.          throw new IOException(var2 + " is not a directory");
  485.       } else {
  486.          return var1;
  487.       }
  488.    }
  489.  
  490.    void captureClassFile(String var1, byte[] var2) {
  491.       try {
  492.          String var3 = this.getCaptureDir();
  493.          SecurityManager.enablePrivilege("UniversalFileWrite");
  494.          File var4 = new File(var3 + "/" + var1 + ".class");
  495.          FileOutputStream var5 = new FileOutputStream(var4);
  496.          var5.write(var2, 0, var2.length);
  497.          System.err.println("#\tCaptured class " + var4);
  498.          var5.close();
  499.       } catch (SecurityException var6) {
  500.          System.err.println("#\tCan't capture class: " + var6);
  501.       } catch (IOException var7) {
  502.          System.err.println("#\tCan't capture class: " + var7);
  503.       }
  504.    }
  505.  
  506.    byte[] getResource(URL var1) {
  507.       byte[] var2 = null;
  508.       String var3 = var1.getFile();
  509.       String var4 = this.codeBaseURL.getFile();
  510.       if (!var3.startsWith(var4)) {
  511.          return null;
  512.       } else {
  513.          String var5 = var3.substring(var4.length());
  514.  
  515.          try {
  516.             var2 = this.loadFromArchive(var5);
  517.             if (var2 != null && this.context != null && MozillaAppletContext.debug > 1) {
  518.                System.err.println("# Loaded " + var5 + " from downloaded archive.");
  519.             }
  520.          } catch (IOException var6) {
  521.             if (MozillaAppletContext.debug > 1) {
  522.                System.err.println("# Failed to load " + var5 + " from downloaded archive.");
  523.             }
  524.          }
  525.  
  526.          return var2;
  527.       }
  528.    }
  529.  
  530.    private boolean setPrincipalAry(Class var1, String var2) {
  531.       Object var3 = null;
  532.       int var4 = 1;
  533.       Object[] var5 = getCertificates(this.nativeZig, var2);
  534.       if (var5 != null) {
  535.          var4 += var5.length;
  536.       }
  537.  
  538.       Principal[] var12 = new Principal[var4];
  539.  
  540.       for(int var6 = var4 - 1; var6-- > 0; var12[var6] = new Principal(14, (byte[])var5[var6], var1)) {
  541.       }
  542.  
  543.       var12[var4 - 1] = this.codeBasePrincipal;
  544.  
  545.       try {
  546.          if (this.matchPrincipalAry != null) {
  547.             PrivilegeManager var9 = AppletSecurity.getPrivilegeManager();
  548.             if (var9 != null && var9.comparePrincipalArray(var12, this.matchPrincipalAry) == 1) {
  549.                var12 = new Principal[]{this.codeBasePrincipal};
  550.                throw new AppletSecurityException("mismatch of principals");
  551.             }
  552.          }
  553.       } finally {
  554.          this.setPrincipals(var1, var12);
  555.       }
  556.  
  557.       return true;
  558.    }
  559.  
  560.    public boolean checkMatchPrincipalAlways(int var1) {
  561.       PrivilegeManager var5 = AppletSecurity.getPrivilegeManager();
  562.       if (var5 == null) {
  563.          return true;
  564.       } else {
  565.          this.matchPrincipalAry = var5.getClassPrincipalsFromStack(var1 + 1);
  566.          Enumeration var2 = ((ClassLoader)this).getClassNames();
  567.  
  568.          while(var2.hasMoreElements()) {
  569.             String var4 = (String)var2.nextElement();
  570.             Class var3 = ((ClassLoader)this).findLoadedClass(var4);
  571.             if (var3 != null && !var5.checkMatchPrincipal(var3, var1 + 1)) {
  572.                return false;
  573.             }
  574.          }
  575.  
  576.          return true;
  577.       }
  578.    }
  579.  
  580.    private native int setupZignature();
  581.  
  582.    private native int destroyZignature(int var1);
  583.  
  584.    private native boolean loadManifest(int var1, int var2, String var3);
  585.  
  586.    private native int loadSignatures(int var1, int var2, String var3);
  587.  
  588.    private native boolean verifySignature(int var1, Class var2, String var3);
  589.  
  590.    private static native Object[] getCertificates(int var0, String var1);
  591.  
  592.    private native void setPrincipals(Class var1, Principal[] var2);
  593.  
  594.    public AppletClassLoader(URL var1, CastanetChannelInfo var2) {
  595.       this((MozillaAppletContext)null, var1, var1);
  596.       this.channelInfo = var2;
  597.    }
  598.  
  599.    public Class classFromBytes(byte[] var1, String var2) {
  600.       if (this.channelInfo == null) {
  601.          return null;
  602.       } else {
  603.          Class var3 = ((ClassLoader)this).findLoadedClass(var2);
  604.          if (var3 != null) {
  605.             return var3;
  606.          } else {
  607.             try {
  608.                var3 = ((ClassLoader)this).findSystemClass(var2);
  609.                if (var3 != null) {
  610.                   return var3;
  611.                }
  612.             } catch (NoClassDefFoundError var8) {
  613.             } catch (ClassNotFoundException var9) {
  614.             }
  615.  
  616.             SecurityManager var4 = System.getSecurityManager();
  617.             if (var4 != null) {
  618.                int var5 = var2.lastIndexOf(46);
  619.                if (var5 >= 0) {
  620.                   var4.checkPackageDefinition(var2.substring(0, var5));
  621.                }
  622.             }
  623.  
  624.             PrivilegeManager var12 = PrivilegeManager.getPrivilegeManager();
  625.             if (var12 != null) {
  626.                Target var6 = Target.findTarget("MarimbaInternalTarget");
  627.                if (var6 == null) {
  628.                   throw new AppletSecurityException("classFromBytes call denied");
  629.                }
  630.  
  631.                var12.checkPrivilegeEnabled(var6);
  632.             }
  633.  
  634.             try {
  635.                var3 = ((ClassLoader)this).defineClass(var2, var1, 0, var1.length);
  636.                return var3;
  637.             } catch (NoClassDefFoundError var7) {
  638.                return null;
  639.             }
  640.          }
  641.       }
  642.    }
  643.  
  644.    private Class marimbaLoad(String var1) throws IOException, ClassNotFoundException {
  645.       if (this.channelInfo == null) {
  646.          return null;
  647.       } else {
  648.          Class var2 = null;
  649.          int var3 = this.channelInfo.getPathlen();
  650.          if (var3 != 0) {
  651.             String var4 = var1.replace('.', '/') + ".class";
  652.  
  653.             for(int var5 = 0; var5 < var3; ++var5) {
  654.                URL var6 = this.channelInfo.getURL(var5);
  655.                if (var6 != null) {
  656.                   try {
  657.                      var2 = this.loadClass(var1, new URL(var6, var4), var4);
  658.                      if (var2 != null) {
  659.                         return var2;
  660.                      }
  661.                   } catch (NoClassDefFoundError var14) {
  662.                   } catch (MalformedURLException var15) {
  663.                   } catch (FileNotFoundException var16) {
  664.                   }
  665.                }
  666.  
  667.                ZipFile var7 = this.channelInfo.getZip(var5);
  668.                if (var7 != null) {
  669.                   ZipEntry var8 = var7.getEntry(var4);
  670.                   if (var8 != null) {
  671.                      int var9 = (int)var8.getSize();
  672.                      byte[] var10 = new byte[var9];
  673.                      InputStream var11 = var7.getInputStream(var8);
  674.  
  675.                      for(int var12 = 0; var12 < var9; var12 += var11.read(var10, var12, var9 - var12)) {
  676.                      }
  677.  
  678.                      var11.close();
  679.  
  680.                      try {
  681.                         var2 = ((ClassLoader)this).defineClass(var1, var10, 0, var10.length);
  682.                      } catch (NoClassDefFoundError var13) {
  683.                      }
  684.  
  685.                      if (var2 != null) {
  686.                         return var2;
  687.                      }
  688.                   }
  689.                }
  690.             }
  691.          }
  692.  
  693.          return null;
  694.       }
  695.    }
  696.  
  697.    public boolean marimbaCheckRead(String var1, boolean var2) {
  698.       return this.channelInfo != null ? this.channelInfo.checkRead(var1, var2) : false;
  699.    }
  700.  
  701.    public boolean marimbaCheckWrite(String var1, boolean var2) {
  702.       return this.channelInfo != null ? this.channelInfo.checkWrite(var1, var2) : false;
  703.    }
  704.  
  705.    public String marimbaGetHost() {
  706.       return this.channelInfo != null ? this.channelInfo.getHost() : null;
  707.    }
  708.  
  709.    boolean marimbaCheckThreadGroup(ThreadGroup var1) {
  710.       return this.channelInfo == null ? false : this.channelInfo.checkThreadGroup(var1);
  711.    }
  712.  
  713.    void marimbaCheckTopLevelWindow(Object var1) {
  714.       if (this.channelInfo != null) {
  715.          this.channelInfo.checkTopLevelWindow(var1);
  716.       }
  717.    }
  718.  
  719.    Hashtable getCodebaseEnv() {
  720.       if (this.codebaseEnv == null) {
  721.          this.initCodebaseEnv();
  722.       }
  723.  
  724.       return this.codebaseEnv;
  725.    }
  726.  
  727.    synchronized void initCodebaseEnv() {
  728.       System.out.print("intializing codebaseEnv...");
  729.       if (this.codebaseEnv == null) {
  730.          this.codebaseEnv = new Hashtable();
  731.       }
  732.  
  733.    }
  734. }
  735.