harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghar...@apache.org
Subject svn commit: r417706 - in /incubator/harmony/enhanced/classlib/trunk/modules/nio/src: main/java/java/nio/channels/FileLock.java test/java/org/apache/harmony/tests/java/nio/channels/FileLockTest.java
Date Wed, 28 Jun 2006 09:35:57 GMT
Author: gharley
Date: Wed Jun 28 02:35:56 2006
New Revision: 417706

URL: http://svn.apache.org/viewvc?rev=417706&view=rev
Log:
HARMONY 682 : FileLock constructor should throw IllegalArgumentException when the sum of position
and size is non-negative

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/FileLock.java
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/FileLockTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/FileLock.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/FileLock.java?rev=417706&r1=417705&r2=417706&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/FileLock.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/java/nio/channels/FileLock.java
Wed Jun 28 02:35:56 2006
@@ -97,7 +97,7 @@
 	protected FileLock(FileChannel channel, long position, long size,
 			boolean shared) {
 		super();
-		if (position < 0 || size < 0) {
+		if (position < 0 || size < 0 || position + size < 0) {
 			throw new IllegalArgumentException();
 		}
 		this.channel = channel;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/FileLockTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/FileLockTest.java?rev=417706&r1=417705&r2=417706&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/FileLockTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/test/java/org/apache/harmony/tests/java/nio/channels/FileLockTest.java
Wed Jun 28 02:35:56 2006
@@ -79,6 +79,13 @@
 		} catch (IllegalArgumentException ex) {
 			// expected
 		}
+        // Harmony-682 regression test
+        try {
+            new MockFileLock(readWriteChannel, Long.MAX_VALUE, 1, false);
+            fail("should throw IllegalArgumentException.");
+        } catch (IllegalArgumentException ex) {
+            // expected
+        }
 	}
 
 	/**



Mime
View raw message