Exemple #1
0
 private static EquinoxSecurityManager getSupportedSystemSecurityManager() {
   try {
     EquinoxSecurityManager equinoxManager = (EquinoxSecurityManager) System.getSecurityManager();
     return equinoxManager != null && equinoxManager.inCheckPermission() ? equinoxManager : null;
   } catch (ClassCastException e) {
     return null;
   }
 }
Exemple #2
0
 /**
  * Returns the absolute path name of a native library.
  *
  * @param name the library name
  * @return the absolute path of the native library or null if not found
  */
 public String findLibrary(final String name) {
   if (System.getSecurityManager() == null) return findLocalLibrary(name);
   return (String)
       AccessController.doPrivileged(
           new PrivilegedAction() {
             public Object run() {
               return findLocalLibrary(name);
             }
           });
 }
Exemple #3
0
 private static ClassLoader getClassLoader(final Class clazz) {
   if (System.getSecurityManager() == null) return clazz.getClassLoader();
   return (ClassLoader)
       AccessController.doPrivileged(
           new PrivilegedAction() {
             public Object run() {
               return clazz.getClassLoader();
             }
           });
 }
Exemple #4
0
  private ClassLoader getParentPrivileged(final BundleClassLoader bcl) {
    if (System.getSecurityManager() == null) return bcl.getParent();

    return (ClassLoader)
        AccessController.doPrivileged(
            new PrivilegedAction() {
              public Object run() {
                return bcl.getParent();
              }
            });
  }
Exemple #5
0
  private BundleClassLoader createBCLPrevileged(
      final BundleProtectionDomain pd, final String[] cp) {
    // Create the classloader as previleged code if security manager is present.
    if (System.getSecurityManager() == null) return createBCL(pd, cp);

    return (BundleClassLoader)
        AccessController.doPrivileged(
            new PrivilegedAction() {
              public Object run() {
                return createBCL(pd, cp);
              }
            });
  }
Exemple #6
0
 private static void checkAllPermission() {
   SecurityManager sm = System.getSecurityManager();
   if (sm != null) sm.checkPermission(new AllPermission());
 }