harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r824720 - /harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/Collator.java
Date Tue, 13 Oct 2009 12:28:02 GMT
Author: tellison
Date: Tue Oct 13 12:28:02 2009
New Revision: 824720

URL: http://svn.apache.org/viewvc?rev=824720&view=rev
Log:
Simplify static initializer.

Modified:
    harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/Collator.java

Modified: harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/Collator.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/Collator.java?rev=824720&r1=824719&r2=824720&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/Collator.java (original)
+++ harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/Collator.java Tue
Oct 13 12:28:02 2009
@@ -157,21 +157,13 @@
 
     static {
         // CACHE_SIZE includes key and value, so needs to be double
-        String cacheSize = AccessController
-                .doPrivileged(new PrivilegedAction<String>() {
-                    public String run() {
-                        return System.getProperty("collator.cache"); //$NON-NLS-1$
+        Integer value = AccessController
+                .doPrivileged(new PrivilegedAction<Integer>() {
+                    public Integer run() {
+                        return Integer.getInteger("collator.cache"); //$NON-NLS-1$
                     }
                 });
-        if (cacheSize != null) {
-            try {
-                CACHE_SIZE = Integer.parseInt(cacheSize);
-            } catch (NumberFormatException e) {
-                CACHE_SIZE = 6;
-            }
-        } else {
-            CACHE_SIZE = 6;
-        }
+        CACHE_SIZE = value == null ? 6 : value.intValue();
     }
 
     private static Vector<Collator> cache = new Vector<Collator>(CACHE_SIZE);



Mime
View raw message