예제 #1
0
 static Class loadAdapterClass(String className, byte[] classBytes) {
   Object staticDomain;
   Class domainClass = SecurityController.getStaticSecurityDomainClass();
   if (domainClass == CodeSource.class || domainClass == ProtectionDomain.class) {
     ProtectionDomain protectionDomain = JavaAdapter.class.getProtectionDomain();
     if (domainClass == CodeSource.class) {
       staticDomain = protectionDomain == null ? null : protectionDomain.getCodeSource();
     } else {
       staticDomain = protectionDomain;
     }
   } else {
     staticDomain = null;
   }
   GeneratedClassLoader loader = SecurityController.createLoader(null, staticDomain);
   Class result = loader.defineClass(className, classBytes);
   loader.linkClass(result);
   return result;
 }
예제 #2
0
 static Class<?> loadAdapterClass(String className, byte[] classBytes) {
   Object staticDomain;
   Class<?> domainClass = SecurityController.getStaticSecurityDomainClass();
   if (domainClass == CodeSource.class || domainClass == ProtectionDomain.class) {
     // use the calling script's security domain if available
     ProtectionDomain protectionDomain = SecurityUtilities.getScriptProtectionDomain();
     if (protectionDomain == null) {
       protectionDomain = JavaAdapter.class.getProtectionDomain();
     }
     if (domainClass == CodeSource.class) {
       staticDomain = protectionDomain == null ? null : protectionDomain.getCodeSource();
     } else {
       staticDomain = protectionDomain;
     }
   } else {
     staticDomain = null;
   }
   GeneratedClassLoader loader = SecurityController.createLoader(null, staticDomain);
   Class<?> result = loader.defineClass(className, classBytes);
   loader.linkClass(result);
   return result;
 }