/[classpath]/classpath/java/security/SecureClassLoader.java
ViewVC logotype

Diff of /classpath/java/security/SecureClassLoader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by mkoch, Thu Jun 3 06:43:11 2004 UTC revision 1.12 by mark, Thu Feb 17 00:39:10 2005 UTC
# Line 48  package java.security; Line 48  package java.security;
48   */   */
49  public class SecureClassLoader extends ClassLoader  public class SecureClassLoader extends ClassLoader
50  {  {
51      java.util.WeakHashMap protectionDomainCache = new java.util.WeakHashMap();
52    
53    protected SecureClassLoader(ClassLoader parent)    protected SecureClassLoader(ClassLoader parent)
54    {    {
55      super(parent);      super(parent);
# Line 80  public class SecureClassLoader extends C Line 82  public class SecureClassLoader extends C
82    protected final Class defineClass(String name, byte[] b, int off, int len,    protected final Class defineClass(String name, byte[] b, int off, int len,
83                                      CodeSource cs)                                      CodeSource cs)
84    {    {
     // FIXME: Need to cache ProtectionDomains according to 1.3 docs.  
85      if (cs != null)      if (cs != null)
86        {        {
87          ProtectionDomain protectionDomain          ProtectionDomain protectionDomain;
88            = new ProtectionDomain(cs, getPermissions(cs), this, null);            
89            synchronized (protectionDomainCache)
90              {
91                protectionDomain = (ProtectionDomain)protectionDomainCache.get(cs);
92              }
93    
94            if (protectionDomain == null)
95              {
96                protectionDomain
97                  = new ProtectionDomain(cs, getPermissions(cs), this, null);
98                synchronized (protectionDomainCache)
99                  {
100                    ProtectionDomain domain
101                      = (ProtectionDomain)protectionDomainCache.get(cs);
102                    if (domain == null)
103                      protectionDomainCache.put(cs, protectionDomain);
104                    else
105                      protectionDomain = domain;
106                  }
107              }
108          return super.defineClass(name, b, off, len, protectionDomain);          return super.defineClass(name, b, off, len, protectionDomain);
109        }        }
110      else      else

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26