You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Andrew Zhang (JIRA)" <ji...@apache.org> on 2006/06/28 05:09:29 UTC

[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

[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


[jira] Closed: (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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-682?page=all ]
     
George Harley closed HARMONY-682:
---------------------------------


Verified by 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


[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

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
    [ 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


[jira] Assigned: (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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-682?page=all ]

George Harley reassigned HARMONY-682:
-------------------------------------

    Assign To: George Harley

> [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


[jira] Resolved: (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

Posted by "George Harley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-682?page=all ]
     
George Harley resolved HARMONY-682:
-----------------------------------

    Resolution: Fixed

Hi Andrew, 

Patch committed in revision 417706. Please could you verify that it has been applied as expected. 

Thanks for this enhancement.

Best regards, 
George

> [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


[jira] Updated: (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

Posted by "Andrew Zhang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-682?page=all ]

Andrew Zhang updated HARMONY-682:
---------------------------------

    Attachment: nio.diff

Hello,

Would you please try my patch?

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
>     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