harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-682) [classlib][nio] java.nio.channels.FileLock(FileChannel, long , long ,boolean) should throw IllegalArgumentException when the sum of position and size is non-negative
Date Wed, 28 Jun 2006 03:09:29 GMT
[classlib][nio] java.nio.channels.FileLock(FileChannel, long , long ,boolean) should throw
IllegalArgumentException when the sum of position and size is non-negative
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

         Key: HARMONY-682
         URL: http://issues.apache.org/jira/browse/HARMONY-682
     Project: Harmony
        Type: Bug

  Components: Classlib  
    Reporter: Andrew Zhang
    Priority: Minor


java.nio.channels.FileLock(FileChannel, long , long ,boolean) should throw IllegalArgumentException


when the sum position + size is non-negative.  

Spec says "The size of the locked region; must be non-negative, and the sum position + size
must be non-negative".

I'll upload a patch soon. Thanks!

Following test reproduces the bug.

class MockFileLock extends FileLock {

	boolean isValid = true;

	protected MockFileLock(FileChannel channel, long position, long size, boolean shared) {
		super(channel, position, size, shared);
	}
	public boolean isValid() {
		return isValid;
	}

	public void release() throws IOException {
		isValid = false;
	}
}

public void test_Constructor_Ljava_nio_channels_FileChannelJJB() {
		try {
			new MockFileLock(null, Long.MAX_VALUE, 1, false);
			fail("should throw IllegalArgumentException.");
		} catch (IllegalArgumentException ex) {
			// expected
		}	
	}

RI passes but Harmony fails.


Best regards,
Andrew

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message