harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r397194 - /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java
Date Wed, 26 Apr 2006 13:45:38 GMT
Author: mloenko
Date: Wed Apr 26 06:45:35 2006
New Revision: 397194

URL: http://svn.apache.org/viewcvs?rev=397194&view=rev
Log:
regression test for HARMONY-69
java.io.RandomAccessFile(String name, String mode) doesn't allow to open a file in a read-only
mode

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java?rev=397194&r1=397193&r2=397194&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/RandomAccessFileTest.java
Wed Apr 26 06:45:35 2006
@@ -22,6 +22,9 @@
 import java.io.IOException;
 import java.io.RandomAccessFile;
 
+import java.nio.channels.FileChannel;
+import java.nio.channels.NonWritableChannelException;
+
 public class RandomAccessFileTest extends junit.framework.TestCase {
 
     public String fileName;
@@ -657,6 +660,21 @@
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException e) {
         }
+        raf.close();
+    }
+
+    /**
+     * Regression for HARMONY-69
+     */
+    public void testRandomAccessFile_String_String() throws IOException {
+        f.createNewFile();
+        RandomAccessFile raf = new java.io.RandomAccessFile(fileName, "r");
+        FileChannel fcr = raf.getChannel();
+
+        try {
+            fcr.lock(0L, Long.MAX_VALUE, false);
+            fail("NonWritableChannelException expected!");
+        } catch (NonWritableChannelException e) {}
         raf.close();
     }
 



Mime
View raw message