java.nio.channels.spi.AsynchronousChannelProvider#sun.security.action.GetPropertyAction源码实例Demo

下面列出了java.nio.channels.spi.AsynchronousChannelProvider#sun.security.action.GetPropertyAction 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u-jdk   文件: Debug.java
/**
 * Return the value of the boolean System property propName.
 *
 * Note use of doPrivileged(). Do make accessible to applications.
 */
static boolean getBooleanProperty(String propName, boolean defaultValue) {
    // if set, require value of either true or false
    String b = AccessController.doPrivileged(
            new GetPropertyAction(propName));
    if (b == null) {
        return defaultValue;
    } else if (b.equalsIgnoreCase("false")) {
        return false;
    } else if (b.equalsIgnoreCase("true")) {
        return true;
    } else {
        throw new RuntimeException("Value of " + propName
            + " must either be 'true' or 'false'");
    }
}
 
源代码2 项目: openjdk-jdk9   文件: Locale.java
private static Locale initDefault() {
    String language, region, script, country, variant;
    Properties props = GetPropertyAction.privilegedGetProperties();
    language = props.getProperty("user.language", "en");
    // for compatibility, check for old user.region property
    region = props.getProperty("user.region");
    if (region != null) {
        // region can be of form country, country_variant, or _variant
        int i = region.indexOf('_');
        if (i >= 0) {
            country = region.substring(0, i);
            variant = region.substring(i + 1);
        } else {
            country = region;
            variant = "";
        }
        script = "";
    } else {
        script = props.getProperty("user.script", "");
        country = props.getProperty("user.country", "");
        variant = props.getProperty("user.variant", "");
    }

    return getInstance(language, script, country, variant, null);
}
 
源代码3 项目: hottub   文件: WindowsFileSystem.java
WindowsFileSystem(WindowsFileSystemProvider provider,
                  String dir)
{
    this.provider = provider;

    // parse default directory and check it is absolute
    WindowsPathParser.Result result = WindowsPathParser.parse(dir);

    if ((result.type() != WindowsPathType.ABSOLUTE) &&
        (result.type() != WindowsPathType.UNC))
        throw new AssertionError("Default directory is not an absolute path");
    this.defaultDirectory = result.path();
    this.defaultRoot = result.root();

    PrivilegedAction<String> pa = new GetPropertyAction("os.version");
    String osversion = AccessController.doPrivileged(pa);
    String[] vers = Util.split(osversion, '.');
    int major = Integer.parseInt(vers[0]);
    int minor = Integer.parseInt(vers[1]);

    // symbolic links available on Vista and newer
    supportsLinks = (major >= 6);

    // enumeration of data streams available on Windows Server 2003 and newer
    supportsStreamEnumeration = (major >= 6) || (major == 5 && minor >= 2);
}
 
源代码4 项目: jdk8u-dev-jdk   文件: JRSUIUtils.java
static boolean currentMacOSXVersionMatchesGivenVersionRange(final int version, final boolean inclusive, final boolean matchBelow, final boolean matchAbove) {
    // split the "10.x.y" version number
    String osVersion = AccessController.doPrivileged(new GetPropertyAction("os.version"));
    String[] fragments = osVersion.split("\\.");

    // sanity check the "10." part of the version
    if (!fragments[0].equals("10")) return false;
    if (fragments.length < 2) return false;

    // check if os.version matches the given version using the given match method
    try {
        int minorVers = Integer.parseInt(fragments[1]);

        if (inclusive && minorVers == version) return true;
        if (matchBelow && minorVers < version) return true;
        if (matchAbove && minorVers > version) return true;

    } catch (NumberFormatException e) {
        // was not an integer
    }
    return false;
}
 
源代码5 项目: jdk8u-dev-jdk   文件: Window.java
private void setWarningString() {
    warningString = null;
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        try {
            sm.checkPermission(SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION);
        } catch (SecurityException se) {
            // make sure the privileged action is only
            // for getting the property! We don't want the
            // above checkPermission call to always succeed!
            warningString = AccessController.doPrivileged(
                  new GetPropertyAction("awt.appletWarning",
                                        "Java Applet Window"));
        }
    }
}
 
