8344060: Remove doPrivileged calls from shared implementation code in the java.desktop module : part 1
Reviewed-by: aivanov, prr
This commit is contained in:
parent
587f2b4b4d
commit
5b12a87dcb
@ -79,7 +79,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.security.AccessController;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
@ -100,8 +99,6 @@ import sun.awt.image.ToolkitImage;
|
||||
import sun.awt.image.URLImageSource;
|
||||
import sun.font.FontDesignMetrics;
|
||||
import sun.net.util.URLUtil;
|
||||
import sun.security.action.GetBooleanAction;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING;
|
||||
@ -122,14 +119,12 @@ public abstract class SunToolkit extends Toolkit
|
||||
initStatic();
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static void initStatic() {
|
||||
if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.nativedebug"))) {
|
||||
if (Boolean.getBoolean("sun.awt.nativedebug")) {
|
||||
DebugSettings.init();
|
||||
}
|
||||
touchKeyboardAutoShowIsEnabled = Boolean.parseBoolean(
|
||||
GetPropertyAction.privilegedGetProperty(
|
||||
"awt.touchKeyboardAutoShowIsEnabled", "true"));
|
||||
System.getProperty("awt.touchKeyboardAutoShowIsEnabled", "true"));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -231,9 +226,8 @@ public abstract class SunToolkit extends Toolkit
|
||||
* }
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static final ReentrantLock AWT_LOCK = new ReentrantLock(
|
||||
AccessController.doPrivileged(new GetBooleanAction("awt.lock.fair")));
|
||||
Boolean.getBoolean("awt.lock.fair"));
|
||||
private static final Condition AWT_LOCK_COND = AWT_LOCK.newCondition();
|
||||
|
||||
public static final void awtLock() {
|
||||
@ -672,18 +666,16 @@ public abstract class SunToolkit extends Toolkit
|
||||
* Returns the value of "sun.awt.noerasebackground" property. Default
|
||||
* value is {@code false}.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static boolean getSunAwtNoerasebackground() {
|
||||
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.noerasebackground"));
|
||||
return Boolean.getBoolean("sun.awt.noerasebackground");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of "sun.awt.erasebackgroundonresize" property. Default
|
||||
* value is {@code false}.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static boolean getSunAwtErasebackgroundonresize() {
|
||||
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.erasebackgroundonresize"));
|
||||
return Boolean.getBoolean("sun.awt.erasebackgroundonresize");
|
||||
}
|
||||
|
||||
|
||||
@ -1157,15 +1149,12 @@ public abstract class SunToolkit extends Toolkit
|
||||
/**
|
||||
* Returns the locale in which the runtime was started.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Locale getStartupLocale() {
|
||||
if (startupLocale == null) {
|
||||
String language, region, country, variant;
|
||||
language = AccessController.doPrivileged(
|
||||
new GetPropertyAction("user.language", "en"));
|
||||
language = System.getProperty("user.language", "en");
|
||||
// for compatibility, check for old user.region property
|
||||
region = AccessController.doPrivileged(
|
||||
new GetPropertyAction("user.region"));
|
||||
region = System.getProperty("user.region");
|
||||
if (region != null) {
|
||||
// region can be of form country, country_variant, or _variant
|
||||
int i = region.indexOf('_');
|
||||
@ -1177,10 +1166,8 @@ public abstract class SunToolkit extends Toolkit
|
||||
variant = "";
|
||||
}
|
||||
} else {
|
||||
country = AccessController.doPrivileged(
|
||||
new GetPropertyAction("user.country", ""));
|
||||
variant = AccessController.doPrivileged(
|
||||
new GetPropertyAction("user.variant", ""));
|
||||
country = System.getProperty("user.country", "");
|
||||
variant = System.getProperty("user.variant", "");
|
||||
}
|
||||
startupLocale = Locale.of(language, country, variant);
|
||||
}
|
||||
@ -1201,9 +1188,7 @@ public abstract class SunToolkit extends Toolkit
|
||||
* @return {@code true}, if XEmbed is needed, {@code false} otherwise
|
||||
*/
|
||||
public static boolean needsXEmbed() {
|
||||
@SuppressWarnings("removal")
|
||||
String noxembed = AccessController.
|
||||
doPrivileged(new GetPropertyAction("sun.awt.noxembed", "false"));
|
||||
String noxembed = System.getProperty("sun.awt.noxembed", "false");
|
||||
if ("true".equals(noxembed)) {
|
||||
return false;
|
||||
}
|
||||
@ -1235,9 +1220,8 @@ public abstract class SunToolkit extends Toolkit
|
||||
* developer. If true, Toolkit should return an
|
||||
* XEmbed-server-enabled CanvasPeer instead of the ordinary CanvasPeer.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected final boolean isXEmbedServerRequested() {
|
||||
return AccessController.doPrivileged(new GetBooleanAction("sun.awt.xembedserver"));
|
||||
return Boolean.getBoolean("sun.awt.xembedserver");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1756,16 +1740,13 @@ public abstract class SunToolkit extends Toolkit
|
||||
* to be inapplicable in that case. In that headless case although
|
||||
* this method will return "true" the toolkit will return a null map.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static boolean useSystemAAFontSettings() {
|
||||
if (!checkedSystemAAFontSettings) {
|
||||
useSystemAAFontSettings = true; /* initially set this true */
|
||||
String systemAAFonts = null;
|
||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||
if (tk instanceof SunToolkit) {
|
||||
systemAAFonts =
|
||||
AccessController.doPrivileged(
|
||||
new GetPropertyAction("awt.useSystemAAFontSettings"));
|
||||
systemAAFonts = System.getProperty("awt.useSystemAAFontSettings");
|
||||
}
|
||||
if (systemAAFonts != null) {
|
||||
useSystemAAFontSettings = Boolean.parseBoolean(systemAAFonts);
|
||||
@ -1859,11 +1840,9 @@ public abstract class SunToolkit extends Toolkit
|
||||
* Returns the value of "sun.awt.disableMixing" property. Default
|
||||
* value is {@code false}.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static synchronized boolean getSunAwtDisableMixing() {
|
||||
if (sunAwtDisableMixing == null) {
|
||||
sunAwtDisableMixing = AccessController.doPrivileged(
|
||||
new GetBooleanAction("sun.awt.disableMixing"));
|
||||
sunAwtDisableMixing = Boolean.getBoolean("sun.awt.disableMixing");
|
||||
}
|
||||
return sunAwtDisableMixing.booleanValue();
|
||||
}
|
||||
|
@ -159,18 +159,11 @@ public abstract class ImageDecoder {
|
||||
public abstract void produceImage() throws IOException,
|
||||
ImageFormatException;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public void abort() {
|
||||
aborted = true;
|
||||
source.doneDecoding(this);
|
||||
close();
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
feeder.interrupt();
|
||||
return null;
|
||||
}
|
||||
});
|
||||
feeder.interrupt();
|
||||
}
|
||||
|
||||
public synchronized void close() {
|
||||
|
@ -276,7 +276,6 @@ class ImageFetcher extends Thread {
|
||||
/**
|
||||
* Create and start ImageFetcher threads in the appropriate ThreadGroup.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static void createFetchers(final FetcherInfo info) {
|
||||
// We need to instantiate a new ImageFetcher thread.
|
||||
// First, figure out which ThreadGroup we'll put the
|
||||
@ -310,25 +309,18 @@ class ImageFetcher extends Thread {
|
||||
}
|
||||
final ThreadGroup fetcherGroup = fetcherThreadGroup;
|
||||
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
for (int i = 0; i < info.fetchers.length; i++) {
|
||||
if (info.fetchers[i] == null) {
|
||||
ImageFetcher f = new ImageFetcher(fetcherGroup, i);
|
||||
try {
|
||||
f.start();
|
||||
info.fetchers[i] = f;
|
||||
info.numFetchers++;
|
||||
break;
|
||||
} catch (Error e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
for (int i = 0; i < info.fetchers.length; i++) {
|
||||
if (info.fetchers[i] == null) {
|
||||
ImageFetcher f = new ImageFetcher(fetcherGroup, i);
|
||||
try {
|
||||
f.start();
|
||||
info.fetchers[i] = f;
|
||||
info.numFetchers++;
|
||||
break;
|
||||
} catch (Error e) {
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,10 +29,6 @@ import java.lang.ref.WeakReference;
|
||||
import java.awt.Image;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
public abstract class ImageWatched {
|
||||
public static Link endlink = new Link();
|
||||
|
||||
@ -89,28 +85,16 @@ public abstract class ImageWatched {
|
||||
}
|
||||
}
|
||||
|
||||
static class AccWeakReference<T> extends WeakReference<T> {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private final AccessControlContext acc;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
AccWeakReference(T ref) {
|
||||
super(ref);
|
||||
acc = AccessController.getContext();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Standard Link implementation to manage a Weak Reference
|
||||
* to an ImageObserver.
|
||||
*/
|
||||
public static class WeakLink extends Link {
|
||||
private final AccWeakReference<ImageObserver> myref;
|
||||
private final WeakReference<ImageObserver> myref;
|
||||
private Link next;
|
||||
|
||||
public WeakLink(ImageObserver obs, Link next) {
|
||||
myref = new AccWeakReference<ImageObserver>(obs);
|
||||
myref = new WeakReference<ImageObserver>(obs);
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
@ -136,20 +120,6 @@ public abstract class ImageWatched {
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static boolean update(ImageObserver iw, AccessControlContext acc,
|
||||
Image img, int info,
|
||||
int x, int y, int w, int h) {
|
||||
|
||||
if (acc != null || System.getSecurityManager() != null) {
|
||||
return AccessController.doPrivileged(
|
||||
(PrivilegedAction<Boolean>) () -> {
|
||||
return iw.imageUpdate(img, info, x, y, w, h);
|
||||
}, acc);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean newInfo(Image img, int info,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
@ -159,7 +129,7 @@ public abstract class ImageWatched {
|
||||
if (myiw == null) {
|
||||
// My referent is null so we must prune in a second pass.
|
||||
ret = true;
|
||||
} else if (update(myiw, myref.acc, img, info, x, y, w, h) == false) {
|
||||
} else if (myiw.imageUpdate(img, info, x, y, w, h) == false) {
|
||||
// My referent has lost interest so clear it and ask
|
||||
// for a pruning pass to remove it later.
|
||||
myref.clear();
|
||||
|
@ -37,8 +37,6 @@ import java.awt.image.LookupTable;
|
||||
import java.awt.image.RasterOp;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* This class provides a hook to access platform-specific
|
||||
@ -51,7 +49,7 @@ import java.security.PrivilegedAction;
|
||||
* (in which case our java code will be executed) or may throw
|
||||
* an exception.
|
||||
*/
|
||||
@SuppressWarnings({"removal", "restricted"})
|
||||
@SuppressWarnings("restricted")
|
||||
public class ImagingLib {
|
||||
|
||||
static boolean useLib = true;
|
||||
@ -90,20 +88,14 @@ public class ImagingLib {
|
||||
|
||||
static {
|
||||
|
||||
PrivilegedAction<Boolean> doMlibInitialization =
|
||||
new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
try {
|
||||
System.loadLibrary("mlib_image");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
boolean success = init();
|
||||
return Boolean.valueOf(success);
|
||||
}
|
||||
};
|
||||
boolean success = false;
|
||||
try {
|
||||
System.loadLibrary("mlib_image");
|
||||
success = init();
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
}
|
||||
|
||||
useLib = AccessController.doPrivileged(doMlibInitialization);
|
||||
useLib = success;
|
||||
|
||||
//
|
||||
// Cache the class references of the operations we know about
|
||||
|
@ -42,7 +42,7 @@ import java.awt.image.*;
|
||||
*
|
||||
* @author Jim Graham
|
||||
*/
|
||||
@SuppressWarnings({"removal", "restricted"})
|
||||
@SuppressWarnings("restricted")
|
||||
public class JPEGImageDecoder extends ImageDecoder {
|
||||
private static ColorModel RGBcolormodel;
|
||||
private static ColorModel ARGBcolormodel;
|
||||
@ -54,13 +54,7 @@ public class JPEGImageDecoder extends ImageDecoder {
|
||||
private ColorModel colormodel;
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("javajpeg");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
System.loadLibrary("javajpeg");
|
||||
initIDs(InputStreamClass);
|
||||
RGBcolormodel = new DirectColorModel(24, 0xff0000, 0xff00, 0xff);
|
||||
ARGBcolormodel = ColorModel.getRGBdefault();
|
||||
|
@ -52,14 +52,8 @@ class NativeLibLoader {
|
||||
* For now, we know it's done by the implementation, and we assume
|
||||
* that the name of the library is "awt". -br.
|
||||
*/
|
||||
@SuppressWarnings({"removal", "restricted"})
|
||||
@SuppressWarnings("restricted")
|
||||
static void loadLibraries() {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
System.loadLibrary("awt");
|
||||
}
|
||||
}
|
||||
|
@ -35,11 +35,8 @@ public abstract class VSyncedBSManager {
|
||||
|
||||
private static VSyncedBSManager theInstance;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static final boolean vSyncLimit =
|
||||
Boolean.parseBoolean(java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction(
|
||||
"sun.java2d.vsynclimit", "true")));
|
||||
Boolean.parseBoolean(System.getProperty("sun.java2d.vsynclimit", "true"));
|
||||
|
||||
private static VSyncedBSManager getInstance(boolean create) {
|
||||
if (theInstance == null && create) {
|
||||
|
@ -72,7 +72,6 @@ import java.io.Writer;
|
||||
* exist once those APIs are in place.
|
||||
* @author Chet Haase
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public class PerformanceLogger {
|
||||
|
||||
// Timing values of global interest
|
||||
@ -87,16 +86,12 @@ public class PerformanceLogger {
|
||||
private static long baseTime;
|
||||
|
||||
static {
|
||||
String perfLoggingProp =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("sun.perflog"));
|
||||
String perfLoggingProp = System.getProperty("sun.perflog");
|
||||
if (perfLoggingProp != null) {
|
||||
perfLoggingOn = true;
|
||||
|
||||
// Check if we should use nanoTime
|
||||
String perfNanoProp =
|
||||
java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("sun.perflog.nano"));
|
||||
String perfNanoProp = System.getProperty("sun.perflog.nano");
|
||||
if (perfNanoProp != null) {
|
||||
useNanoTime = true;
|
||||
}
|
||||
@ -107,21 +102,15 @@ public class PerformanceLogger {
|
||||
}
|
||||
if (logFileName != null) {
|
||||
if (logWriter == null) {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
try {
|
||||
File logFile = new File(logFileName);
|
||||
logFile.createNewFile();
|
||||
logWriter = new FileWriter(logFile);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e + ": Creating logfile " +
|
||||
logFileName +
|
||||
". Log to console");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
try {
|
||||
File logFile = new File(logFileName);
|
||||
logFile.createNewFile();
|
||||
logWriter = new FileWriter(logFile);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e + ": Creating logfile " +
|
||||
logFileName +
|
||||
". Log to console");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (logWriter == null) {
|
||||
|
@ -31,8 +31,6 @@ import java.lang.ref.Reference;
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.lang.ref.PhantomReference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Hashtable;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
|
||||
@ -50,7 +48,7 @@ import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
*
|
||||
* @see DisposerRecord
|
||||
*/
|
||||
@SuppressWarnings({"removal", "restricted"})
|
||||
@SuppressWarnings("restricted")
|
||||
public class Disposer implements Runnable {
|
||||
private static final ReferenceQueue<Object> queue = new ReferenceQueue<>();
|
||||
private static final Hashtable<java.lang.ref.Reference<Object>, DisposerRecord> records =
|
||||
@ -62,16 +60,9 @@ public class Disposer implements Runnable {
|
||||
public static int refType = PHANTOM;
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Void>() {
|
||||
public Void run() {
|
||||
System.loadLibrary("awt");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
System.loadLibrary("awt");
|
||||
initIDs();
|
||||
String type = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("sun.java2d.reftype"));
|
||||
String type = System.getProperty("sun.java2d.reftype");
|
||||
if (type != null) {
|
||||
if (type.equals("weak")) {
|
||||
refType = WEAK;
|
||||
@ -82,16 +73,13 @@ public class Disposer implements Runnable {
|
||||
}
|
||||
}
|
||||
disposerInstance = new Disposer();
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
String name = "Java2D Disposer";
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
Thread t = new Thread(rootTG, disposerInstance, name, 0, false);
|
||||
t.setContextClassLoader(null);
|
||||
t.setDaemon(true);
|
||||
t.setPriority(Thread.MAX_PRIORITY);
|
||||
t.start();
|
||||
return null;
|
||||
});
|
||||
String name = "Java2D Disposer";
|
||||
ThreadGroup rootTG = ThreadGroupUtils.getRootThreadGroup();
|
||||
Thread t = new Thread(rootTG, disposerInstance, name, 0, false);
|
||||
t.setContextClassLoader(null);
|
||||
t.setDaemon(true);
|
||||
t.setPriority(Thread.MAX_PRIORITY);
|
||||
t.start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,6 @@ import java.awt.Toolkit;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.security.AccessController;
|
||||
import java.util.Locale;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@ -50,7 +49,6 @@ import sun.font.FontManager;
|
||||
import sun.font.FontManagerFactory;
|
||||
import sun.font.FontManagerForSGE;
|
||||
import sun.java2d.pipe.Region;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* This is an implementation of a GraphicsEnvironment object for the
|
||||
@ -65,10 +63,8 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
|
||||
/** Establish the default font to be used by SG2D. */
|
||||
private final Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static final boolean uiScaleEnabled
|
||||
= "true".equals(AccessController.doPrivileged(
|
||||
new GetPropertyAction("sun.java2d.uiScale.enabled", "true")));
|
||||
= "true".equals(System.getProperty("sun.java2d.uiScale.enabled", "true"));
|
||||
|
||||
private static final double debugScale =
|
||||
uiScaleEnabled ? getScaleFactor("sun.java2d.uiScale") : -1;
|
||||
@ -293,9 +289,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
|
||||
|
||||
public static double getScaleFactor(String propertyName) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
String scaleFactor = AccessController.doPrivileged(
|
||||
new GetPropertyAction(propertyName, "-1"));
|
||||
String scaleFactor = System.getProperty(propertyName, "-1");
|
||||
|
||||
if (scaleFactor == null || scaleFactor.equals("-1")) {
|
||||
return -1;
|
||||
|
@ -38,9 +38,6 @@ import sun.java2d.loops.Blit;
|
||||
import sun.java2d.loops.BlitBg;
|
||||
import sun.awt.image.SurfaceManager;
|
||||
|
||||
import java.security.AccessController;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* The proxy class encapsulates the logic for managing alternate
|
||||
* SurfaceData representations of a primary SurfaceData.
|
||||
@ -70,18 +67,14 @@ public abstract class SurfaceDataProxy
|
||||
|
||||
static {
|
||||
cachingAllowed = true;
|
||||
@SuppressWarnings("removal")
|
||||
String manimg = AccessController.doPrivileged(
|
||||
new GetPropertyAction("sun.java2d.managedimages"));
|
||||
String manimg = System.getProperty("sun.java2d.managedimages");
|
||||
if ("false".equals(manimg)) {
|
||||
cachingAllowed = false;
|
||||
System.out.println("Disabling managed images");
|
||||
}
|
||||
|
||||
defaultThreshold = 1;
|
||||
@SuppressWarnings("removal")
|
||||
String num = AccessController.doPrivileged(
|
||||
new GetPropertyAction("sun.java2d.accthreshold"));
|
||||
String num = System.getProperty("sun.java2d.accthreshold");
|
||||
if (num != null) {
|
||||
try {
|
||||
int parsed = Integer.parseInt(num);
|
||||
|
@ -27,9 +27,6 @@ package sun.java2d.cmm;
|
||||
|
||||
import java.awt.color.CMMException;
|
||||
import java.awt.color.ICC_Profile;
|
||||
import java.security.AccessController;
|
||||
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
public final class CMSManager {
|
||||
|
||||
@ -45,9 +42,7 @@ public final class CMSManager {
|
||||
return cmmImpl;
|
||||
}
|
||||
|
||||
GetPropertyAction gpa = new GetPropertyAction("sun.java2d.cmm");
|
||||
@SuppressWarnings("removal")
|
||||
String cmmProviderClass = AccessController.doPrivileged(gpa);
|
||||
String cmmProviderClass = System.getProperty("sun.java2d.cmm");
|
||||
CMMServiceProvider provider = null;
|
||||
if (cmmProviderClass != null) {
|
||||
try {
|
||||
@ -67,9 +62,7 @@ public final class CMSManager {
|
||||
"No CM module found");
|
||||
}
|
||||
|
||||
gpa = new GetPropertyAction("sun.java2d.cmm.trace");
|
||||
@SuppressWarnings("removal")
|
||||
String cmmTrace = AccessController.doPrivileged(gpa);
|
||||
String cmmTrace = System.getProperty("sun.java2d.cmm.trace");
|
||||
if (cmmTrace != null) {
|
||||
cmmImpl = new CMMTracer(cmmImpl);
|
||||
}
|
||||
|
@ -143,23 +143,17 @@ final class LCMS implements PCMM {
|
||||
|
||||
private static LCMS theLcms = null;
|
||||
|
||||
@SuppressWarnings({"removal", "restricted"})
|
||||
@SuppressWarnings("restricted")
|
||||
static synchronized PCMM getModule() {
|
||||
if (theLcms != null) {
|
||||
return theLcms;
|
||||
}
|
||||
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
/* We need to load awt here because of usage trace and
|
||||
* disposer frameworks
|
||||
*/
|
||||
System.loadLibrary("awt");
|
||||
System.loadLibrary("lcms");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
/* We need to load awt here because of usage trace and
|
||||
* disposer frameworks
|
||||
*/
|
||||
System.loadLibrary("awt");
|
||||
System.loadLibrary("lcms");
|
||||
|
||||
theLcms = new LCMS();
|
||||
|
||||
|
@ -36,8 +36,6 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
@ -46,7 +44,6 @@ import sun.awt.image.BufImgSurfaceData;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
import sun.java2d.SurfaceData;
|
||||
import sun.java2d.pipe.Region;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* defines interface for primitives which can be placed into
|
||||
@ -336,9 +333,7 @@ public abstract class GraphicsPrimitive {
|
||||
public static final int TRACECOUNTS = 4;
|
||||
|
||||
static {
|
||||
GetPropertyAction gpa = new GetPropertyAction("sun.java2d.trace");
|
||||
@SuppressWarnings("removal")
|
||||
String trace = AccessController.doPrivileged(gpa);
|
||||
String trace = System.getProperty("sun.java2d.trace");
|
||||
if (trace != null) {
|
||||
boolean verbose = false;
|
||||
int traceflags = 0;
|
||||
@ -401,17 +396,12 @@ public abstract class GraphicsPrimitive {
|
||||
private static PrintStream getTraceOutputFile() {
|
||||
if (traceout == null) {
|
||||
if (tracefile != null) {
|
||||
@SuppressWarnings("removal")
|
||||
FileOutputStream o = AccessController.doPrivileged(
|
||||
new PrivilegedAction<FileOutputStream>() {
|
||||
public FileOutputStream run() {
|
||||
try {
|
||||
return new FileOutputStream(tracefile);
|
||||
} catch (FileNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
FileOutputStream o;
|
||||
try {
|
||||
o = new FileOutputStream(tracefile);
|
||||
} catch (FileNotFoundException e) {
|
||||
o = null;
|
||||
}
|
||||
if (o != null) {
|
||||
traceout = new PrintStream(o);
|
||||
} else {
|
||||
@ -425,17 +415,13 @@ public abstract class GraphicsPrimitive {
|
||||
}
|
||||
|
||||
public static class TraceReporter implements Runnable {
|
||||
@SuppressWarnings("removal")
|
||||
public static void setShutdownHook() {
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
TraceReporter t = new TraceReporter();
|
||||
Thread thread = new Thread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), t,
|
||||
"TraceReporter", 0, false);
|
||||
thread.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
return null;
|
||||
});
|
||||
TraceReporter t = new TraceReporter();
|
||||
Thread thread = new Thread(
|
||||
ThreadGroupUtils.getRootThreadGroup(), t,
|
||||
"TraceReporter", 0, false);
|
||||
thread.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
@ -30,7 +30,6 @@ import java.awt.Shape;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.geom.Path2D;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.security.AccessController;
|
||||
import java.util.Arrays;
|
||||
import sun.awt.geom.PathConsumer2D;
|
||||
import static sun.java2d.marlin.MarlinUtils.logInfo;
|
||||
@ -40,7 +39,6 @@ import sun.java2d.ReentrantContextProviderTL;
|
||||
import sun.java2d.pipe.AATileGenerator;
|
||||
import sun.java2d.pipe.Region;
|
||||
import sun.java2d.pipe.RenderingEngine;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* Marlin RendererEngine implementation (derived from Pisces)
|
||||
@ -1119,10 +1117,8 @@ public final class DMarlinRenderingEngine extends RenderingEngine
|
||||
USE_THREAD_LOCAL = MarlinProperties.isUseThreadLocal();
|
||||
|
||||
// Soft reference by default:
|
||||
@SuppressWarnings("removal")
|
||||
final String refType = AccessController.doPrivileged(
|
||||
new GetPropertyAction("sun.java2d.renderer.useRef",
|
||||
"soft"));
|
||||
final String refType = System.getProperty("sun.java2d.renderer.useRef",
|
||||
"soft");
|
||||
switch (refType) {
|
||||
default:
|
||||
case "soft":
|
||||
|
@ -25,9 +25,7 @@
|
||||
|
||||
package sun.java2d.marlin;
|
||||
|
||||
import java.security.AccessController;
|
||||
import static sun.java2d.marlin.MarlinUtils.logInfo;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
public final class MarlinProperties {
|
||||
|
||||
@ -288,24 +286,18 @@ public final class MarlinProperties {
|
||||
}
|
||||
|
||||
// system property utilities
|
||||
@SuppressWarnings("removal")
|
||||
static String getString(final String key, final String def) {
|
||||
return AccessController.doPrivileged(
|
||||
new GetPropertyAction(key, def));
|
||||
return System.getProperty(key, def);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static boolean getBoolean(final String key, final String def) {
|
||||
return Boolean.parseBoolean(AccessController.doPrivileged(
|
||||
new GetPropertyAction(key, def)));
|
||||
return Boolean.parseBoolean(System.getProperty(key, def));
|
||||
}
|
||||
|
||||
static int getInteger(final String key, final int def,
|
||||
final int min, final int max)
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
final String property = AccessController.doPrivileged(
|
||||
new GetPropertyAction(key));
|
||||
final String property = System.getProperty(key);
|
||||
|
||||
int value = def;
|
||||
if (property != null) {
|
||||
@ -334,9 +326,7 @@ public final class MarlinProperties {
|
||||
final double min, final double max)
|
||||
{
|
||||
double value = def;
|
||||
@SuppressWarnings("removal")
|
||||
final String property = AccessController.doPrivileged(
|
||||
new GetPropertyAction(key));
|
||||
final String property = System.getProperty(key);
|
||||
|
||||
if (property != null) {
|
||||
try {
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
package sun.java2d.marlin;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
@ -357,11 +355,8 @@ public final class RendererStats implements MarlinConst {
|
||||
private final ConcurrentLinkedQueue<RendererStats> allStats
|
||||
= new ConcurrentLinkedQueue<>();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private RendererStatsHolder() {
|
||||
AccessController.doPrivileged(
|
||||
(PrivilegedAction<Void>) () -> {
|
||||
final Thread hook = new Thread(
|
||||
final Thread hook = new Thread(
|
||||
MarlinUtils.getRootThreadGroup(),
|
||||
new Runnable() {
|
||||
@Override
|
||||
@ -371,21 +366,18 @@ public final class RendererStats implements MarlinConst {
|
||||
},
|
||||
"MarlinStatsHook"
|
||||
);
|
||||
hook.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
hook.setContextClassLoader(null);
|
||||
Runtime.getRuntime().addShutdownHook(hook);
|
||||
|
||||
if (USE_DUMP_THREAD) {
|
||||
final Timer statTimer = new Timer("RendererStats");
|
||||
statTimer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
dump();
|
||||
}
|
||||
}, DUMP_INTERVAL, DUMP_INTERVAL);
|
||||
if (USE_DUMP_THREAD) {
|
||||
final Timer statTimer = new Timer("RendererStats");
|
||||
statTimer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
dump();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
);
|
||||
}, DUMP_INTERVAL, DUMP_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
void add(final Object parent, final RendererStats stats) {
|
||||
|
@ -30,8 +30,6 @@ import sun.java2d.pipe.RenderBuffer;
|
||||
import sun.java2d.pipe.RenderQueue;
|
||||
|
||||
import static sun.java2d.pipe.BufferedOpCodes.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* OGL-specific implementation of RenderQueue. This class provides a
|
||||
@ -44,13 +42,12 @@ public class OGLRenderQueue extends RenderQueue {
|
||||
private static OGLRenderQueue theInstance;
|
||||
private final QueueFlusher flusher;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private OGLRenderQueue() {
|
||||
/*
|
||||
* The thread must be a member of a thread group
|
||||
* which will not get GCed before VM exit.
|
||||
*/
|
||||
flusher = AccessController.doPrivileged((PrivilegedAction<QueueFlusher>) QueueFlusher::new);
|
||||
flusher = new QueueFlusher();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,31 +178,19 @@ public abstract class OGLSurfaceData extends SurfaceData
|
||||
static {
|
||||
if (!GraphicsEnvironment.isHeadless()) {
|
||||
// fbobject currently enabled by default; use "false" to disable
|
||||
@SuppressWarnings("removal")
|
||||
String fbo = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction(
|
||||
"sun.java2d.opengl.fbobject"));
|
||||
String fbo = System.getProperty("sun.java2d.opengl.fbobject");
|
||||
isFBObjectEnabled = !"false".equals(fbo);
|
||||
|
||||
// lcdshader currently enabled by default; use "false" to disable
|
||||
@SuppressWarnings("removal")
|
||||
String lcd = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction(
|
||||
"sun.java2d.opengl.lcdshader"));
|
||||
String lcd = System.getProperty("sun.java2d.opengl.lcdshader");
|
||||
isLCDShaderEnabled = !"false".equals(lcd);
|
||||
|
||||
// biopshader currently enabled by default; use "false" to disable
|
||||
@SuppressWarnings("removal")
|
||||
String biop = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction(
|
||||
"sun.java2d.opengl.biopshader"));
|
||||
String biop = System.getProperty("sun.java2d.opengl.biopshader");
|
||||
isBIOpShaderEnabled = !"false".equals(biop);
|
||||
|
||||
// gradshader currently enabled by default; use "false" to disable
|
||||
@SuppressWarnings("removal")
|
||||
String grad = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction(
|
||||
"sun.java2d.opengl.gradshader"));
|
||||
String grad = System.getProperty("sun.java2d.opengl.gradshader");
|
||||
isGradShaderEnabled = !"false".equals(grad);
|
||||
|
||||
OGLRenderQueue rq = OGLRenderQueue.getInstance();
|
||||
|
@ -30,9 +30,6 @@ import java.awt.BasicStroke;
|
||||
import java.awt.geom.PathIterator;
|
||||
import java.awt.geom.AffineTransform;
|
||||
|
||||
import java.security.AccessController;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
import sun.awt.geom.PathConsumer2D;
|
||||
|
||||
/**
|
||||
@ -120,10 +117,7 @@ public abstract class RenderingEngine {
|
||||
/* Look first for an app-override renderer,
|
||||
* if not specified or present, then look for marlin.
|
||||
*/
|
||||
GetPropertyAction gpa =
|
||||
new GetPropertyAction("sun.java2d.renderer");
|
||||
@SuppressWarnings("removal")
|
||||
String reClass = AccessController.doPrivileged(gpa);
|
||||
String reClass = System.getProperty("sun.java2d.renderer");
|
||||
if (reClass != null) {
|
||||
try {
|
||||
Class<?> cls = Class.forName(reClass);
|
||||
@ -144,16 +138,12 @@ public abstract class RenderingEngine {
|
||||
throw new InternalError("No RenderingEngine module found");
|
||||
}
|
||||
|
||||
gpa = new GetPropertyAction("sun.java2d.renderer.verbose");
|
||||
@SuppressWarnings("removal")
|
||||
String verbose = AccessController.doPrivileged(gpa);
|
||||
String verbose = System.getProperty("sun.java2d.renderer.verbose");
|
||||
if (verbose != null && verbose.startsWith("t")) {
|
||||
System.out.println("RenderingEngine = "+reImpl);
|
||||
}
|
||||
|
||||
gpa = new GetPropertyAction("sun.java2d.renderer.trace");
|
||||
@SuppressWarnings("removal")
|
||||
String reTrace = AccessController.doPrivileged(gpa);
|
||||
String reTrace = System.getProperty("sun.java2d.renderer.trace");
|
||||
if (reTrace != null) {
|
||||
reImpl = new Tracer(reImpl);
|
||||
}
|
||||
|
@ -338,18 +338,9 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
initStatic();
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static void initStatic() {
|
||||
//enable privileges so initProps can access system properties,
|
||||
// open the property file, etc.
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
mFontProps = initProps();
|
||||
isMac = OSInfo.getOSType() == OSInfo.OSType.MACOSX;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
mFontProps = initProps();
|
||||
isMac = OSInfo.getOSType() == OSInfo.OSType.MACOSX;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -512,7 +503,6 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
* this method is called to mark the start of a
|
||||
* document.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected void startDoc() throws PrinterException {
|
||||
|
||||
// A security check has been performed in the
|
||||
@ -551,7 +541,7 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
}
|
||||
} else {
|
||||
PrinterOpener po = new PrinterOpener();
|
||||
java.security.AccessController.doPrivileged(po);
|
||||
po.run();
|
||||
if (po.pex != null) {
|
||||
throw po.pex;
|
||||
}
|
||||
@ -641,22 +631,16 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
paperWidth + " "+ paperHeight+"]");
|
||||
|
||||
final PrintService pservice = getPrintService();
|
||||
Boolean isPS = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
try {
|
||||
Class<?> psClass = Class.forName("sun.print.IPPPrintService");
|
||||
if (psClass.isInstance(pservice)) {
|
||||
Method isPSMethod = psClass.getMethod("isPostscript",
|
||||
(Class[])null);
|
||||
return (Boolean)isPSMethod.invoke(pservice, (Object[])null);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
Boolean isPS = Boolean.TRUE;
|
||||
try {
|
||||
Class<?> psClass = Class.forName("sun.print.IPPPrintService");
|
||||
if (psClass.isInstance(pservice)) {
|
||||
Method isPSMethod = psClass.getMethod("isPostscript",
|
||||
(Class[])null);
|
||||
isPS = (Boolean)isPSMethod.invoke(pservice, (Object[])null);
|
||||
}
|
||||
);
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
if (isPS) {
|
||||
mPSStream.print(" /DeferredMediaSelection true");
|
||||
}
|
||||
@ -677,9 +661,9 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
mPSStream.println("%%EndSetup");
|
||||
}
|
||||
|
||||
// Inner class to run "privileged" to open the printer output stream.
|
||||
// Inner class to open the printer output stream.
|
||||
|
||||
private class PrinterOpener implements java.security.PrivilegedAction<OutputStream> {
|
||||
private class PrinterOpener {
|
||||
PrinterException pex;
|
||||
OutputStream result;
|
||||
|
||||
@ -704,9 +688,9 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
}
|
||||
}
|
||||
|
||||
// Inner class to run "privileged" to invoke the system print command
|
||||
// Inner class to invoke the system print command
|
||||
|
||||
private class PrinterSpooler implements java.security.PrivilegedAction<Object> {
|
||||
private class PrinterSpooler {
|
||||
PrinterException pex;
|
||||
|
||||
private void handleProcessFailure(final Process failedProcess,
|
||||
@ -767,21 +751,13 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
/**
|
||||
* Invoked if the application cancelled the printjob.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected void abortDoc() {
|
||||
if (mPSStream != null && mDestType != RasterPrinterJob.STREAM) {
|
||||
mPSStream.close();
|
||||
}
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
|
||||
public Object run() {
|
||||
if (spoolFile != null && spoolFile.exists()) {
|
||||
spoolFile.delete();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
if (spoolFile != null && spoolFile.exists()) {
|
||||
spoolFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -789,7 +765,6 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
* this method is called after that last page
|
||||
* has been imaged.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected void endDoc() throws PrinterException {
|
||||
if (mPSStream != null) {
|
||||
mPSStream.println(EOF_COMMENT);
|
||||
@ -814,7 +789,7 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
}
|
||||
}
|
||||
PrinterSpooler spooler = new PrinterSpooler();
|
||||
java.security.AccessController.doPrivileged(spooler);
|
||||
spooler.run();
|
||||
if (spooler.pex != null) {
|
||||
throw spooler.pex;
|
||||
}
|
||||
@ -859,28 +834,18 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
paperWidth + " " + paperHeight + "]");
|
||||
|
||||
final PrintService pservice = getPrintService();
|
||||
@SuppressWarnings("removal")
|
||||
Boolean isPS = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
try {
|
||||
Class<?> psClass =
|
||||
Class.forName("sun.print.IPPPrintService");
|
||||
if (psClass.isInstance(pservice)) {
|
||||
Method isPSMethod =
|
||||
psClass.getMethod("isPostscript",
|
||||
(Class[])null);
|
||||
return (Boolean)
|
||||
isPSMethod.invoke(pservice,
|
||||
Boolean isPS = Boolean.TRUE;
|
||||
try {
|
||||
Class<?> psClass = Class.forName("sun.print.IPPPrintService");
|
||||
if (psClass.isInstance(pservice)) {
|
||||
Method isPSMethod =
|
||||
psClass.getMethod("isPostscript",
|
||||
(Class[])null);
|
||||
isPS = (Boolean) isPSMethod.invoke(pservice,
|
||||
(Object[])null);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
}
|
||||
if (isPS) {
|
||||
mPSStream.print(" /DeferredMediaSelection true");
|
||||
}
|
||||
|
@ -174,9 +174,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
||||
* use a particular pipeline. Either the raster
|
||||
* pipeline or the pdl pipeline can be forced.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
String forceStr = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction(FORCE_PIPE_PROP));
|
||||
String forceStr = System.getProperty(FORCE_PIPE_PROP);
|
||||
|
||||
if (forceStr != null) {
|
||||
if (forceStr.equalsIgnoreCase(FORCE_PDL)) {
|
||||
@ -186,9 +184,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
String shapeTextStr =java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction(SHAPE_TEXT_PROP));
|
||||
String shapeTextStr = System.getProperty(SHAPE_TEXT_PROP);
|
||||
|
||||
if (shapeTextStr != null) {
|
||||
shapeTextProp = true;
|
||||
@ -731,20 +727,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
||||
GraphicsEnvironment.getLocalGraphicsEnvironment().
|
||||
getDefaultScreenDevice().getDefaultConfiguration();
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
PrintService service = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<PrintService>() {
|
||||
public PrintService run() {
|
||||
PrintService service = getPrintService();
|
||||
if (service == null) {
|
||||
ServiceDialog.showNoPrintService(gc);
|
||||
return null;
|
||||
}
|
||||
return service;
|
||||
}
|
||||
});
|
||||
|
||||
PrintService service = getPrintService();
|
||||
if (service == null) {
|
||||
ServiceDialog.showNoPrintService(gc);
|
||||
return page;
|
||||
}
|
||||
updatePageAttributes(service, page);
|
||||
@ -812,20 +797,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
||||
}
|
||||
final GraphicsConfiguration gc = grCfg;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
PrintService service = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<PrintService>() {
|
||||
public PrintService run() {
|
||||
PrintService service = getPrintService();
|
||||
if (service == null) {
|
||||
ServiceDialog.showNoPrintService(gc);
|
||||
return null;
|
||||
}
|
||||
return service;
|
||||
}
|
||||
});
|
||||
|
||||
PrintService service = getPrintService();
|
||||
if (service == null) {
|
||||
ServiceDialog.showNoPrintService(gc);
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -953,7 +927,6 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
||||
* returns true.
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public boolean printDialog(final PrintRequestAttributeSet attributes)
|
||||
throws HeadlessException {
|
||||
if (GraphicsEnvironment.isHeadless()) {
|
||||
@ -1008,19 +981,9 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
||||
}
|
||||
final GraphicsConfiguration gc = grCfg;
|
||||
|
||||
PrintService service = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<PrintService>() {
|
||||
public PrintService run() {
|
||||
PrintService service = getPrintService();
|
||||
if (service == null) {
|
||||
ServiceDialog.showNoPrintService(gc);
|
||||
return null;
|
||||
}
|
||||
return service;
|
||||
}
|
||||
});
|
||||
|
||||
PrintService service = getPrintService();
|
||||
if (service == null) {
|
||||
ServiceDialog.showNoPrintService(gc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1033,13 +996,7 @@ public abstract class RasterPrinterJob extends PrinterJob {
|
||||
services[i] = spsFactories[i].getPrintService(null);
|
||||
}
|
||||
} else {
|
||||
services = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<PrintService[]>() {
|
||||
public PrintService[] run() {
|
||||
PrintService[] services = PrinterJob.lookupPrintServices();
|
||||
return services;
|
||||
}
|
||||
});
|
||||
services = PrinterJob.lookupPrintServices();
|
||||
|
||||
if ((services == null) || (services.length == 0)) {
|
||||
/*
|
||||
|
@ -448,21 +448,13 @@ public class ServiceDialog extends JDialog implements ActionListener {
|
||||
/**
|
||||
* Initialize ResourceBundle
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static void initResource() {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
try {
|
||||
messageRB = ResourceBundle.getBundle(strBundle);
|
||||
return null;
|
||||
} catch (java.util.MissingResourceException e) {
|
||||
throw new Error("Fatal: Resource for ServiceUI " +
|
||||
"is missing");
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
try {
|
||||
messageRB = ResourceBundle.getBundle(strBundle);
|
||||
} catch (java.util.MissingResourceException e) {
|
||||
throw new Error("Fatal: Resource for ServiceUI " +
|
||||
"is missing");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -542,15 +534,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
|
||||
* Returns URL for image resource
|
||||
*/
|
||||
private static URL getImageResource(final String key) {
|
||||
@SuppressWarnings("removal")
|
||||
URL url = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<URL>() {
|
||||
public URL run() {
|
||||
URL url = ServiceDialog.class.getResource(
|
||||
"resources/" + key);
|
||||
return url;
|
||||
}
|
||||
});
|
||||
URL url = ServiceDialog.class.getResource("resources/" + key);
|
||||
|
||||
if (url == null) {
|
||||
throw new Error("Fatal: Resource for ServiceUI is broken; " +
|
||||
@ -2943,14 +2927,7 @@ public class ServiceDialog extends JDialog implements ActionListener {
|
||||
{
|
||||
super(new FlowLayout(FlowLayout.LEADING));
|
||||
final URL imgURL = getImageResource(img);
|
||||
@SuppressWarnings("removal")
|
||||
Icon icon = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Icon>() {
|
||||
public Icon run() {
|
||||
Icon icon = new ImageIcon(imgURL);
|
||||
return icon;
|
||||
}
|
||||
});
|
||||
Icon icon = new ImageIcon(imgURL);
|
||||
lbl = new JLabel(icon);
|
||||
add(lbl);
|
||||
|
||||
|
@ -40,7 +40,6 @@ import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.security.AccessController;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import javax.swing.JLayeredPane;
|
||||
@ -55,7 +54,6 @@ import sun.awt.AWTAccessor;
|
||||
import sun.awt.DisplayChangedListener;
|
||||
import sun.awt.LightweightFrame;
|
||||
import sun.awt.OverrideNativeWindowHandle;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.swing.SwingUtilities2.RepaintListener;
|
||||
|
||||
/**
|
||||
@ -105,24 +103,21 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
|
||||
* by the lock (managed with the {@link LightweightContent#paintLock()},
|
||||
* {@link LightweightContent#paintUnlock()} methods).
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static boolean copyBufferEnabled = "true".equals(AccessController.
|
||||
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
|
||||
private static boolean copyBufferEnabled = "true".equals(
|
||||
System.getProperty("swing.jlf.copyBufferEnabled", "true"));
|
||||
private int[] copyBuffer;
|
||||
|
||||
/**
|
||||
* Constructs a new, initially invisible {@code JLightweightFrame}
|
||||
* instance.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public JLightweightFrame() {
|
||||
super();
|
||||
AffineTransform defaultTransform =
|
||||
getGraphicsConfiguration().getDefaultTransform();
|
||||
scaleFactorX = defaultTransform.getScaleX();
|
||||
scaleFactorY = defaultTransform.getScaleY();
|
||||
copyBufferEnabled = "true".equals(AccessController.
|
||||
doPrivileged(new GetPropertyAction("swing.jlf.copyBufferEnabled", "true")));
|
||||
copyBufferEnabled = "true".equals(System.getProperty("swing.jlf.copyBufferEnabled", "true"));
|
||||
|
||||
add(rootPane, BorderLayout.CENTER);
|
||||
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy());
|
||||
@ -331,7 +326,6 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
|
||||
content.imageUpdated(x, y, width, height);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private void initInterior() {
|
||||
contentPane = new JPanel() {
|
||||
@Override
|
||||
@ -392,8 +386,7 @@ public final class JLightweightFrame extends LightweightFrame implements RootPan
|
||||
contentPane.add(component);
|
||||
contentPane.revalidate();
|
||||
contentPane.repaint();
|
||||
if ("true".equals(AccessController.
|
||||
doPrivileged(new GetPropertyAction("swing.jlf.contentPaneTransparent", "false"))))
|
||||
if ("true".equals(System.getProperty("swing.jlf.contentPaneTransparent", "false")))
|
||||
{
|
||||
contentPane.setOpaque(false);
|
||||
}
|
||||
|
@ -61,8 +61,6 @@ import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
import java.text.BreakIterator;
|
||||
@ -1706,10 +1704,8 @@ public class SwingUtilities2 {
|
||||
final String imageFile,
|
||||
final boolean enablePrivileges) {
|
||||
return (UIDefaults.LazyValue) (table) -> {
|
||||
@SuppressWarnings("removal")
|
||||
byte[] buffer = enablePrivileges ? AccessController.doPrivileged(
|
||||
(PrivilegedAction<byte[]>) ()
|
||||
-> getIconBytes(baseClass, rootClass, imageFile))
|
||||
byte[] buffer = enablePrivileges ?
|
||||
getIconBytes(baseClass, rootClass, imageFile)
|
||||
: getIconBytes(baseClass, rootClass, imageFile);
|
||||
|
||||
if (buffer == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user