private synchronized void checkCerts(String name, CodeSource cs) {
        int i = name.lastIndexOf('.');
        String pname = (i == -1) ? "" : name.substring(0, i);
        java.security.cert.Certificate[] pcerts =
            (java.security.cert.Certificate[]) package2certs.get(pname);
        if (pcerts == null) {
            // first class in this package gets to define which
            // certificates must be the same for all other classes
            // in this package
            if (cs != null) {
                pcerts = cs.getCertificates();
            }
            if (pcerts == null) {
                if (nocerts == null)
                    nocerts = new java.security.cert.Certificate[0];
                pcerts = nocerts;
            }
            package2certs.put(pname, pcerts);
        } else {
            java.security.cert.Certificate[] certs = null;
            if (cs != null) {
                certs = cs.getCertificates();
            }

            if (!compareCerts(pcerts, certs)) {
                throw new SecurityException("class \""+ name +
                                            "\"'s signer information does not match signer information of other classes in the same package");
            }
        }
    }