源代码6 项目: openjdk-jdk8u   文件: JRSUIUtils.java
static boolean currentMacOSXVersionMatchesGivenVersionRange(final int version, final boolean inclusive, final boolean matchBelow, final boolean matchAbove) {
    // split the "10.x.y" version number
    String osVersion = AccessController.doPrivileged(new GetPropertyAction("os.version"));
    String[] fragments = osVersion.split("\\.");

    // sanity check the "10." part of the version
    if (!fragments[0].equals("10")) return false;
    if (fragments.length < 2) return false;

    // check if os.version matches the given version using the given match method
    try {
        int minorVers = Integer.parseInt(fragments[1]);

        if (inclusive && minorVers == version) return true;
        if (matchBelow && minorVers < version) return true;
        if (matchAbove && minorVers > version) return true;

    } catch (NumberFormatException e) {
        // was not an integer
    }
    return false;
}
 
源代码7 项目: openjdk-8   文件: GSSUtil.java
/**
 * Determines if the application doesn't mind if the mechanism obtains
 * the required credentials from outside of the current Subject. Our
 * Kerberos v5 mechanism would do a JAAS login on behalf of the
 * application if this were the case.
 *
 * The application indicates this by explicitly setting the system
 * property javax.security.auth.useSubjectCredsOnly to false.
 */
public static boolean useSubjectCredsOnly(GSSCaller caller) {

    // HTTP/SPNEGO doesn't use the standard JAAS framework. Instead, it
    // uses the java.net.Authenticator style, therefore always return
    // false here.
    if (caller instanceof HttpCaller) {
        return false;
    }
    /*
     * Don't use GetBooleanAction because the default value in the JRE
     * (when this is unset) has to treated as true.
     */
    String propValue = AccessController.doPrivileged(
            new GetPropertyAction("javax.security.auth.useSubjectCredsOnly",
            "true"));
    /*
     * This property has to be explicitly set to "false". Invalid
     * values should be ignored and the default "true" assumed.
     */
    return (!propValue.equalsIgnoreCase("false"));
}
 
源代码8 项目: openjdk-jdk9   文件: GSSUtil.java
/**
 * Determines if the application doesn't mind if the mechanism obtains
 * the required credentials from outside of the current Subject. Our
 * Kerberos v5 mechanism would do a JAAS login on behalf of the
 * application if this were the case.
 *
 * The application indicates this by explicitly setting the system
 * property javax.security.auth.useSubjectCredsOnly to false.
 */
public static boolean useSubjectCredsOnly(GSSCaller caller) {

    // HTTP/SPNEGO doesn't use the standard JAAS framework. Instead, it
    // uses the java.net.Authenticator style, therefore always return
    // false here.
    if (caller instanceof HttpCaller) {
        return false;
    }
    /*
     * Don't use GetBooleanAction because the default value in the JRE
     * (when this is unset) has to treated as true.
     */
    String propValue = AccessController.doPrivileged(
            new GetPropertyAction("javax.security.auth.useSubjectCredsOnly",
            "true"));
    /*
     * This property has to be explicitly set to "false". Invalid
     * values should be ignored and the default "true" assumed.
     */
    return (!propValue.equalsIgnoreCase("false"));
}
 
源代码9 项目: jdk8u60   文件: Util.java
static boolean atBugLevel(String bl) {              // package-private
    if (bugLevel == null) {
        if (!sun.misc.VM.isBooted())
            return false;
        String value = AccessController.doPrivileged(
            new GetPropertyAction("sun.nio.ch.bugLevel"));
        bugLevel = (value != null) ? value : "";
    }
    return bugLevel.equals(bl);
}
 
源代码10 项目: jdk1.8-source-analysis   文件: Locale.java
private static Locale initDefault() {
    String language, region, script, country, variant;
    language = AccessController.doPrivileged(
        new GetPropertyAction("user.language", "en"));
    // for compatibility, check for old user.region property
    region = AccessController.doPrivileged(
        new GetPropertyAction("user.region"));
    if (region != null) {
        // region can be of form country, country_variant, or _variant
        int i = region.indexOf('_');
        if (i >= 0) {
            country = region.substring(0, i);
            variant = region.substring(i + 1);
        } else {
            country = region;
            variant = "";
        }
        script = "";
    } else {
        script = AccessController.doPrivileged(
            new GetPropertyAction("user.script", ""));
        country = AccessController.doPrivileged(
            new GetPropertyAction("user.country", ""));
        variant = AccessController.doPrivileged(
            new GetPropertyAction("user.variant", ""));
    }

    return getInstance(language, script, country, variant, null);
}
 
