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] Commented: (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 09:47:31 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-682?page=comments#action_12418211 ] 

Andrew Zhang commented on HARMONY-682:
--------------------------------------

Hello George,

The fix looks fine, thanks!

Best regards,
Andrew

> [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
>     Assignee: George Harley
>     Priority: Minor
>  Attachments: nio.diff
>
> 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