Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 76726 invoked from network); 31 May 2003 01:02:38 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 31 May 2003 01:02:38 -0000 Received: (qmail 14644 invoked by uid 97); 31 May 2003 01:04:57 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 14637 invoked from network); 31 May 2003 01:04:57 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 31 May 2003 01:04:57 -0000 Received: (qmail 76457 invoked by uid 500); 31 May 2003 01:02:35 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 76446 invoked by uid 500); 31 May 2003 01:02:35 -0000 Received: (qmail 76443 invoked from network); 31 May 2003 01:02:34 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 31 May 2003 01:02:34 -0000 Received: (qmail 54021 invoked by uid 1643); 31 May 2003 01:02:33 -0000 Date: 31 May 2003 01:02:33 -0000 Message-ID: <20030531010233.54019.qmail@icarus.apache.org> From: ggregory@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang SystemUtils.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ggregory 2003/05/30 18:02:33 Modified: lang/src/java/org/apache/commons/lang SystemUtils.java Log: Javadoc. Revision Changes Path 1.15 +78 -77 jakarta-commons/lang/src/java/org/apache/commons/lang/SystemUtils.java Index: SystemUtils.java =================================================================== RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/SystemUtils.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- SystemUtils.java 30 May 2003 01:15:53 -0000 1.14 +++ SystemUtils.java 31 May 2003 01:02:33 -0000 1.15 @@ -54,10 +54,11 @@ package org.apache.commons.lang; /** - *

Common System class helpers.

+ *

Helpers for java.lang.System.

* - *

If a particular system property cannot be read due to security - * restrictions, the field will return null.

+ *

If a system property cannot be read due to security restrictions, + * the corresponding field in this class will be set to null + * and a message will be written to System.err.

* * @author Based on code from Avalon Excalibur * @author Based on code from Lucene @@ -76,7 +77,7 @@ *

File encoding, such as Cp1252.

* *

Defaults to null if the runtime does not have - * security access to read this property or property not specified.

+ * security access to read this property or the property does not exist.

* * @since Java version 1.2. */ @@ -87,7 +88,7 @@ * File separator ("/" on UNIX). *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java version 1.1. */ @@ -97,63 +98,63 @@ /** * Is true if this is Java version 1.1 (also 1.1.x versions). *

- * The field will return false if JAVA_VERSION is null. + * The field will return false if {@link #JAVA_VERSION} is null.

*/ public static final boolean IS_JAVA_1_1 = getJavaVersionMatches("1.1"); /** * Is true if this is Java version 1.2 (also 1.2.x versions). *

- * The field will return false if JAVA_VERSION is null. + * The field will return false if {@link #JAVA_VERSION} is null.

*/ public static final boolean IS_JAVA_1_2 = getJavaVersionMatches("1.2"); /** * Is true if this is Java version 1.3 (also 1.3.x versions). *

- * The field will return false if JAVA_VERSION is null. + * The field will return false if {@link #JAVA_VERSION} is null.

*/ public static final boolean IS_JAVA_1_3 = getJavaVersionMatches("1.3"); /** * Is true if this is Java version 1.4 (also 1.4.x versions). *

- * The field will return false if JAVA_VERSION is null. + * The field will return false if {@link #JAVA_VERSION} is null.

*/ public static final boolean IS_JAVA_1_4 = getJavaVersionMatches("1.4"); /** * Is true if this is Java version 1.5 (also 1.5.x versions). *

- * The field will return false if JAVA_VERSION is null. + * The field will return false if {@link #JAVA_VERSION} is null.

*/ public static final boolean IS_JAVA_1_5 = getJavaVersionMatches("1.5"); /** * Is true if this is AIX. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_AIX = getOSMatches("AIX"); /** * Is true if this is HP-UX. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_HP_UX = getOSMatches("HP-UX"); /** * Is true if this is Irix. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_IRIX = getOSMatches("Irix"); /** * Is true if this is Linux. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_LINUX = getOSMatches("Linux") || getOSMatches("LINUX"); // Windows XP returns 'Windows 2000' just for fun... @@ -161,35 +162,35 @@ /** * Is true if this is Mac. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_MAC = getOSMatches("Mac"); /** * Is true if this is Mac. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_MAC_OSX = getOSMatches("Mac OS X"); /** * Is true if this is Mac. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_OS2 = getOSMatches("OS/2"); /** * Is true if this is Solaris. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_SOLARIS = getOSMatches("Solaris"); /** * Is true if this is SunOS. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_SUN_OS = getOSMatches("SunOS"); @@ -201,21 +202,21 @@ /** * Is true if this is Windows. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_WINDOWS = getOSMatches("Windows"); /** * Is true if this is Windows 2000. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_WINDOWS_2000 = getOSMatches("Windows", "5.0"); /** * Is true if this is Windows 95. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_WINDOWS_95 = getOSMatches("Windows 9", "4.0"); // JDK 1.2 running on Windows98 returns 'Windows 95', hence the above @@ -223,7 +224,7 @@ /** * Is true if this is Windows 98. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_WINDOWS_98 = getOSMatches("Windows 9", "4.1"); // JDK 1.2 running on Windows98 returns 'Windows 95', hence the above @@ -231,7 +232,7 @@ /** * Is true if this is Windows ME. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_WINDOWS_ME = getOSMatches("Windows", "4.9"); // JDK 1.2 running on WindowsME may return 'Windows 95', hence the above @@ -239,7 +240,7 @@ /** * Is true if this is Windows NT. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_WINDOWS_NT = getOSMatches("Windows NT"); // Windows 2000 returns 'Windows 2000' but may suffer from same JDK1.2 problem @@ -247,7 +248,7 @@ /** * Is true if this is Windows XP. *

- * The field will return false if OS_NAME is null. + * The field will return false if OS_NAME is null.

*/ public static final boolean IS_OS_WINDOWS_XP = getOSMatches("Windows", "5.1"); @@ -256,7 +257,7 @@ * Java class path. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java version 1.1. */ @@ -267,7 +268,7 @@ * Java class format version number. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java version 1.1. */ @@ -279,7 +280,7 @@ * First in JDK version 1.2. Not used in Sun JDKs after 1.2. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java version 1.2. Not used in Sun versions after 1.2. */ @@ -290,7 +291,7 @@ * Path of extension directory or directories. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.3 */ @@ -301,7 +302,7 @@ * Java installation directory. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -312,7 +313,7 @@ * Default temp file path. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -323,7 +324,7 @@ * List of paths to search when loading libraries. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -334,7 +335,7 @@ * Java Runtime Environment name. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.3 */ @@ -345,7 +346,7 @@ * Java Runtime Environment version. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.3 */ @@ -356,7 +357,7 @@ * Java Runtime Environment specification name. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -367,7 +368,7 @@ * Java Runtime Environment specification vendor. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -378,7 +379,7 @@ * Java Runtime Environment specification version. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.3 */ @@ -389,7 +390,7 @@ * Java vendor-specific string. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -400,7 +401,7 @@ * Java vendor URL. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -411,7 +412,7 @@ * Java version number. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -420,25 +421,25 @@ //----------------------------------------------------------------------- /** * Gets the Java version as a float. - * Example output: + *