源代码11 项目: JDKSourceCode1.8   文件: Charset.java
static boolean atBugLevel(String bl) {              // package-private
    String level = bugLevel;
    if (level == null) {
        if (!sun.misc.VM.isBooted())
            return false;
        bugLevel = level = AccessController.doPrivileged(
            new GetPropertyAction("sun.nio.cs.bugLevel", ""));
    }
    return level.equals(bl);
}
 
源代码12 项目: jdk8u_jdk   文件: Locale.java
private static Locale initDefault(Locale.Category category) {
    return getInstance(
        AccessController.doPrivileged(
            new GetPropertyAction(category.languageKey, defaultLocale.getLanguage())),
        AccessController.doPrivileged(
            new GetPropertyAction(category.scriptKey, defaultLocale.getScript())),
        AccessController.doPrivileged(
            new GetPropertyAction(category.countryKey, defaultLocale.getCountry())),
        AccessController.doPrivileged(
            new GetPropertyAction(category.variantKey, defaultLocale.getVariant())),
        null);
}
 
源代码13 项目: jdk1.8-source-analysis   文件: SwingUtilities.java
/**
 * Returns true if <code>setTransferHandler</code> should change the
 * <code>DropTarget</code>.
 */
private static boolean getSuppressDropTarget() {
    if (!checkedSuppressDropSupport) {
        suppressDropSupport = Boolean.valueOf(
            AccessController.doPrivileged(
                new GetPropertyAction("suppressSwingDropSupport")));
        checkedSuppressDropSupport = true;
    }
    return suppressDropSupport;
}
 
源代码14 项目: jdk1.8-source-analysis   文件: UIManager.java
/**
 * Returns the name of the <code>LookAndFeel</code> class that implements
 * the native system look and feel if there is one, otherwise
 * the name of the default cross platform <code>LookAndFeel</code>
 * class. This value can be overriden by setting the
 * <code>swing.systemlaf</code> system property.
 *
 * @return the <code>String</code> of the <code>LookAndFeel</code>
 *          class
 *
 * @see #setLookAndFeel
 * @see #getCrossPlatformLookAndFeelClassName
 */
public static String getSystemLookAndFeelClassName() {
    String systemLAF = AccessController.doPrivileged(
                         new GetPropertyAction("swing.systemlaf"));
    if (systemLAF != null) {
        return systemLAF;
    }
    OSInfo.OSType osType = AccessController.doPrivileged(OSInfo.getOSTypeAction());
    if (osType == OSInfo.OSType.WINDOWS) {
        return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    } else {
        String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        if ("gnome".equals(desktop) &&
                toolkit instanceof SunToolkit &&
                ((SunToolkit) toolkit).isNativeGTKAvailable()) {
            // May be set on Linux and Solaris boxs.
            return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
        }
        if (osType == OSInfo.OSType.MACOSX) {
            if (toolkit.getClass() .getName()
                                   .equals("sun.lwawt.macosx.LWCToolkit")) {
                return "com.apple.laf.AquaLookAndFeel";
            }
        }
        if (osType == OSInfo.OSType.SOLARIS) {
            return "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
        }
    }
    return getCrossPlatformLookAndFeelClassName();
}
 
源代码15 项目: TencentKona-8   文件: SunToolkit.java
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"));
        }
        if (systemAAFonts != null) {
            useSystemAAFontSettings =
                Boolean.valueOf(systemAAFonts).booleanValue();
            /* If it is anything other than "true", then it may be
             * a hint name , or it may be "off, "default", etc.
             */
            if (!useSystemAAFontSettings) {
                desktopFontHints = getDesktopAAHintsByName(systemAAFonts);
            }
        }
        /* If its still true, apply the extra condition */
        if (useSystemAAFontSettings) {
             useSystemAAFontSettings = lastExtraCondition;
        }
        checkedSystemAAFontSettings = true;
    }
    return useSystemAAFontSettings;
}
 
