8304912: Use OperatingSystem enum in java.desktop module
Reviewed-by: bpb, prr, aturbanov
This commit is contained in:
parent
1fd400608e
commit
30a140b5a2
src/java.desktop
share/classes
com/sun/media/sound
javax/swing
sun
unix/classes/sun
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2023, 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
|
||||
@ -25,6 +25,8 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import sun.awt.OSInfo;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -679,8 +681,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
|
||||
actions.add(new PrivilegedAction<InputStream>() {
|
||||
@Override
|
||||
public InputStream run() {
|
||||
if (System.getProperties().getProperty("os.name")
|
||||
.startsWith("Linux")) {
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.LINUX) {
|
||||
|
||||
File[] systemSoundFontsDir = new File[] {
|
||||
/* Arch, Fedora, Mageia */
|
||||
@ -714,8 +715,7 @@ public final class SoftSynthesizer implements AudioSynthesizer,
|
||||
actions.add(new PrivilegedAction<InputStream>() {
|
||||
@Override
|
||||
public InputStream run() {
|
||||
if (System.getProperties().getProperty("os.name")
|
||||
.startsWith("Windows")) {
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
|
||||
File gm_dls = new File(System.getenv("SystemRoot")
|
||||
+ "\\system32\\drivers\\gm.dls");
|
||||
if (gm_dls.isFile()) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2023, 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
|
||||
@ -39,7 +39,6 @@ import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.security.AccessController;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -289,8 +288,7 @@ public class PopupFactory {
|
||||
return getMediumWeightPopup(owner, contents, ownerX, ownerY);
|
||||
case HEAVY_WEIGHT_POPUP:
|
||||
Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
|
||||
if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
|
||||
OSInfo.OSType.MACOSX) && (owner != null) &&
|
||||
if ((OSInfo.getOSType() == OSInfo.OSType.MACOSX) && (owner != null) &&
|
||||
(EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
|
||||
((HeavyWeightPopup)popup).setCacheEnabled(false);
|
||||
}
|
||||
@ -1030,4 +1028,3 @@ public class PopupFactory {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, 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
|
||||
@ -380,8 +380,7 @@ public class UIManager implements Serializable
|
||||
"com.sun.java.swing.plaf.motif.MotifLookAndFeel"));
|
||||
|
||||
// Only include windows on Windows boxes.
|
||||
@SuppressWarnings("removal")
|
||||
OSInfo.OSType osType = AccessController.doPrivileged(OSInfo.getOSTypeAction());
|
||||
OSInfo.OSType osType = OSInfo.getOSType();
|
||||
if (osType == OSInfo.OSType.WINDOWS) {
|
||||
iLAFs.add(new LookAndFeelInfo("Windows",
|
||||
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"));
|
||||
@ -659,8 +658,7 @@ public class UIManager implements Serializable
|
||||
if (systemLAF != null) {
|
||||
return systemLAF;
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
OSInfo.OSType osType = AccessController.doPrivileged(OSInfo.getOSTypeAction());
|
||||
OSInfo.OSType osType = OSInfo.getOSType();
|
||||
if (osType == OSInfo.OSType.WINDOWS) {
|
||||
return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
|
||||
} else {
|
||||
@ -1289,8 +1287,7 @@ public class UIManager implements Serializable
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
OSInfo.OSType osType = AccessController.doPrivileged(OSInfo.getOSTypeAction());
|
||||
if (osType == OSInfo.OSType.MACOSX) {
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
|
||||
props.put(defaultLAFKey, getSystemLookAndFeelClassName());
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, 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
|
||||
@ -118,9 +118,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
|
||||
*/
|
||||
static boolean isWindows() {
|
||||
if (!checkedWindows) {
|
||||
@SuppressWarnings("removal")
|
||||
OSInfo.OSType osType = AccessController.doPrivileged(OSInfo.getOSTypeAction());
|
||||
if (osType == OSInfo.OSType.WINDOWS) {
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
|
||||
isWindows = true;
|
||||
@SuppressWarnings("removal")
|
||||
String systemFonts = AccessController.doPrivileged(
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2023, 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
|
||||
@ -34,7 +34,6 @@ import javax.swing.plaf.synth.SynthLookAndFeel;
|
||||
import javax.swing.plaf.synth.SynthStyle;
|
||||
import javax.swing.plaf.synth.SynthStyleFactory;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import java.security.AccessController;
|
||||
import java.awt.Color;
|
||||
import java.awt.Container;
|
||||
import java.awt.Graphics2D;
|
||||
@ -49,11 +48,12 @@ import javax.swing.JToolBar;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.plaf.BorderUIResource;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
|
||||
import sun.awt.OSInfo;
|
||||
import sun.swing.ImageIconUIResource;
|
||||
import javax.swing.plaf.synth.SynthIcon;
|
||||
import sun.swing.plaf.GTKKeybindings;
|
||||
import sun.swing.plaf.WindowsKeybindings;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
* <p>The NimbusLookAndFeel class.</p>
|
||||
@ -130,8 +130,7 @@ public class NimbusLookAndFeel extends SynthLookAndFeel {
|
||||
@Override public UIDefaults getDefaults() {
|
||||
if (uiDefaults == null){
|
||||
// Detect platform
|
||||
String osName = getSystemProperty("os.name");
|
||||
boolean isWindows = osName != null && osName.contains("Windows");
|
||||
boolean isWindows = OSInfo.getOSType() == OSInfo.OSType.WINDOWS;
|
||||
|
||||
// We need to call super for basic's properties file.
|
||||
uiDefaults = super.getDefaults();
|
||||
@ -349,14 +348,6 @@ public class NimbusLookAndFeel extends SynthLookAndFeel {
|
||||
defaults.register(region, prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple utility method that reads system keys.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private String getSystemProperty(String key) {
|
||||
return AccessController.doPrivileged(new GetPropertyAction(key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getDisabledIcon(JComponent component, Icon icon) {
|
||||
if (icon instanceof SynthIcon) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2023, 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
|
||||
@ -1367,23 +1367,13 @@ public abstract class FontConfiguration {
|
||||
private static void sanityCheck() {
|
||||
int errors = 0;
|
||||
|
||||
//This method will only be called during build time, do we
|
||||
//need do PrivilegedAction?
|
||||
@SuppressWarnings("removal")
|
||||
String osName = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
return System.getProperty("os.name");
|
||||
}
|
||||
});
|
||||
|
||||
//componentFontNameID starts from "1"
|
||||
for (int ii = 1; ii < table_filenames.length; ii++) {
|
||||
if (table_filenames[ii] == -1) {
|
||||
// The corresponding finename entry for a component
|
||||
// font name is mandatory on Windows, but it's
|
||||
// optional on Solaris and Linux.
|
||||
if (osName.contains("Windows")) {
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
|
||||
System.err.println("\n Error: <filename."
|
||||
+ getString(table_componentFontNameIDs[ii])
|
||||
+ "> entry is missing!!!");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, 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
|
||||
@ -25,7 +25,8 @@
|
||||
|
||||
package sun.awt;
|
||||
|
||||
import java.security.PrivilegedAction;
|
||||
import jdk.internal.util.OperatingSystem;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -58,11 +59,14 @@ public class OSInfo {
|
||||
public static final WindowsVersion WINDOWS_VISTA = new WindowsVersion(6, 0);
|
||||
public static final WindowsVersion WINDOWS_7 = new WindowsVersion(6, 1);
|
||||
|
||||
private static final String OS_NAME = "os.name";
|
||||
private static final String OS_VERSION = "os.version";
|
||||
|
||||
private static final Map<String, WindowsVersion> windowsVersionMap = new HashMap<String, OSInfo.WindowsVersion>();
|
||||
|
||||
// Cache the OSType for getOSType()
|
||||
private static final OSType CURRENT_OSTYPE = getOSTypeImpl(); // No DoPriv needed
|
||||
|
||||
|
||||
static {
|
||||
windowsVersionMap.put(WINDOWS_95.toString(), WINDOWS_95);
|
||||
windowsVersionMap.put(WINDOWS_98.toString(), WINDOWS_98);
|
||||
@ -74,12 +78,6 @@ public class OSInfo {
|
||||
windowsVersionMap.put(WINDOWS_7.toString(), WINDOWS_7);
|
||||
}
|
||||
|
||||
private static final PrivilegedAction<OSType> osTypeAction = new PrivilegedAction<OSType>() {
|
||||
public OSType run() {
|
||||
return getOSType();
|
||||
}
|
||||
};
|
||||
|
||||
private OSInfo() {
|
||||
// Don't allow to create instances
|
||||
}
|
||||
@ -87,34 +85,20 @@ public class OSInfo {
|
||||
/**
|
||||
* Returns type of operating system.
|
||||
*/
|
||||
public static OSType getOSType() throws SecurityException {
|
||||
String osName = System.getProperty(OS_NAME);
|
||||
|
||||
if (osName != null) {
|
||||
if (osName.contains("Windows")) {
|
||||
return WINDOWS;
|
||||
}
|
||||
|
||||
if (osName.contains("Linux")) {
|
||||
return LINUX;
|
||||
}
|
||||
|
||||
if (osName.contains("OS X")) {
|
||||
return MACOSX;
|
||||
}
|
||||
|
||||
if (osName.contains("AIX")) {
|
||||
return AIX;
|
||||
}
|
||||
|
||||
// determine another OS here
|
||||
}
|
||||
|
||||
return UNKNOWN;
|
||||
public static OSType getOSType() {
|
||||
return CURRENT_OSTYPE;
|
||||
}
|
||||
|
||||
public static PrivilegedAction<OSType> getOSTypeAction() {
|
||||
return osTypeAction;
|
||||
private static OSType getOSTypeImpl() {
|
||||
OperatingSystem os = OperatingSystem.current();
|
||||
return switch (os) {
|
||||
// Map OperatingSystem enum values to OSType enum values.
|
||||
case WINDOWS -> WINDOWS;
|
||||
case LINUX -> LINUX;
|
||||
case MACOS -> MACOSX;
|
||||
case AIX -> AIX;
|
||||
default -> UNKNOWN;
|
||||
};
|
||||
}
|
||||
|
||||
public static WindowsVersion getWindowsVersion() throws SecurityException {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, 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
|
||||
@ -93,8 +93,6 @@ public class ImagingLib {
|
||||
PrivilegedAction<Boolean> doMlibInitialization =
|
||||
new PrivilegedAction<Boolean>() {
|
||||
public Boolean run() {
|
||||
String arch = System.getProperty("os.arch");
|
||||
|
||||
try {
|
||||
System.loadLibrary("mlib_image");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2023, 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
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
package sun.font;
|
||||
|
||||
import sun.java2d.SunGraphicsEnvironment;
|
||||
import sun.awt.OSInfo;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public class FontManagerNativeLibrary {
|
||||
@ -35,7 +35,7 @@ public class FontManagerNativeLibrary {
|
||||
public Object run() {
|
||||
/* REMIND do we really have to load awt here? */
|
||||
System.loadLibrary("awt");
|
||||
if (System.getProperty("os.name").startsWith("Windows")) {
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.WINDOWS) {
|
||||
/* Ideally fontmanager library should not depend on
|
||||
particular implementation of the font scaler.
|
||||
However, freetype scaler is basically small wrapper on
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2023, 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
|
||||
@ -33,6 +33,7 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import javax.swing.plaf.FontUIResource;
|
||||
|
||||
import sun.awt.OSInfo;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
/**
|
||||
@ -64,11 +65,10 @@ public final class FontUtilities {
|
||||
@SuppressWarnings("deprecation") // PlatformLogger.setLevel is deprecated.
|
||||
@Override
|
||||
public Object run() {
|
||||
String osName = System.getProperty("os.name", "unknownOS");
|
||||
|
||||
isLinux = osName.startsWith("Linux");
|
||||
isLinux = OSInfo.getOSType() == OSInfo.OSType.LINUX;
|
||||
|
||||
isMacOSX = osName.contains("OS X"); // TODO: MacOSX
|
||||
isMacOSX = OSInfo.getOSType() == OSInfo.OSType.MACOSX;
|
||||
if (isMacOSX) {
|
||||
// os.version has values like 10.13.6, 10.14.6
|
||||
// If it is not positively recognised as 10.13 or less,
|
||||
@ -100,7 +100,7 @@ public final class FontUtilities {
|
||||
} else {
|
||||
useJDKScaler = false;
|
||||
}
|
||||
isWindows = osName.startsWith("Windows");
|
||||
isWindows = OSInfo.getOSType() == OSInfo.OSType.WINDOWS;
|
||||
String debugLevel =
|
||||
System.getProperty("sun.java2d.debugfonts");
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, 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
|
||||
@ -82,6 +82,7 @@ import java.util.Properties;
|
||||
|
||||
import sun.awt.CharsetString;
|
||||
import sun.awt.FontConfiguration;
|
||||
import sun.awt.OSInfo;
|
||||
import sun.awt.PlatformFont;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.font.FontAccess;
|
||||
@ -344,8 +345,7 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
mFontProps = initProps();
|
||||
String osName = System.getProperty("os.name");
|
||||
isMac = osName.startsWith("Mac");
|
||||
isMac = OSInfo.getOSType() == OSInfo.OSType.MACOSX;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@ -1623,8 +1623,8 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
ncomps+=1; // for jobsheet
|
||||
}
|
||||
|
||||
String osname = System.getProperty("os.name");
|
||||
if (osname.equals("Linux") || osname.contains("OS X")) {
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.LINUX ||
|
||||
OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
|
||||
execCmd = new String[ncomps];
|
||||
execCmd[n++] = "/usr/bin/lpr";
|
||||
if ((pFlags & PRINTER) != 0) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2023, 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
|
||||
@ -27,8 +27,6 @@ package sun.awt.X11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import java.security.AccessController;
|
||||
import sun.awt.OSInfo;
|
||||
|
||||
/**
|
||||
@ -636,9 +634,8 @@ class MotifColorUtilities {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static void loadSystemColors(int[] systemColors) {
|
||||
if ("Linux".equals(AccessController.doPrivileged(new GetPropertyAction("os.name")))) { // Load motif default colors on Linux.
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.LINUX) { // Load motif default colors on Linux.
|
||||
loadMotifDefaultColors(systemColors);
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2023, 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
|
||||
@ -28,6 +28,8 @@ package sun.awt.X11;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.peer.*;
|
||||
|
||||
import sun.awt.OSInfo;
|
||||
import sun.util.logging.PlatformLogger;
|
||||
|
||||
class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbarClient {
|
||||
@ -75,7 +77,7 @@ class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbar
|
||||
* Currently uses hardcoded values
|
||||
*/
|
||||
private int getDefaultDimension() {
|
||||
if (System.getProperty("os.name").equals("Linux")) {
|
||||
if (OSInfo.getOSType() == OSInfo.OSType.LINUX) {
|
||||
return DEFAULT_WIDTH_LINUX;
|
||||
} else {
|
||||
return DEFAULT_WIDTH_SOLARIS;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2023, 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
|
||||
@ -53,6 +53,7 @@ import java.io.FileReader;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
|
||||
import sun.awt.OSInfo;
|
||||
import sun.awt.util.ThreadGroupUtils;
|
||||
|
||||
/*
|
||||
@ -76,10 +77,6 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
|
||||
private static final int DEFAULT_MINREFRESH = 120; // 2 minutes
|
||||
private static int minRefreshTime = DEFAULT_MINREFRESH;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static String osname = java.security.AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("os.name"));
|
||||
|
||||
// List of commands used to deal with the printer queues on AIX
|
||||
String[] lpNameComAix = {
|
||||
"/usr/bin/lsallq",
|
||||
@ -150,20 +147,20 @@ public class PrintServiceLookupProvider extends PrintServiceLookup
|
||||
}
|
||||
|
||||
static boolean isMac() {
|
||||
return osname.startsWith("Mac");
|
||||
return OSInfo.getOSType() == OSInfo.OSType.MACOSX;
|
||||
}
|
||||
|
||||
static boolean isLinux() {
|
||||
return (osname.equals("Linux"));
|
||||
return OSInfo.getOSType() == OSInfo.OSType.LINUX;
|
||||
}
|
||||
|
||||
static boolean isBSD() {
|
||||
return (osname.equals("Linux") ||
|
||||
osname.contains("OS X"));
|
||||
return (OSInfo.getOSType() == OSInfo.OSType.LINUX ||
|
||||
OSInfo.getOSType() == OSInfo.OSType.MACOSX);
|
||||
}
|
||||
|
||||
static boolean isAIX() {
|
||||
return osname.equals("AIX");
|
||||
return OSInfo.getOSType() == OSInfo.OSType.AIX;
|
||||
}
|
||||
|
||||
static final int UNINITIALIZED = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user