String k = null;
while((je = jis.getNextJarEntry()) != null) {
  String entryName = je.getName();
  ByteArrayOutputStream baos =
    new ByteArrayOutputStream();
  BufferedInputStream bis =
    new BufferedInputStream(jis);
  int i;
  while((i = bis.read()) != -1)
    baos.write(i);
  byte[] buf = baos.toByteArray();
  if (entryName.endsWith(".class")) {
    k = entryName.substring(0,
      entryName.lastIndexOf('.')).replace('/', '.');
    if (handler.allPermissionPolicy == null)
      jarCl = defineClass(k, buf, 0, buf.length);
    else {
      java.security.cert.Certificate[] c =
        je.getCertificates();
      if (c == null) {
        if (protectionDomain0 == null) {
          CodeSource cs = new CodeSource(baseURL,
            certificate0);
          protectionDomain0 =
            new ProtectionDomain(cs,
            policy.getPermissions(cs));
        }
        jarCl = defineClass(k, buf, 0, buf.length,
          protectionDomain0);
      } else {
        Iterator certIt =
          protectionDomains.keySet().iterator();
        while(certIt.hasNext()) {
          java.security.cert.Certificate[] cert =
            (java.security.cert.Certificate[])
            certIt.next();
          if (cert.length != c.length)
            break;
          int j = 0;
          for (; j < cert.length; ++j) {
            if (!c[j].equals(cert[j]))
              break;
          }
          if (j == c.length) {
            jarCl = defineClass(k, buf, 0,
              buf.length,(ProtectionDomain)
              protectionDomains.get(cert));
            break;
          }
        }
        if (jarCl == null) {
          CodeSource cs = new CodeSource(baseURL,
            c);
          ProtectionDomain protectionDomain =
            new ProtectionDomain(cs,
            policy.getPermissions(cs));
          jarCl = defineClass(k, buf, 0,
            buf.length, protectionDomain);
          protectionDomains.put(c,
            protectionDomain);
        }
      }
    }
    if (jarCl != null) {
      classes.put(k, jarCl);
      ++ size;
    }
  }
}
jis.close();