源代码16 项目: JDKSourceCode1.8   文件: Locale.java
private static Locale initDefault() {
    String language, region, script, country, variant;
    language = AccessController.doPrivileged(
        new GetPropertyAction("user.language", "en"));
    // for compatibility, check for old user.region property
    region = AccessController.doPrivileged(
        new GetPropertyAction("user.region"));
    if (region != null) {
        // region can be of form country, country_variant, or _variant
        int i = region.indexOf('_');
        if (i >= 0) {
            country = region.substring(0, i);
            variant = region.substring(i + 1);
        } else {
            country = region;
            variant = "";
        }
        script = "";
    } else {
        script = AccessController.doPrivileged(
            new GetPropertyAction("user.script", ""));
        country = AccessController.doPrivileged(
            new GetPropertyAction("user.country", ""));
        variant = AccessController.doPrivileged(
            new GetPropertyAction("user.variant", ""));
    }

    return getInstance(language, script, country, variant, null);
}
 
源代码17 项目: jdk8u-jdk   文件: Charset.java
/**
 * Returns the default charset of this Java virtual machine.
 *
 * <p> The default charset is determined during virtual-machine startup and
 * typically depends upon the locale and charset of the underlying
 * operating system.
 *
 * @return  A charset object for the default charset
 *
 * @since 1.5
 */
public static Charset defaultCharset() {
    if (defaultCharset == null) {
        synchronized (Charset.class) {
            String csn = AccessController.doPrivileged(
                new GetPropertyAction("file.encoding"));
            Charset cs = lookup(csn);
            if (cs != null)
                defaultCharset = cs;
            else
                defaultCharset = forName("UTF-8");
        }
    }
    return defaultCharset;
}
 
源代码18 项目: TencentKona-8   文件: UnixFileSystem.java
UnixFileSystem(UnixFileSystemProvider provider, String dir) {
    this.provider = provider;
    this.defaultDirectory = Util.toBytes(UnixPath.normalizeAndCheck(dir));
    if (this.defaultDirectory[0] != '/') {
        throw new RuntimeException("default directory must be absolute");
    }

    // if process-wide chdir is allowed or default directory is not the
    // process working directory then paths must be resolved against the
    // default directory.
    String propValue = AccessController.doPrivileged(
        new GetPropertyAction("sun.nio.fs.chdirAllowed", "false"));
    boolean chdirAllowed = (propValue.length() == 0) ?
        true : Boolean.valueOf(propValue);
    if (chdirAllowed) {
        this.needToResolveAgainstDefaultDirectory = true;
    } else {
        byte[] cwd = UnixNativeDispatcher.getcwd();
        boolean defaultIsCwd = (cwd.length == defaultDirectory.length);
        if (defaultIsCwd) {
            for (int i=0; i<cwd.length; i++) {
                if (cwd[i] != defaultDirectory[i]) {
                    defaultIsCwd = false;
                    break;
                }
            }
        }
        this.needToResolveAgainstDefaultDirectory = !defaultIsCwd;
    }

    // the root directory
    this.rootDirectory = new UnixPath(this, "/");
}
 
源代码19 项目: jdk8u-jdk   文件: Charset.java
/**
 * Returns the default charset of this Java virtual machine.
 *
 * <p> The default charset is determined during virtual-machine startup and
 * typically depends upon the locale and charset of the underlying
 * operating system.
 *
 * @return  A charset object for the default charset
 *
 * @since 1.5
 */
public static Charset defaultCharset() {
    if (defaultCharset == null) {
        synchronized (Charset.class) {
            String csn = AccessController.doPrivileged(
                new GetPropertyAction("file.encoding"));
            Charset cs = lookup(csn);
            if (cs != null)
                defaultCharset = cs;
            else
                defaultCharset = forName("UTF-8");
        }
    }
    return defaultCharset;
}
 
源代码20 项目: TencentKona-8   文件: SolarisFileSystemProvider.java
@Override
FileTypeDetector getFileTypeDetector() {
    Path userMimeTypes = Paths.get(AccessController.doPrivileged(
        new GetPropertyAction("user.home")), ".mime.types");
    Path etcMimeTypes = Paths.get("/etc/mime.types");

    return chain(new GnomeFileTypeDetector(),
                 new MimeTypesFileTypeDetector(userMimeTypes),
                 new MimeTypesFileTypeDetector(etcMimeTypes));
}
 
