< prev index next >

src/java.base/share/classes/java/lang/System.java

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


2257 
2258             public String newStringNoRepl(byte[] bytes, Charset cs) throws CharacterCodingException  {
2259                 return StringCoding.newStringNoRepl(bytes, cs);
2260             }
2261 
2262             public byte[] getBytesNoRepl(String s, Charset cs) throws CharacterCodingException {
2263                 return StringCoding.getBytesNoRepl(s, cs);
2264             }
2265 
2266             public String newStringUTF8NoRepl(byte[] bytes, int off, int len) {
2267                 return StringCoding.newStringUTF8NoRepl(bytes, off, len);
2268             }
2269 
2270             public byte[] getBytesUTF8NoRepl(String s) {
2271                 return StringCoding.getBytesUTF8NoRepl(s);
2272             }
2273 
2274             public void setCause(Throwable t, Throwable cause) {
2275                 t.setCause(cause);
2276             }
























2277         });
2278     }
2279 }


2257 
2258             public String newStringNoRepl(byte[] bytes, Charset cs) throws CharacterCodingException  {
2259                 return StringCoding.newStringNoRepl(bytes, cs);
2260             }
2261 
2262             public byte[] getBytesNoRepl(String s, Charset cs) throws CharacterCodingException {
2263                 return StringCoding.getBytesNoRepl(s, cs);
2264             }
2265 
2266             public String newStringUTF8NoRepl(byte[] bytes, int off, int len) {
2267                 return StringCoding.newStringUTF8NoRepl(bytes, off, len);
2268             }
2269 
2270             public byte[] getBytesUTF8NoRepl(String s) {
2271                 return StringCoding.getBytesUTF8NoRepl(s);
2272             }
2273 
2274             public void setCause(Throwable t, Throwable cause) {
2275                 t.setCause(cause);
2276             }
2277 
2278             public void loadLibrary(Class<?> klass, String library) {
2279                 assert library.indexOf(java.io.File.separatorChar) < 0 && classStackWalker().getCallerClass() == klass;
2280                 if (System.getSecurityManager() == null) {
2281                     ClassLoader.loadLibrary(klass, library, false);
2282                 } else {
2283                     AccessController.doPrivileged(
2284                         new java.security.PrivilegedAction<>() {
2285                             public Void run() {
2286                                 ClassLoader.loadLibrary(klass, library, false);
2287                                 return null;
2288                             }
2289                         });
2290                 }
2291             }
2292 
2293             private StackWalker classStackWalker() {
2294                 return AccessController.doPrivileged(
2295                     new java.security.PrivilegedAction<StackWalker>() {
2296                         public StackWalker run() {
2297                             return StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
2298                         }
2299                     });
2300             }
2301         });
2302     }
2303 }
< prev index next >