7164376: Replace use of sun.security.action.LoadLibraryAction with System.loadLibrary
Reviewed-by: alanb, mullan, prr
This commit is contained in:
parent
521fd9e111
commit
728600d4e3
jdk/src
macosx/classes
apple
com/apple
concurrent
eawt
eio
laf
java/util/prefs
sun
share/classes
com/sun
java
awt
net
sun
awt
java2d
management
net
nio/ch
security
tracing/dtrace
solaris/classes/sun
management
net/dns
nio/ch/sctp
print
windows/classes/sun
awt
management
net/dns
print
security/smartcardio
@ -27,7 +27,6 @@ package apple.launcher;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.jar.*;
|
||||
@ -36,7 +35,13 @@ import javax.swing.*;
|
||||
|
||||
class JavaAppLauncher implements Runnable {
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osx");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static native <T> T nativeConvertAndRelease(final long ptr);
|
||||
|
@ -103,7 +103,13 @@ public final class KeychainStore extends KeyStoreSpi {
|
||||
private static final int SALT_LEN = 20;
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));
|
||||
AccessController.doPrivileged(
|
||||
new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osx");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
try {
|
||||
PKCS8ShroudedKeyBag_OID = new ObjectIdentifier(keyBag);
|
||||
pbeWithSHAAnd3KeyTripleDESCBC_OID = new ObjectIdentifier(pbeWithSHAAnd3KeyTripleDESCBC);
|
||||
|
@ -26,17 +26,23 @@
|
||||
package com.apple.concurrent;
|
||||
|
||||
final class LibDispatchNative {
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((java.security.PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));
|
||||
}
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osx");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static native boolean nativeIsDispatchSupported();
|
||||
static native long nativeGetMainQueue();
|
||||
static native long nativeCreateConcurrentQueue(int priority);
|
||||
static native long nativeCreateSerialQueue(String name);
|
||||
static native void nativeReleaseQueue(long nativeQueue);
|
||||
static native void nativeExecuteAsync(long nativeQueue, Runnable task);
|
||||
static native void nativeExecuteSync(long nativeQueue, Runnable task);
|
||||
static native boolean nativeIsDispatchSupported();
|
||||
static native long nativeGetMainQueue();
|
||||
static native long nativeCreateConcurrentQueue(int priority);
|
||||
static native long nativeCreateSerialQueue(String name);
|
||||
static native void nativeReleaseQueue(long nativeQueue);
|
||||
static native void nativeExecuteAsync(long nativeQueue, Runnable task);
|
||||
static native void nativeExecuteSync(long nativeQueue, Runnable task);
|
||||
|
||||
private LibDispatchNative() { }
|
||||
private LibDispatchNative() { }
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ package com.apple.eawt;
|
||||
import java.awt.*;
|
||||
import java.awt.peer.*;
|
||||
import java.beans.Beans;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.swing.JMenuBar;
|
||||
|
||||
@ -59,7 +58,13 @@ public class Application {
|
||||
static Application sApplication = null;
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("awt"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
checkSecurity();
|
||||
if (!Beans.isDesignTime()) {
|
||||
|
@ -55,7 +55,13 @@ import java.io.*;
|
||||
*/
|
||||
public class FileManager {
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((java.security.PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osx");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,6 @@
|
||||
package com.apple.laf;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@ -57,7 +56,13 @@ class AquaFileView extends FileView {
|
||||
static final int kLSItemInfoExtensionIsHidden = 0x00100000; /* Item has a hidden extension*/
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osxui");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Un-comment this out when the native version exists
|
||||
|
@ -134,10 +134,16 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
* @see UIManager#setLookAndFeel
|
||||
*/
|
||||
public void initialize() {
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
|
||||
java.security.AccessController.doPrivileged(new PrivilegedAction<Object>(){
|
||||
java.security.AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osxui");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
java.security.AccessController.doPrivileged(new PrivilegedAction<Void>(){
|
||||
@Override
|
||||
public Object run() {
|
||||
public Void run() {
|
||||
JRSUIControl.initJRSUI();
|
||||
return null;
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package com.apple.laf;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.swing.plaf.UIResource;
|
||||
|
||||
@ -35,7 +34,13 @@ import com.apple.laf.AquaUtils.RecyclableSingleton;
|
||||
|
||||
public class AquaNativeResources {
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osxui");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: removing CColorPaint for now
|
||||
|
@ -28,7 +28,6 @@ package com.apple.laf;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.peer.MenuComponentPeer;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.swing.*;
|
||||
@ -38,7 +37,13 @@ import sun.lwawt.macosx.*;
|
||||
|
||||
class ScreenMenu extends Menu implements ContainerListener, ComponentListener, ScreenMenuPropertyHandler {
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("awt"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// screen menu stuff
|
||||
|
@ -26,15 +26,19 @@
|
||||
package com.apple.laf;
|
||||
|
||||
import java.awt.*;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import sun.lwawt.macosx.CPlatformWindow;
|
||||
|
||||
class ScreenPopupFactory extends PopupFactory {
|
||||
static {
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osxui"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osxui");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static final Float TRANSLUCENT = new Float(248f/255f);
|
||||
|
@ -79,7 +79,13 @@ import java.lang.ref.WeakReference;
|
||||
class MacOSXPreferencesFile {
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(new sun.security.action.LoadLibraryAction("osx"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osx");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class FlushTask extends TimerTask {
|
||||
|
@ -58,9 +58,15 @@ public class CGraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
public static void init() { }
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(new sun.security.action.LoadLibraryAction("awt"));
|
||||
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
if (isHeadless()) return null;
|
||||
initCocoa();
|
||||
return null;
|
||||
|
@ -29,7 +29,6 @@ import java.awt.*;
|
||||
import java.beans.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@ -41,7 +40,13 @@ class CAccessibility implements PropertyChangeListener {
|
||||
|
||||
static {
|
||||
// Need to load the native library for this code.
|
||||
java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("awt"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static CAccessibility sAccessibility;
|
||||
|
@ -87,7 +87,12 @@ public class JPEGImageReader extends ImageReader {
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("jpeg"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("jpeg");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
initReaderIDs(ImageInputStream.class,
|
||||
JPEGQTable.class,
|
||||
JPEGHuffmanTable.class);
|
||||
|
@ -177,7 +177,12 @@ public class JPEGImageWriter extends ImageWriter {
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("jpeg"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("jpeg");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
initWriterIDs(ImageOutputStream.class,
|
||||
JPEGQTable.class,
|
||||
JPEGHuffmanTable.class);
|
||||
|
@ -87,7 +87,12 @@ class NativeUnpack {
|
||||
// If loading from stand alone build uncomment this.
|
||||
// System.loadLibrary("unpack");
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("unpack"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("unpack");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
initIDs();
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,12 @@ public final class SplashScreen {
|
||||
// SplashScreen class is now a singleton
|
||||
if (!wasClosed && theInstance == null) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("splashscreen"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("splashscreen");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
long ptr = _getInstance();
|
||||
if (ptr != 0 && _isVisible(ptr)) {
|
||||
theInstance = new SplashScreen(ptr);
|
||||
|
@ -1646,7 +1646,12 @@ public abstract class Toolkit {
|
||||
static void loadLibraries() {
|
||||
if (!loaded) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("awt"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,11 @@ class NativeLibLoader {
|
||||
*/
|
||||
static void loadLibraries() {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("awt"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,12 @@ public abstract class ColorModel implements Transparency{
|
||||
static void loadLibraries() {
|
||||
if (!loaded) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("awt"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -67,7 +67,12 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
||||
*/
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("net"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +78,12 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
|
||||
*/
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("net"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,7 +47,12 @@ class DatagramPacket {
|
||||
*/
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("net"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,13 @@ class InetAddress implements java.io.Serializable {
|
||||
static {
|
||||
preferIPv6Address = java.security.AccessController.doPrivileged(
|
||||
new GetBooleanAction("java.net.preferIPv6Addresses")).booleanValue();
|
||||
AccessController.doPrivileged(new LoadLibraryAction("net"));
|
||||
AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,14 @@ public final class NetworkInterface {
|
||||
private static final int defaultIndex; /* index of defaultInterface */
|
||||
|
||||
static {
|
||||
AccessController.doPrivileged(new LoadLibraryAction("net"));
|
||||
AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
init();
|
||||
defaultInterface = DefaultInterface.getDefault();
|
||||
if (defaultInterface != null) {
|
||||
|
@ -54,6 +54,11 @@ class NativeLibLoader {
|
||||
*/
|
||||
static void loadLibraries() {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("awt"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,12 @@ public class JPEGImageDecoder extends ImageDecoder {
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("jpeg"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("jpeg");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
initIDs(InputStreamClass);
|
||||
RGBcolormodel = new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
|
||||
ARGBcolormodel = ColorModel.getRGBdefault();
|
||||
|
@ -53,7 +53,12 @@ class NativeLibLoader {
|
||||
* that the name of the library is "awt". -br.
|
||||
*/
|
||||
static void loadLibraries() {
|
||||
java.security.AccessController.doPrivileged
|
||||
(new sun.security.action.LoadLibraryAction("awt"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,12 @@ public class Disposer implements Runnable {
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("awt"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
initIDs();
|
||||
String type = (String) java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("sun.java2d.reftype"));
|
||||
|
@ -37,7 +37,6 @@ import javax.management.RuntimeOperationsException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import sun.security.action.LoadLibraryAction;
|
||||
|
||||
import sun.util.logging.LoggingSupport;
|
||||
|
||||
@ -422,7 +421,13 @@ public class ManagementFactoryHelper {
|
||||
}
|
||||
|
||||
static {
|
||||
AccessController.doPrivileged(new LoadLibraryAction("management"));
|
||||
AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("management");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
jvm = new VMManagementImpl();
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,11 @@ public final class SdpSupport {
|
||||
|
||||
static {
|
||||
AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("net"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,12 @@ public class DefaultProxySelector extends ProxySelector {
|
||||
}});
|
||||
if (b != null && b.booleanValue()) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("net"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
hasSystemProxies = init();
|
||||
}
|
||||
}
|
||||
|
@ -472,10 +472,15 @@ public class Util {
|
||||
if (loaded)
|
||||
return;
|
||||
loaded = true;
|
||||
java.security.AccessController
|
||||
.doPrivileged(new sun.security.action.LoadLibraryAction("net"));
|
||||
java.security.AccessController
|
||||
.doPrivileged(new sun.security.action.LoadLibraryAction("nio"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
System.loadLibrary("nio");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
// IOUtil must be initialized; Its native methods are called from
|
||||
// other places in native nio code so they must be set up.
|
||||
IOUtil.initIDs();
|
||||
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2006, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package sun.security.action;
|
||||
|
||||
/**
|
||||
* A convenience class for loading a system library as a privileged action.
|
||||
*
|
||||
* <p>An instance of this class can be used as the argument of
|
||||
* <code>AccessController.doPrivileged</code>.
|
||||
*
|
||||
* <p>The following code attempts to load the system library named
|
||||
* <code>"lib"</code> as a privileged action: <p>
|
||||
*
|
||||
* <pre>
|
||||
* java.security.AccessController.doPrivileged(new LoadLibraryAction("lib"));
|
||||
* </pre>
|
||||
*
|
||||
* @author Roland Schemers
|
||||
* @see java.security.PrivilegedAction
|
||||
* @see java.security.AccessController
|
||||
* @since 1.2
|
||||
*/
|
||||
|
||||
public class LoadLibraryAction implements java.security.PrivilegedAction<Void> {
|
||||
private String theLib;
|
||||
|
||||
/**
|
||||
* Constructor that takes the name of the system library that needs to be
|
||||
* loaded.
|
||||
*
|
||||
* <p>The manner in which a library name is mapped to the
|
||||
* actual system library is system dependent.
|
||||
*
|
||||
* @param theLib the name of the library.
|
||||
*/
|
||||
public LoadLibraryAction(String theLib) {
|
||||
this.theLib = theLib;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the system library whose name was specified in the constructor.
|
||||
*/
|
||||
public Void run() {
|
||||
System.loadLibrary(theLib);
|
||||
return null;
|
||||
}
|
||||
}
|
@ -36,7 +36,13 @@ public class SCDynamicStoreConfig {
|
||||
private static native Hashtable<String, Object> getKerberosConfig();
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(new sun.security.action.LoadLibraryAction("osx"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("osx");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
installNotificationCallback();
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,6 @@ package sun.security.smartcardio;
|
||||
|
||||
import java.security.AccessController;
|
||||
|
||||
import sun.security.action.LoadLibraryAction;
|
||||
|
||||
/**
|
||||
* Access to native PC/SC functions and definition of PC/SC constants.
|
||||
* Initialization and platform specific PC/SC constants are handled in
|
||||
|
@ -35,8 +35,13 @@ import java.lang.reflect.Method;
|
||||
class JVM {
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("jsdt"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("jsdt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static long activate(String moduleName, DTraceProvider[] providers) {
|
||||
|
@ -48,7 +48,12 @@ public class FileSystemImpl extends FileSystem {
|
||||
// Initialization
|
||||
|
||||
static {
|
||||
java.security.AccessController
|
||||
.doPrivileged(new sun.security.action.LoadLibraryAction("management"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("management");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +251,12 @@ public class ResolverConfigurationImpl
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("net"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1100,7 +1100,12 @@ public class SctpChannelImpl extends SctpChannel
|
||||
static {
|
||||
Util.load(); /* loads nio & net native libraries */
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("sctp"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("sctp");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
initIDs();
|
||||
}
|
||||
}
|
||||
|
@ -989,6 +989,11 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
static {
|
||||
Util.load(); /* loads nio & net native libraries */
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("sctp"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("sctp");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +428,12 @@ public class SctpServerChannelImpl extends SctpServerChannel
|
||||
static {
|
||||
Util.load(); // loads nio & net native libraries
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("sctp"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("sctp");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
initIDs();
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,12 @@ public class CUPSPrinter {
|
||||
static {
|
||||
// load awt library to access native code
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("awt"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
libFound = initIDs();
|
||||
if (libFound) {
|
||||
cupsServer = getCupsServer();
|
||||
|
@ -37,8 +37,6 @@ import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import sun.security.action.LoadLibraryAction;
|
||||
|
||||
import static sun.awt.shell.Win32ShellFolder2.*;
|
||||
import sun.awt.OSInfo;
|
||||
|
||||
@ -56,7 +54,13 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
|
||||
|
||||
static {
|
||||
// Load library here
|
||||
AccessController.doPrivileged(new LoadLibraryAction("awt"));
|
||||
AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ShellFolder createShellFolder(File file) throws FileNotFoundException {
|
||||
|
@ -94,7 +94,12 @@ public class WToolkit extends SunToolkit implements Runnable {
|
||||
public static void loadLibraries() {
|
||||
if (!loaded) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("awt"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,13 @@ public class FileSystemImpl extends FileSystem {
|
||||
// Initialization
|
||||
|
||||
static {
|
||||
java.security.AccessController
|
||||
.doPrivileged(new sun.security.action.LoadLibraryAction("management"));
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("management");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
init0();
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,12 @@ public class ResolverConfigurationImpl
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("net"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("net");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
init0();
|
||||
|
||||
// start the address listener thread
|
||||
|
@ -56,7 +56,12 @@ public class Win32PrintServiceLookup extends PrintServiceLookup {
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.LoadLibraryAction("awt"));
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* The singleton win32 print lookup service.
|
||||
|
@ -26,8 +26,7 @@
|
||||
package sun.security.smartcardio;
|
||||
|
||||
import java.security.AccessController;
|
||||
|
||||
import sun.security.action.LoadLibraryAction;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
// Platform specific code and constants
|
||||
class PlatformPCSC {
|
||||
@ -44,7 +43,12 @@ class PlatformPCSC {
|
||||
|
||||
private static Throwable loadLibrary() {
|
||||
try {
|
||||
AccessController.doPrivileged(new LoadLibraryAction("j2pcsc"));
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("j2pcsc");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
return null;
|
||||
} catch (Throwable e) {
|
||||
return e;
|
||||
|
Loading…
x
Reference in New Issue
Block a user