harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r447855 - in /incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java: java/nio/ java/nio/channels/spi/ org/apache/harmony/nio/ org/apache/harmony/nio/internal/ org/apache/harmony/nio/internal/nls/
Date Tue, 19 Sep 2006 14:24:02 GMT
Author: pyang
Date: Tue Sep 19 07:24:01 2006
New Revision: 447855

URL: http://svn.apache.org/viewvc?view=rev&rev=447855
Log:
Patch applied for HARMONY-1314([classlib][internationalization]Internationalization of the
nio module)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/DirectByteBuffer.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/Util.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/DirectByteBuffer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/DirectByteBuffer.java?view=diff&rev=447855&r1=447854&r2=447855
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/DirectByteBuffer.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/DirectByteBuffer.java
Tue Sep 19 07:24:01 2006
@@ -18,6 +18,7 @@
 import org.apache.harmony.luni.platform.PlatformAddress;
 import org.apache.harmony.luni.platform.PlatformAddressFactory;
 import org.apache.harmony.nio.internal.DirectBuffer;
+import org.apache.harmony.nio.internal.nls.Messages;
 
 
 /**
@@ -199,8 +200,9 @@
 
 	public final void addressValidityCheck() {
 		if (!isAddressValid()) {
+            // nio.08=Cannot use the direct byte buffer after it has been explicitly freed.
 			throw new IllegalStateException(
-					"Cannot use the direct byte buffer after it has been explicitly freed."); //$NON-NLS-1$
+					Messages.getString("nio.08"));  //$NON-NLS-1$
 		}
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java?view=diff&rev=447855&r1=447854&r2=447855
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/spi/AbstractInterruptibleChannel.java
Tue Sep 19 07:24:01 2006
@@ -46,7 +46,7 @@
 					.doPrivileged(new PrivilegedExceptionAction<Method>() {
 						public Method run() throws Exception {
 							return Thread.class.getDeclaredMethod(
-									"setInterruptAction",
+									"setInterruptAction", //$NON-NLS-1$
 									new Class[] { Runnable.class });
 
 						}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java?view=diff&rev=447855&r1=447854&r2=447855
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/FileChannelFactory.java
Tue Sep 19 07:24:01 2006
@@ -21,6 +21,7 @@
 import org.apache.harmony.nio.internal.ReadOnlyFileChannel;
 import org.apache.harmony.nio.internal.ReadWriteFileChannel;
 import org.apache.harmony.nio.internal.WriteOnlyFileChannel;
+import org.apache.harmony.nio.internal.nls.Messages;
 import org.apache.harmony.luni.platform.IFileSystem;
 
 /**
@@ -41,7 +42,8 @@
         case IFileSystem.O_APPEND:
             return new WriteOnlyFileChannel(stream, fd, true);
         default:
-            throw new RuntimeException("Unknown file channel type: "+mode); //$NON-NLS-1$
+            // nio.09=Unknown file channel type: {0}
+            throw new RuntimeException(Messages.getString("nio.09", mode));  //$NON-NLS-1$
         }
 	}
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/Util.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/Util.java?view=diff&rev=447855&r1=447854&r2=447855
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/Util.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/Util.java
Tue Sep 19 07:24:01 2006
@@ -15,7 +15,7 @@
 
 package org.apache.harmony.nio;
 
-import org.apache.harmony.luni.util.Msg;
+import org.apache.harmony.nio.internal.nls.Messages;
 
 /*
  * Static methods. Used by io and nio packages.
@@ -46,82 +46,100 @@
      */
     public static void assertArrayIndex(Object[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
     public static void assertArrayIndex(boolean[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
     public static void assertArrayIndex(byte[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
     public static void assertArrayIndex(short[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
     public static void assertArrayIndex(int[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
     public static void assertArrayIndex(long[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
     public static void assertArrayIndex(float[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
     public static void assertArrayIndex(double[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
     public static void assertArrayIndex(char[] array, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > array.length) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 
@@ -132,10 +150,12 @@
      */
     public static void assertArrayIndex(int arrayLength, int offset, int length) {
         if (offset < 0 || length < 0) {
-            throw new IndexOutOfBoundsException(Msg.getString("K0006"));
+            // nio.05=Negative index specified
+            throw new IndexOutOfBoundsException(Messages.getString("nio.05")); //$NON-NLS-1$
         }
         if ((long) offset + (long) length > arrayLength) {
-            throw new IndexOutOfBoundsException(Msg.getString("K00ae"));
+            // nio.04=Size mismatch
+            throw new IndexOutOfBoundsException(Messages.getString("nio.04")); //$NON-NLS-1$
         }
     }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java?view=diff&rev=447855&r1=447854&r2=447855
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
Tue Sep 19 07:24:01 2006
@@ -31,6 +31,7 @@
 import org.apache.harmony.luni.platform.Platform;
 import org.apache.harmony.luni.platform.PlatformAddress;
 import org.apache.harmony.luni.platform.PlatformAddressFactory;
+import org.apache.harmony.nio.internal.nls.Messages;
 
 /*
  * The file channel impl class is the bridge between the logical channels
@@ -102,8 +103,9 @@
 	protected FileLock basicLock(long position, long size, boolean shared,
 			boolean wait) throws IOException {
 		if ((position < 0) || (size < 0)) {
+            // nio.0A=Lock position and size must be non-negative.
 			throw new IllegalArgumentException(
-					"Lock position and size must be non-negative."); //$NON-NLS-1$
+					Messages.getString("nio.0A"));  //$NON-NLS-1$
 		}
         int lockType = shared ? IFileSystem.SHARED_LOCK_TYPE
                 : IFileSystem.EXCLUSIVE_LOCK_TYPE;
@@ -211,8 +213,9 @@
 	public FileChannel position(long newPosition) throws IOException {
         openCheck();
 		if (newPosition < 0) {
+            // nio.0B=New position must be non-negative.
 			throw new IllegalArgumentException(
-					"New position must be non-negative."); //$NON-NLS-1$
+					Messages.getString("nio.0B"));  //$NON-NLS-1$
 		}		
 
 		synchronized (repositioningLock) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java?view=diff&rev=447855&r1=447854&r2=447855
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/IOUtil.java
Tue Sep 19 07:24:01 2006
@@ -23,8 +23,8 @@
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
 
-import org.apache.harmony.luni.util.Msg;
 import org.apache.harmony.nio.Util;
+import org.apache.harmony.nio.internal.nls.Messages;
 
 
 /*
@@ -70,7 +70,8 @@
 				}
 				return chars.get();
 			}
-			throw new IOException(Msg.getString("K0070")); //$NON-NLS-1$
+            // nio.06=InputStreamReader is closed.
+			throw new IOException(Messages.getString("nio.06")); //$NON-NLS-1$
 		}
 	}
 
@@ -115,7 +116,8 @@
 				chars.position(chars.position() + needChars);
 				return length;
 			}
-            throw new IOException(Msg.getString("K0070")); //$NON-NLS-1$
+            // nio.06=InputStreamReader is closed.
+            throw new IOException(Messages.getString("nio.06")); //$NON-NLS-1$
 		}
 	}
 
@@ -165,7 +167,8 @@
 			throws IOException {
 		synchronized (lock) {
 			if (encoder == null) {
-                throw new IOException(Msg.getString("K005d")); //$NON-NLS-1$
+                // nio.07=Writer is closed.
+                throw new IOException(Messages.getString("nio.07")); //$NON-NLS-1$
 			}
 			CharBuffer chars = CharBuffer.wrap(new char[] { (char) oneChar });
 			convert(lock, encoder, bytes, chars, out);
@@ -191,7 +194,8 @@
 			throws IOException {
 		synchronized (lock) {
 			if (encoder == null) {
-                throw new IOException(Msg.getString("K005d")); //$NON-NLS-1$
+                // nio.07=Writer is closed.
+                throw new IOException(Messages.getString("nio.07")); //$NON-NLS-1$
 			}
 			int position;
 			if ((position = bytes.position()) > 0) {
@@ -211,7 +215,8 @@
 			throws IOException {
 		synchronized (lock) {
 			if (encoder == null) {
-                throw new IOException(Msg.getString("K005d")); //$NON-NLS-1$
+                // nio.07=Writer is closed.
+                throw new IOException(Messages.getString("nio.07")); //$NON-NLS-1$
 			}
 			CoderResult result = encoder.encode(chars, bytes, true);
 			while (true) {

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java?view=diff&rev=447855&r1=447854&r2=447855
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/SocketChannelImpl.java
Tue Sep 19 07:24:01 2006
@@ -44,7 +44,7 @@
 import org.apache.harmony.luni.platform.INetworkSystem;
 import org.apache.harmony.luni.platform.Platform;
 import org.apache.harmony.luni.util.ErrorCodeException;
-import org.apache.harmony.luni.util.Msg;
+import org.apache.harmony.nio.internal.nls.Messages;
 
 
 /*
@@ -644,8 +644,6 @@
         // Class Variables
         // ----------------------------------------------------
 
-        private static final String ERRCODE_CHANNEL_CLOSED = "K003d"; //$NON-NLS-1$
-
         SocketChannelImpl channel;
 
         SocketImpl socketImpl;
@@ -822,13 +820,16 @@
          */
         public OutputStream getOutputStream() throws IOException {
             if (!channel.isOpen()) {
-                throw new SocketException(Msg.getString("K003d"));
+                // nio.00=Socket is closed
+                throw new SocketException(Messages.getString("nio.00")); //$NON-NLS-1$
             }
             if (!channel.isConnected()) {
-                throw new SocketException(Msg.getString("K0320"));
+                // nio.01=Socket is not connected
+                throw new SocketException(Messages.getString("nio.01")); //$NON-NLS-1$
             }             
             if (isOutputShutdown()) {
-                throw new SocketException(Msg.getString("KA00f"));
+                // nio.02=Socket output is shutdown
+                throw new SocketException(Messages.getString("nio.02")); //$NON-NLS-1$
             }
             return new SocketChannelOutputStream(channel);
         }
@@ -839,13 +840,16 @@
          */
         public InputStream getInputStream() throws IOException {
             if (!channel.isOpen()) {
-                throw new SocketException(Msg.getString("K003d"));
+                // nio.00=Socket is closed
+                throw new SocketException(Messages.getString("nio.00")); //$NON-NLS-1$
             }
             if (!channel.isConnected()) {
-                throw new SocketException(Msg.getString("K0320"));
+                // nio.01=Socket is not connected
+                throw new SocketException(Messages.getString("nio.01")); //$NON-NLS-1$
             }             
             if (isInputShutdown()) {
-                throw new SocketException(Msg.getString("K0321"));
+                // nio.03=Socket input is shutdown
+                throw new SocketException(Messages.getString("nio.03")); //$NON-NLS-1$
             }
             return new SocketChannelInputStream(channel);
         }
@@ -855,7 +859,8 @@
          */
         private void checkOpen() throws SocketException {
             if (isClosed()) {
-                throw new SocketException(Msg.getString(ERRCODE_CHANNEL_CLOSED));
+                // nio.00=Socket is closed
+                throw new SocketException(Messages.getString("nio.00")); //$NON-NLS-1$
             }
         }
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties?view=diff&rev=447855&r1=447854&r2=447855
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/nls/messages.properties
Tue Sep 19 07:24:01 2006
@@ -14,3 +14,15 @@
 # 
 
 # messages for EN locale
+nio.00=Socket is closed
+nio.01=Socket is not connected
+nio.02=Socket output is shutdown
+nio.03=Socket input is shutdown
+nio.04=Size mismatch
+nio.05=Negative index specified
+nio.06=InputStreamReader is closed.
+nio.07=Writer is closed.
+nio.08=Cannot use the direct byte buffer after it has been explicitly freed.
+nio.09=Unknown file channel type: {0}
+nio.0A=Lock position and size must be non-negative.
+nio.0B=New position must be non-negative.



Mime
View raw message