src/java.base/share/classes/java/lang/Runtime.java
changeset 58574 dcc760954243
parent 55319 c6498066a0a5
child 58679 9c3209ff7550
child 58952 5cf915f418f2
equal deleted inserted replaced
58573:79da7db7e9b1 58574:dcc760954243
     1 /*
     1 /*
     2  * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
       
     3  * Copyright (c) 2019, Azul Systems, Inc. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * published by the Free Software Foundation.  Oracle designates this
   730     @CallerSensitive
   731     @CallerSensitive
   731     public void load(String filename) {
   732     public void load(String filename) {
   732         load0(Reflection.getCallerClass(), filename);
   733         load0(Reflection.getCallerClass(), filename);
   733     }
   734     }
   734 
   735 
   735     synchronized void load0(Class<?> fromClass, String filename) {
   736     void load0(Class<?> fromClass, String filename) {
   736         SecurityManager security = System.getSecurityManager();
   737         SecurityManager security = System.getSecurityManager();
   737         if (security != null) {
   738         if (security != null) {
   738             security.checkLink(filename);
   739             security.checkLink(filename);
   739         }
   740         }
   740         if (!(new File(filename).isAbsolute())) {
   741         if (!(new File(filename).isAbsolute())) {
   792     @CallerSensitive
   793     @CallerSensitive
   793     public void loadLibrary(String libname) {
   794     public void loadLibrary(String libname) {
   794         loadLibrary0(Reflection.getCallerClass(), libname);
   795         loadLibrary0(Reflection.getCallerClass(), libname);
   795     }
   796     }
   796 
   797 
   797     synchronized void loadLibrary0(Class<?> fromClass, String libname) {
   798     void loadLibrary0(Class<?> fromClass, String libname) {
   798         SecurityManager security = System.getSecurityManager();
   799         SecurityManager security = System.getSecurityManager();
   799         if (security != null) {
   800         if (security != null) {
   800             security.checkLink(libname);
   801             security.checkLink(libname);
   801         }
   802         }
   802         if (libname.indexOf((int)File.separatorChar) != -1) {
   803         if (libname.indexOf((int)File.separatorChar) != -1) {
   803             throw new UnsatisfiedLinkError(
   804             throw new UnsatisfiedLinkError(
   804     "Directory separator should not appear in library name: " + libname);
   805                 "Directory separator should not appear in library name: " + libname);
   805         }
   806         }
   806         ClassLoader.loadLibrary(fromClass, libname, false);
   807         ClassLoader.loadLibrary(fromClass, libname, false);
   807     }
   808     }
   808 
   809 
   809     /**
   810     /**