From: Fredrik Tolf Date: Thu, 15 Oct 2009 18:30:57 +0000 (+0200) Subject: Removed the pointless security check in Store. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=b1f70a1cd26e6ba6af9ae0bb067f60786ae2e550;p=jsvc.git Removed the pointless security check in Store. --- diff --git a/src/dolda/jsvc/store/Store.java b/src/dolda/jsvc/store/Store.java index 8e050a3..833c1da 100644 --- a/src/dolda/jsvc/store/Store.java +++ b/src/dolda/jsvc/store/Store.java @@ -12,31 +12,10 @@ public class Store { private final Package pkg; private final File base; - private Store(Package pkg, CodeSource src, File root) { + private Store(Package pkg, File root) { this.pkg = pkg; String nm = pkg.getName(); File base = root; - if(src != null) { - try { - MessageDigest fdig = MessageDigest.getInstance("MD5"); - for(Certificate cert : src.getCertificates()) { - MessageDigest cdig = MessageDigest.getInstance("MD5"); - cdig.update(cert.getEncoded()); - fdig.update(cdig.digest()); - } - byte[] fp = fdig.digest(); - StringBuilder buf = new StringBuilder(); - for(byte b : fp) { - buf.append(Misc.int2hex((b & 0xf0) >> 4, true)); - buf.append(Misc.int2hex(b & 0x0f, true)); - } - base = new File(base, buf.toString()); - } catch(NoSuchAlgorithmException e) { - throw(new Error(e)); - } catch(java.security.cert.CertificateEncodingException e) { - throw(new Error(e)); - } - } int p = 0; int p2; while((p2 = nm.indexOf('.', p)) >= 0) { @@ -63,20 +42,7 @@ public class Store { synchronized(interned) { s = interned.get(pkg); if(s == null) { - ProtectionDomain dom; - dom = AccessController.doPrivileged(new PrivilegedAction() { - public ProtectionDomain run() { - try { - return(cl.getProtectionDomain()); - } catch(SecurityException e) { - return(null); - } - } - }); - if(dom != null) - s = new Store(pkg, dom.getCodeSource(), root); - else - s = new Store(pkg, null, root); + s = new Store(pkg, root); interned.put(pkg, s); } }