源代码21 项目: TencentKona-8   文件: JISAutoDetect.java
/**
 * Returned EUC-JP Charset name is OS dependent
 */

private static String getEUCJPName() {
    String osName = AccessController.doPrivileged(
        new GetPropertyAction("os.name"));
    if (osName.equals("Solaris") || osName.equals("SunOS"))
        return("x-eucjp-open");
    else
        return("EUC_JP");
}
 
源代码22 项目: jdk8u_jdk   文件: SunToolkit.java
/**
 * Returns the locale in which the runtime was started.
 */
public static Locale getStartupLocale() {
    if (startupLocale == null) {
        String language, region, country, variant;
        language = AccessController.doPrivileged(
                        new GetPropertyAction("user.language", "en"));
        // for compatibility, check for old user.region property
        region = AccessController.doPrivileged(
                        new GetPropertyAction("user.region"));
        if (region != null) {
            // region can be of form country, country_variant, or _variant
            int i = region.indexOf('_');
            if (i >= 0) {
                country = region.substring(0, i);
                variant = region.substring(i + 1);
            } else {
                country = region;
                variant = "";
            }
        } else {
            country = AccessController.doPrivileged(
                            new GetPropertyAction("user.country", ""));
            variant = AccessController.doPrivileged(
                            new GetPropertyAction("user.variant", ""));
        }
        startupLocale = new Locale(language, country, variant);
    }
    return startupLocale;
}
 
源代码23 项目: openjdk-8   文件: WindowsLookAndFeel.java
public void initialize() {
    super.initialize();

    // Set the flag which determines which version of Windows should
    // be rendered. This flag only need to be set once.
    // if version <= 4.0 then the classic LAF should be loaded.
    if (OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_95) <= 0) {
        isClassicWindows = true;
    } else {
        isClassicWindows = false;
        XPStyle.invalidateStyle();
    }

    // Using the fonts set by the user can potentially cause
    // performance and compatibility issues, so allow this feature
    // to be switched off either at runtime or programmatically
    //
    String systemFonts = java.security.AccessController.doPrivileged(
           new GetPropertyAction("swing.useSystemFontSettings"));
    useSystemFontSettings = (systemFonts == null ||
                             Boolean.valueOf(systemFonts).booleanValue());

    if (useSystemFontSettings) {
        Object value = UIManager.get("Application.useSystemFontSettings");

        useSystemFontSettings = (value == null ||
                                 Boolean.TRUE.equals(value));
    }
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
        addKeyEventPostProcessor(WindowsRootPaneUI.altProcessor);

}
 
源代码24 项目: openjdk-8-source   文件: UIManager.java
/**
 * Returns the name of the <code>LookAndFeel</code> class that implements
 * the native system look and feel if there is one, otherwise
 * the name of the default cross platform <code>LookAndFeel</code>
 * class. This value can be overriden by setting the
 * <code>swing.systemlaf</code> system property.
 *
 * @return the <code>String</code> of the <code>LookAndFeel</code>
 *          class
 *
 * @see #setLookAndFeel
 * @see #getCrossPlatformLookAndFeelClassName
 */
public static String getSystemLookAndFeelClassName() {
    String systemLAF = AccessController.doPrivileged(
                         new GetPropertyAction("swing.systemlaf"));
    if (systemLAF != null) {
        return systemLAF;
    }
    OSInfo.OSType osType = AccessController.doPrivileged(OSInfo.getOSTypeAction());
    if (osType == OSInfo.OSType.WINDOWS) {
        return "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    } else {
        String desktop = AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        if ("gnome".equals(desktop) &&
                toolkit instanceof SunToolkit &&
                ((SunToolkit) toolkit).isNativeGTKAvailable()) {
            // May be set on Linux and Solaris boxs.
            return "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
        }
        if (osType == OSInfo.OSType.MACOSX) {
            if (toolkit.getClass() .getName()
                                   .equals("sun.lwawt.macosx.LWCToolkit")) {
                return "com.apple.laf.AquaLookAndFeel";
            }
        }
        if (osType == OSInfo.OSType.SOLARIS) {
            return "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
        }
    }
    return getCrossPlatformLookAndFeelClassName();
}
 