Example return values:

*
    *
  • 1.2f for JDK 1.2 *
  • 1.31f for JDK 1.3.1 *
*

- * The field will return zero if JAVA_VERSION is null. + * The field will return zero if {@link #JAVA_VERSION} is null.

*/ public static final float JAVA_VERSION_FLOAT = getJavaVersionAsFloat(); /** * Gets the Java version as an int. - * Example output: + *

Example return values:

*
    *
  • 120 for JDK 1.2 *
  • 131 for JDK 1.3.1 *
*

- * The field will return zero if JAVA_VERSION is null. + * The field will return zero if {@link #JAVA_VERSION} is null.

*/ public static final int JAVA_VERSION_INT = getJavaVersionAsInt(); @@ -447,7 +448,7 @@ * Java Virtual Machine implementation info. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -458,7 +459,7 @@ * Java Virtual Machine implementation name. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -469,7 +470,7 @@ * Java Virtual Machine specification name. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -480,7 +481,7 @@ * Java Virtual Machine specification vendor. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -491,7 +492,7 @@ * Java Virtual Machine specification version. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -502,7 +503,7 @@ * Java Virtual Machine implementation vendor. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -513,7 +514,7 @@ * Java Virtual Machine implementation version. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -524,7 +525,7 @@ * Line separator ("\n" on UNIX). *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -535,7 +536,7 @@ * Operating system architecture. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -546,7 +547,7 @@ * Operating system name. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -557,7 +558,7 @@ * Operating system version. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -568,7 +569,7 @@ * Path separator (":" on UNIX). *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -581,7 +582,7 @@ * Renamed to user.country in 1.4 *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -594,7 +595,7 @@ * User's current working directory. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -605,7 +606,7 @@ * User's home directory. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -616,7 +617,7 @@ * User's language code, such as 'en'. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.2 */ @@ -627,7 +628,7 @@ * User's account name. *

* Defaults to null if the runtime does not have - * security access to read this property or property not specified. + * security access to read this property or the property does not exist.

* * @since Java 1.1 */ @@ -635,9 +636,9 @@ //----------------------------------------------------------------------- /** - *

Get the Java version number as a float.

+ *

Gets the Java version number as a float.

* - *

Example output:

+ *

Example return values:

*
    *
  • 1.2f for JDK 1.2 *
  • 1.31f for JDK 1.3.1 @@ -652,16 +653,16 @@ } /** - *

    Get the Java version number as a float.

    + *

    Gets the Java version number as a float.

    * - *

    Example output:

    + *

    Example return values:

    *
      *
    • 1.2f for JDK 1.2 *
    • 1.31f for JDK 1.3.1 *
    * *

    Patch releases are not reported. - * Zero is returned if JAVA_VERSION is null.

    + * Zero is returned if {@link #JAVA_VERSION} is null.

    * * @return the version, for example 1.31f for JDK 1.3.1 */ @@ -677,16 +678,16 @@ } /** - *

    Get the Java version number as an int.

    + *

    Gets the Java version number as an int.

    * - *

    Example output:

    + *

    Example return values:

    *
      *
    • 120 for JDK 1.2 *
    • 131 for JDK 1.3.1 *
    * *

    Patch releases are not reported. - * Zero is returned if JAVA_VERSION is null.

    + * Zero is returned if {@link #JAVA_VERSION} is null.

    * * @return the version, for example 131 for JDK 1.3.1 */ @@ -746,21 +747,21 @@ //----------------------------------------------------------------------- /** - * Gets a System property, defaulting to the given value if the property - * cannot be read. + * Gets a System property, defaulting to null if the property + * cannot be read. If a SecurityException is caught, the return + * value is null and a message is written to System.err. * * @param property the system property name - * @return the system property value or null if security problem + * @return the system property value or null if a security problem occurs */ private static String getSystemProperty(String property) { try { return System.getProperty(property); - } catch (SecurityException ex) { // we are not allowed to look at this property System.err.println( - "SecurityException thrown when reading system property '" + property - + "' - property value will default to null" + "Caught a SecurityException reading the system property '" + property + + "'; the SystemUtils property value will default to null." ); return null; } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org