< prev index next >

src/java.base/windows/classes/sun/nio/fs/RegistryFileTypeDetector.java

Print this page
rev 55657 : 8227587: Add internal privileged System.loadLibrary
Reviewed-by: rriggs

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -25,12 +25,10 @@
 
 package sun.nio.fs;
 
 import java.nio.file.*;
 import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 
 /**
  * File type detector that does lookup of file extension using Windows Registry.
  */
 

@@ -68,15 +66,11 @@
     }
 
     private static native String queryStringValue(long subKey, long name);
 
     static {
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-            @Override
-            public Void run() {
                 // nio.dll has dependency on net.dll
-                System.loadLibrary("net");
-                System.loadLibrary("nio");
-                return null;
-        }});
+        var jla = jdk.internal.access.SharedSecrets.getJavaLangAccess()
+        jla.loadLibrary(RegistryFileTypeDetector.class, "net");
+        jla.loadLibrary(RegistryFileTypeDetector.class, "nio");
     }
 }
< prev index next >