源代码25 项目: jdk8u60   文件: MotifColorUtilities.java
static void loadSystemColors(int[] systemColors) {
    if ("Linux".equals(AccessController.doPrivileged(new GetPropertyAction("os.name")))) { // Load motif default colors on Linux.
        loadMotifDefaultColors(systemColors);
    }
    else
    {
        try {
            loadSystemColorsForCDE(systemColors);
        }
        catch (Exception e) // Failure to load CDE colors.
        {
            loadMotifDefaultColors(systemColors);
        }
    }
}
 
源代码26 项目: dragonwell8_jdk   文件: Charset.java
static boolean atBugLevel(String bl) {              // package-private
    String level = bugLevel;
    if (level == null) {
        if (!sun.misc.VM.isBooted())
            return false;
        bugLevel = level = AccessController.doPrivileged(
            new GetPropertyAction("sun.nio.cs.bugLevel", ""));
    }
    return level.equals(bl);
}
 
源代码27 项目: jdk8u60   文件: WindowsLookAndFeel.java
public void initialize() {
    super.initialize();

    // Set the flag which determines which version of Windows should
    // be rendered. This flag only need to be set once.
    // if version <= 4.0 then the classic LAF should be loaded.
    if (OSInfo.getWindowsVersion().compareTo(OSInfo.WINDOWS_95) <= 0) {
        isClassicWindows = true;
    } else {
        isClassicWindows = false;
        XPStyle.invalidateStyle();
    }

    // Using the fonts set by the user can potentially cause
    // performance and compatibility issues, so allow this feature
    // to be switched off either at runtime or programmatically
    //
    String systemFonts = java.security.AccessController.doPrivileged(
           new GetPropertyAction("swing.useSystemFontSettings"));
    useSystemFontSettings = (systemFonts == null ||
                             Boolean.valueOf(systemFonts).booleanValue());

    if (useSystemFontSettings) {
        Object value = UIManager.get("Application.useSystemFontSettings");

        useSystemFontSettings = (value == null ||
                                 Boolean.TRUE.equals(value));
    }
    KeyboardFocusManager.getCurrentKeyboardFocusManager().
        addKeyEventPostProcessor(WindowsRootPaneUI.altProcessor);

}
 
源代码28 项目: dragonwell8_jdk   文件: DefaultSelectorProvider.java
/**
 * Returns the default SelectorProvider.
 */
public static SelectorProvider create() {
    String osname = AccessController
        .doPrivileged(new GetPropertyAction("os.name"));
    if (osname.equals("SunOS"))
        return createProvider("sun.nio.ch.DevPollSelectorProvider");
    if (osname.equals("Linux"))
        return createProvider("sun.nio.ch.EPollSelectorProvider");
    return new sun.nio.ch.PollSelectorProvider();
}
 
源代码29 项目: jdk8u_jdk   文件: SwingUtilities.java
/**
 * Returns true if <code>setTransferHandler</code> should change the
 * <code>DropTarget</code>.
 */
private static boolean getSuppressDropTarget() {
    if (!checkedSuppressDropSupport) {
        suppressDropSupport = Boolean.valueOf(
            AccessController.doPrivileged(
                new GetPropertyAction("suppressSwingDropSupport")));
        checkedSuppressDropSupport = true;
    }
    return suppressDropSupport;
}
 
源代码30 项目: dragonwell8_jdk   文件: SunToolkit.java
/**
 * Returns the locale in which the runtime was started.
 */
public static Locale getStartupLocale() {
    if (startupLocale == null) {
        String language, region, country, variant;
        language = AccessController.doPrivileged(
                        new GetPropertyAction("user.language", "en"));
        // for compatibility, check for old user.region property
        region = AccessController.doPrivileged(
                        new GetPropertyAction("user.region"));
        if (region != null) {
            // region can be of form country, country_variant, or _variant
            int i = region.indexOf('_');
            if (i >= 0) {
                country = region.substring(0, i);
                variant = region.substring(i + 1);
            } else {
                country = region;
                variant = "";
            }
        } else {
            country = AccessController.doPrivileged(
                            new GetPropertyAction("user.country", ""));
            variant = AccessController.doPrivileged(
                            new GetPropertyAction("user.variant", ""));
        }
        startupLocale = new Locale(language, country, variant);
    }
    return startupLocale;
}