LANG-821: Support OS X versions in SystemUtils. This also fixes #59 from github. Thanks to Timo Kockert.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1671043 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benedikt Ritter 2015-04-03 12:09:07 +00:00
parent 9c7b0fb8e6
commit 09c42e7d12
3 changed files with 135 additions and 1 deletions

View File

@ -31,6 +31,7 @@ For more information see https://issues.apache.org/jira/browse/LANG-1000.
NEW FEATURES NEW FEATURES
============== ==============
o LANG-821: Support OS X versions in SystemUtils. Thanks to Timo Kockert.
o LANG-1103: Add SystemUtils.IS_JAVA_1_9 o LANG-1103: Add SystemUtils.IS_JAVA_1_9
o LANG-1093: Add ClassUtils.getAbbreviatedName(). Thanks to Fabian Lange. o LANG-1093: Add ClassUtils.getAbbreviatedName(). Thanks to Fabian Lange.
o LANG-1082: Add option to disable the "objectsTriviallyEqual" test in o LANG-1082: Add option to disable the "objectsTriviallyEqual" test in

View File

@ -22,6 +22,7 @@
<body> <body>
<release version="3.4" date="tba" description="tba"> <release version="3.4" date="tba" description="tba">
<action issue="LANG-794" type="add" dev="britter" due-to="Timo Kockert">Support OS X versions in SystemUtils</action>
<action issue="LANG-794" type="fix" dev="britter" due-to="Timo Kockert">SystemUtils.IS_OS_WINDOWS_2008, VISTA are incorrect</action> <action issue="LANG-794" type="fix" dev="britter" due-to="Timo Kockert">SystemUtils.IS_OS_WINDOWS_2008, VISTA are incorrect</action>
<action issue="LANG-1104" type="fix" dev="chas">Parse test fails for TimeZone America/Sao_Paulo</action> <action issue="LANG-1104" type="fix" dev="chas">Parse test fails for TimeZone America/Sao_Paulo</action>
<action issue="LANG-1103" type="add" dev="britter">Add SystemUtils.IS_JAVA_1_9</action> <action issue="LANG-1103" type="add" dev="britter">Add SystemUtils.IS_JAVA_1_9</action>

View File

@ -1043,6 +1043,138 @@ public class SystemUtils {
*/ */
public static final boolean IS_OS_MAC_OSX = getOSMatchesName("Mac OS X"); public static final boolean IS_OS_MAC_OSX = getOSMatchesName("Mac OS X");
/**
* <p>
* Is {@code true} if this is Mac OS X Cheetah.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_CHEETAH = getOSMatches("Mac OS X", "10.0");
/**
* <p>
* Is {@code true} if this is Mac OS X Puma.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_PUMA = getOSMatches("Mac OS X", "10.1");
/**
* <p>
* Is {@code true} if this is Mac OS X Jaguar.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_JAGUAR = getOSMatches("Mac OS X", "10.2");
/**
* <p>
* Is {@code true} if this is Mac OS X Panther.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_PANTHER = getOSMatches("Mac OS X", "10.3");
/**
* <p>
* Is {@code true} if this is Mac OS X Tiger.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_TIGER = getOSMatches("Mac OS X", "10.4");
/**
* <p>
* Is {@code true} if this is Mac OS X Leopard.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_LEOPARD = getOSMatches("Mac OS X", "10.5");
/**
* <p>
* Is {@code true} if this is Mac OS X Snow Leopard.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_SNOW_LEOPARD = getOSMatches("Mac OS X", "10.6");
/**
* <p>
* Is {@code true} if this is Mac OS X Lion.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_LION = getOSMatches("Mac OS X", "10.7");
/**
* <p>
* Is {@code true} if this is Mac OS X Mountain Lion.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_MOUNTAIN_LION = getOSMatches("Mac OS X", "10.8");
/**
* <p>
* Is {@code true} if this is Mac OS X Mavericks.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_MAVERICKS = getOSMatches("Mac OS X", "10.9");
/**
* <p>
* Is {@code true} if this is Mac OS X Yosemite.
* </p>
* <p>
* The field will return {@code false} if {@code OS_NAME} is {@code null}.
* </p>
*
* @since 3.4
*/
public static final boolean IS_OS_MAC_OSX_YOSEMITE = getOSMatches("Mac OS X", "10.10");
/** /**
* <p> * <p>
* Is {@code true} if this is FreeBSD. * Is {@code true} if this is FreeBSD.
@ -1487,7 +1619,7 @@ public class SystemUtils {
} }
return osName.startsWith(osNamePrefix); return osName.startsWith(osNamePrefix);
} }
/** /**
* Decides if the operating system version matches. * Decides if the operating system version matches.
* <p> * <p>