harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r454691 - in /incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc: ./ accessors/ internal/nls/
Date Tue, 10 Oct 2006 10:52:00 GMT
Author: hindessm
Date: Tue Oct 10 03:51:59 2006
New Revision: 454691

URL: http://svn.apache.org/viewvc?view=rev&rev=454691
Log:
Applied patch from "[#HARMONY-1324] [classlib][internationalization]
Internationalization of the misc module".

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/SystemUtils.java
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/AccessorFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ArrayAccessor.java
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/MemoryAccessor.java
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ObjectAccessor.java
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/StringAccessor.java
    incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties

Modified: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/SystemUtils.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/SystemUtils.java?view=diff&rev=454691&r1=454690&r2=454691
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/SystemUtils.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/SystemUtils.java
Tue Oct 10 03:51:59 2006
@@ -43,11 +43,11 @@
      */
     public static int getOS() {
         if (os == 0) {
-            String osname = System.getProperty("os.name").substring(0,3);
-            if (osname.compareToIgnoreCase("win") == 0) {
+            String osname = System.getProperty("os.name").substring(0,3); //$NON-NLS-1$
+            if (osname.compareToIgnoreCase("win") == 0) { //$NON-NLS-1$
                 os = OS_WINDOWS;
             } else {
-                if (osname.compareToIgnoreCase("lin") == 0) {
+                if (osname.compareToIgnoreCase("lin") == 0) { //$NON-NLS-1$
                     os = OS_LINUX;
                 } else
                     os = OS_UNKNOWN;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/AccessorFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/AccessorFactory.java?view=diff&rev=454691&r1=454690&r2=454691
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/AccessorFactory.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/AccessorFactory.java
Tue Oct 10 03:51:59 2006
@@ -17,6 +17,8 @@
 
 package org.apache.harmony.misc.accessors;
 
+import org.apache.harmony.misc.internal.nls.Messages;
+
 /**
  * Factory for all accessors. This class is used to get the instances of various
  * accessor classes methods. 
@@ -35,7 +37,8 @@
         Class callerClass = ThreadStackAccessor.getInstance().getCallerClass(5);
         ClassLoader callingClassLoader = callerClass.getClassLoader();
         if (!(classLoader == null ? callingClassLoader == null : classLoader.equals(callingClassLoader)))
{
-            throw new SecurityException("User code is not allowed to get accessors, caller
class: " + callerClass);
+            // misc.5=User code is not allowed to get accessors, caller class: {0}
+            throw new SecurityException(Messages.getString("misc.5", callerClass)); //$NON-NLS-1$
         }
     }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ArrayAccessor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ArrayAccessor.java?view=diff&rev=454691&r1=454690&r2=454691
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ArrayAccessor.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ArrayAccessor.java
Tue Oct 10 03:51:59 2006
@@ -19,6 +19,8 @@
 
 import java.util.HashMap;
 
+import org.apache.harmony.misc.internal.nls.Messages;
+
 /**
  * This class is a performance optimization aid which provides the low-level
  * access to arrays. It contains the following groups of methods:
@@ -64,7 +66,7 @@
 
     static ArrayAccessor getInstance() {
         if (instance == null) {
-            System.loadLibrary("accessors");
+            System.loadLibrary("accessors"); //$NON-NLS-1$
             instance = new ArrayAccessor();
         }
         return instance;
@@ -111,7 +113,8 @@
         if (type == Double.TYPE) {
             return new double[size];
         }
-        throw new IllegalArgumentException("Non primitive type " + type);
+        // misc.1=Non primitive type {0}
+        throw new IllegalArgumentException(Messages.getString("misc.1", type)); //$NON-NLS-1$
     }
 
     /**
@@ -228,7 +231,8 @@
     private static LockedArray lockArray(Object array, boolean longLock) {
         synchronized (objectLockMap) {
             if (objectLockMap.get(array) != null) {
-                throw new RuntimeException("array is already locked/pinned");
+                // misc.2=array is already locked/pinned
+                throw new RuntimeException(Messages.getString("misc.2")); //$NON-NLS-1$
             }
             long addr = 0;
             if (longLock) {
@@ -251,7 +255,8 @@
                 addr = staticLockArray(array);
             }
             if (addr == 0) {
-                throw new RuntimeException("lock failed");
+                // misc.3=lock failed
+                throw new RuntimeException(Messages.getString("misc.3")); //$NON-NLS-1$
             }
             LockedArray la = new LockedArray(array, addr, longLock);
             objectLockMap.put(array, la);
@@ -332,7 +337,8 @@
      */
     public final int getArrayElementSize(Class arrayClass) {
         if (!arrayClass.isArray()) {
-            throw new RuntimeException("not an array Class");
+            // misc.4=not an array Class
+            throw new RuntimeException(Messages.getString("misc.4")); //$NON-NLS-1$
         }
         if (arrayClass == byte[].class || arrayClass == boolean[].class) {
             return 1;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/MemoryAccessor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/MemoryAccessor.java?view=diff&rev=454691&r1=454690&r2=454691
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/MemoryAccessor.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/MemoryAccessor.java
Tue Oct 10 03:51:59 2006
@@ -17,6 +17,8 @@
 
 package org.apache.harmony.misc.accessors;
 
+import org.apache.harmony.misc.internal.nls.Messages;
+
 /**
  * The class describes low level memory operation for memory allocation/deallocation
  * and access.
@@ -30,7 +32,7 @@
     private static MemoryAccessor instance;
     static MemoryAccessor getInstance() {
         if (instance == null) {
-            System.loadLibrary("accessors");
+            System.loadLibrary("accessors"); //$NON-NLS-1$
             instance = new MemoryAccessor();
         }
         return instance;
@@ -87,7 +89,8 @@
         case 8:
             return findFirstDiffReorder64(addr1, addr2, size);
         }
-        throw new IllegalArgumentException("bad elemSize");
+        // misc.0=bad elemSize
+        throw new IllegalArgumentException(Messages.getString("misc.0")); //$NON-NLS-1$
     }
 
     private native long findFirstDiff(long addr1, long addr2, long size);

Modified: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ObjectAccessor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ObjectAccessor.java?view=diff&rev=454691&r1=454690&r2=454691
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ObjectAccessor.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/ObjectAccessor.java
Tue Oct 10 03:51:59 2006
@@ -66,7 +66,7 @@
     private static ObjectAccessor instance;
     static ObjectAccessor getInstance() {
         if (instance == null) {
-            System.loadLibrary("accessors");
+            System.loadLibrary("accessors"); //$NON-NLS-1$
             instance = new ObjectAccessor();
         }
         return instance;
@@ -588,14 +588,14 @@
 
     private static long getMethodID(Class c, String name, Class[] parameterTypes, boolean
isStatic) {
         try {
-            String sig = "(";
+            String sig = "("; //$NON-NLS-1$
             for (int i=0; i < parameterTypes.length; i++) {
                 sig += getSystemName(parameterTypes[i]);
             }
-            sig += ")";
+            sig += ")"; //$NON-NLS-1$
             if (name == null) {
-                name = "<init>";
-                sig += "V";
+                name = "<init>"; //$NON-NLS-1$
+                sig += "V"; //$NON-NLS-1$
             } else {
                 Method m = c.getDeclaredMethod(name, parameterTypes);
                 sig += getSystemName(m.getReturnType());
@@ -830,23 +830,23 @@
 
     private static final String getSystemName(Class cls) {
         if (cls == boolean.class) {
-            return "Z";
+            return "Z"; //$NON-NLS-1$
         } else if (cls == char.class) {
-            return "C";
+            return "C"; //$NON-NLS-1$
         } else if (cls == byte.class) {
-            return "B";
+            return "B"; //$NON-NLS-1$
         } else if (cls == short.class) {
-            return "S";
+            return "S"; //$NON-NLS-1$
         } else if (cls == int.class) {
-            return "I";
+            return "I"; //$NON-NLS-1$
         } else if (cls == long.class) {
-            return "J";
+            return "J"; //$NON-NLS-1$
         } else if (cls == float.class) {
-            return "F";
+            return "F"; //$NON-NLS-1$
         } else if (cls == double.class) {
-            return "D";
+            return "D"; //$NON-NLS-1$
         } else if (cls == void.class) {
-            return "V";
+            return "V"; //$NON-NLS-1$
         } else { // Object type.
             String className = cls.getName().replace('.', '/');
             // Add reference to non-array reference types.

Modified: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/StringAccessor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/StringAccessor.java?view=diff&rev=454691&r1=454690&r2=454691
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/StringAccessor.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/accessors/StringAccessor.java
Tue Oct 10 03:51:59 2006
@@ -20,6 +20,8 @@
 import java.nio.ByteOrder;
 import java.io.UnsupportedEncodingException;
 
+import org.apache.harmony.misc.internal.nls.Messages;
+
 /**
  * This class allows to copy data from String objects to native buffers, and
  * construct String objects from native strings. This allows to pass and receive
@@ -34,7 +36,7 @@
 
     static StringAccessor getInstance() {
         if (instance == null) {
-            System.loadLibrary("accessors");
+            System.loadLibrary("accessors"); //$NON-NLS-1$
             instance = new StringAccessor();
         }
         return instance;
@@ -232,13 +234,14 @@
         }
         try {
             if (byteOrder == 1) {
-                cmpTo = new String(cmpTo.getBytes("UTF-16BE"), "UTF-16BE");
+                cmpTo = new String(cmpTo.getBytes("UTF-16BE"), "UTF-16BE"); //$NON-NLS-1$
//$NON-NLS-2$
             } else {
-                cmpTo = new String(cmpTo.getBytes("UTF-16LE"), "UTF-16LE");
+                cmpTo = new String(cmpTo.getBytes("UTF-16LE"), "UTF-16LE"); //$NON-NLS-1$
//$NON-NLS-2$
             }
         } catch (UnsupportedEncodingException e) {
             throw new InternalError(
-                    "Failed to get UTF-16 support, this is a bug");
+                    // misc.6=Failed to get UTF-16 support, this is a bug
+                    Messages.getString("misc.6")); //$NON-NLS-1$
         }
         return strObj.compareTo(cmpTo);
     }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties?view=diff&rev=454691&r1=454690&r2=454691
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/misc/src/main/java/org/apache/harmony/misc/internal/nls/messages.properties
Tue Oct 10 03:51:59 2006
@@ -14,3 +14,10 @@
 #  limitations under the License.
 
 # messages for EN locale
+misc.0=bad elemSize
+misc.1=Non primitive type {0}
+misc.2=array is already locked/pinned
+misc.3=lock failed
+misc.4=not an array Class
+misc.5=User code is not allowed to get accessors, caller class: {0}
+misc.6=Failed to get UTF-16 support, this is a bug



Mime
View raw message