harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r423008 - in /incubator/harmony/enhanced/classlib/trunk/modules/nio/src: main/java/org/apache/harmony/nio/internal/ReadOnlyFileChannel.java test/java/common/org/apache/harmony/tests/java/nio/channels/FileChannelTest.java
Date Tue, 18 Jul 2006 08:26:00 GMT
Author: pyang
Date: Tue Jul 18 01:25:58 2006
New Revision: 423008

URL: http://svn.apache.org/viewvc?rev=423008&view=rev
Log:
fix for HARMONY-903

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/ReadOnlyFileChannel.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/channels/FileChannelTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/ReadOnlyFileChannel.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/ReadOnlyFileChannel.java?rev=423008&r1=423007&r2=423008&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/ReadOnlyFileChannel.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/ReadOnlyFileChannel.java
Tue Jul 18 01:25:58 2006
@@ -30,7 +30,6 @@
 	}
 
 	public final int write(ByteBuffer buffer, long position) throws IOException {
-		openCheck();
         if (null == buffer){
             throw new NullPointerException();
         }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/channels/FileChannelTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/channels/FileChannelTest.java?rev=423008&r1=423007&r2=423008&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/channels/FileChannelTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/common/org/apache/harmony/tests/java/nio/channels/FileChannelTest.java
Tue Jul 18 01:25:58 2006
@@ -2048,6 +2048,33 @@
         } catch (NonWritableChannelException e) {
             // expected
         }
+ 
+        // regression test for Harmony-903
+        
+        // read-only file channel never throws ClosedChannelException even if
+        // the channel is closed.
+        readOnlyFileChannel.close();
+        try {
+            readOnlyFileChannel.write(writeBuffer, 10);
+            fail("should throw NonWritableChannelException");
+        } catch (NonWritableChannelException e) {
+            // expected
+        }
+
+        try {
+            readOnlyFileChannel.write(writeBuffer, -1);
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+
+        writeBuffer = null;
+        try {
+            readOnlyFileChannel.write(writeBuffer, -1);
+            fail("should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        } 
     }
 
     /**



Mime
View raw message