diff -r 4347e4bcc462 javafx-common/src/com/sun/javafx/PlatformUtil.java --- a/javafx-common/src/com/sun/javafx/PlatformUtil.java Wed May 30 13:22:40 2012 -0700 +++ b/javafx-common/src/com/sun/javafx/PlatformUtil.java Wed May 30 14:17:07 2012 -0700 @@ -13,7 +13,6 @@ private static final String os = System.getProperty("os.name"); private static final String version = System.getProperty("os.version"); private static final boolean embedded; - static { embedded = AccessController.doPrivileged(new PrivilegedAction() { @Override public Boolean run() { @@ -22,61 +21,77 @@ }); } + private static final boolean WINDOWS = os.startsWith("Windows"); + private static final boolean WINDOWS_VISTA_OR_LATER = WINDOWS && versionNumberGreaterThanOrEqualTo(6.0f); + private static final boolean WINDOWS_7_OR_LATER = WINDOWS && versionNumberGreaterThanOrEqualTo(6.1f); + private static final boolean MAC = os.startsWith("Mac"); + private static final boolean LINUX = os.startsWith("Linux"); + private static final boolean SOLARIS = os.startsWith("SunOS"); + + /** + * Utility method used to determine whether the version number as + * reported by system properties is greater than or equal to a given + * value. + * + * @param value The value to test against. + * @return false if the version number cannot be parsed as a float, + * otherwise the comparison against value. + */ + private static boolean versionNumberGreaterThanOrEqualTo(float value) { + try { + return Float.parseFloat(version) >= value; + } catch (Exception e) { + return false; + } + } + /** * Returns true if the operating system is a form of Windows. */ public static boolean isWindows(){ - return os.startsWith("Windows"); + return WINDOWS; } /** * Returns true if the operating system is at least Windows Vista(v6.0). */ public static boolean isWinVistaOrLater(){ - try { - return PlatformUtil.isWindows() && (Float.parseFloat(version) >= 6.0f); - } catch (Exception e) { - return false; - } + return WINDOWS_VISTA_OR_LATER; } /** * Returns true if the operating system is at least Windows 7(v6.1). */ public static boolean isWin7OrLater(){ - try { - return PlatformUtil.isWindows() && (Float.parseFloat(version) >= 6.1f); - } catch (Exception e) { - return false; - } + return WINDOWS_7_OR_LATER; } /** * Returns true if the operating system is a form of Mac OS. */ public static boolean isMac(){ - return os.startsWith("Mac"); + return MAC; } /** * Returns true if the operating system is a form of Linux. */ public static boolean isLinux(){ - return (os.startsWith("Linux")); + return LINUX; } /** * Returns true if the operating system is a form of Unix, including Linux. */ public static boolean isSolaris(){ - return (os.startsWith("SunOS")); + return SOLARIS; } /** * Returns true if the operating system is a form of Linux or Solaris */ public static boolean isUnix(){ - return (isLinux() || isSolaris()); + return LINUX || SOLARIS; } /**