commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang SystemUtils.java
Date Mon, 30 Aug 2004 21:19:52 GMT
ggregory    2004/08/30 14:19:52

  Modified:    lang/src/java/org/apache/commons/lang SystemUtils.java
  Log:
  Refactor "Windows" into private static final String OS_NAME_WINDOWS_PREFIX = "Windows";
  
  Revision  Changes    Path
  1.34      +13 -8     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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- SystemUtils.java	25 Feb 2004 00:25:29 -0000	1.33
  +++ SystemUtils.java	30 Aug 2004 21:19:52 -0000	1.34
  @@ -37,6 +37,11 @@
    */
   public class SystemUtils {
   
  +    /**
  +     * The prefix String for all Windows OS.
  +     */
  +    private static final String OS_NAME_WINDOWS_PREFIX = "Windows";
  +    
       // System property constants
       //-----------------------------------------------------------------------
       // These MUST be declared first. Other constants depend on this.
  @@ -974,7 +979,7 @@
        * 
        * @since 2.0
        */
  -    public static final boolean IS_OS_WINDOWS = getOSMatches("Windows");
  +    public static final boolean IS_OS_WINDOWS = getOSMatches(OS_NAME_WINDOWS_PREFIX);
   
       /**
        * <p>Is <code>true</code> if this is Windows 2000.</p>
  @@ -984,7 +989,7 @@
        * 
        * @since 2.0
        */
  -    public static final boolean IS_OS_WINDOWS_2000 = getOSMatches("Windows", "5.0");
  +    public static final boolean IS_OS_WINDOWS_2000 = getOSMatches(OS_NAME_WINDOWS_PREFIX,
"5.0");
   
       /**
        * <p>Is <code>true</code> if this is Windows 95.</p>
  @@ -994,7 +999,7 @@
        * 
        * @since 2.0
        */
  -    public static final boolean IS_OS_WINDOWS_95 = getOSMatches("Windows 9", "4.0");
  +    public static final boolean IS_OS_WINDOWS_95 = getOSMatches(OS_NAME_WINDOWS_PREFIX
+ " 9", "4.0");
       // JDK 1.2 running on Windows98 returns 'Windows 95', hence the above
   
       /**
  @@ -1005,7 +1010,7 @@
        * 
        * @since 2.0
        */
  -    public static final boolean IS_OS_WINDOWS_98 = getOSMatches("Windows 9", "4.1");
  +    public static final boolean IS_OS_WINDOWS_98 = getOSMatches(OS_NAME_WINDOWS_PREFIX
+ " 9", "4.1");
       // JDK 1.2 running on Windows98 returns 'Windows 95', hence the above
   
       /**
  @@ -1016,7 +1021,7 @@
        * 
        * @since 2.0
        */
  -    public static final boolean IS_OS_WINDOWS_ME = getOSMatches("Windows", "4.9");
  +    public static final boolean IS_OS_WINDOWS_ME = getOSMatches(OS_NAME_WINDOWS_PREFIX,
"4.9");
       // JDK 1.2 running on WindowsME may return 'Windows 95', hence the above
   
       /**
  @@ -1027,7 +1032,7 @@
        * 
        * @since 2.0
        */
  -    public static final boolean IS_OS_WINDOWS_NT = getOSMatches("Windows NT");
  +    public static final boolean IS_OS_WINDOWS_NT = getOSMatches(OS_NAME_WINDOWS_PREFIX
+ " NT");
       // Windows 2000 returns 'Windows 2000' but may suffer from same JDK1.2 problem
   
       /**
  @@ -1038,7 +1043,7 @@
        * 
        * @since 2.0
        */
  -    public static final boolean IS_OS_WINDOWS_XP = getOSMatches("Windows", "5.1");
  +    public static final boolean IS_OS_WINDOWS_XP = getOSMatches(OS_NAME_WINDOWS_PREFIX,
"5.1");
       // Windows XP returns 'Windows 2000' just for fun...
   
       //-----------------------------------------------------------------------    
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message