You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Svetlana Samoilenko (JIRA)" <ji...@apache.org> on 2006/04/20 12:12:06 UTC
[jira] Commented: (HARMONY-377)
java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't
throw IndexOutOfBoundsException
[ http://issues.apache.org/jira/browse/HARMONY-377?page=comments#action_12375316 ]
Svetlana Samoilenko commented on HARMONY-377:
---------------------------------------------
Mikhail, thank you, bug is not reproducible with latest sources.
> java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't throw IndexOutOfBoundsException
> ------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-377
> URL: http://issues.apache.org/jira/browse/HARMONY-377
> Project: Harmony
> Type: Bug
> Components: Classlib
> Reporter: Svetlana Samoilenko
> Assignee: Mikhail Loenko
> Attachments: RandomAccessFile.diffs, RandomAccessFileTest.java
>
> java.io.RandomAccessFile.read(byte[] b,int off,int len) and write(byte[] b,int off,int len) methods don't throw IndexOutOfBoundsException
> if off is negative, or len is negative, or off+len is greater than the length of the array b.
> Code to reproduce:
> import java.io.File;
> import java.io.RandomAccessFile;
> import java.io.IOException;
> public class test {
> public static void main(String[] args) throws IOException {
> File file=File.createTempFile("two",null);
> RandomAccessFile rfl= new RandomAccessFile(file,"rw");
> try {
> rfl.write(new byte[1], -1, 1);
> System.out.println("method write: IndexOutOfBoundsException must be thrown if off <0");
> } catch (IndexOutOfBoundsException e) {
> // expected
> }
> try {
> rfl.write(new byte[1], 0, -1);
> System.out.println("method write: IndexOutOfBoundsException must be thrown if len <0") ;
> } catch (IndexOutOfBoundsException e) {
> // expected
> }
> try {
> rfl.write(new byte[1], 0, 5);
> System.out.println("method write: IndexOutOfBoundsException must be thrown if off+len > b.lengh");
> } catch (IndexOutOfBoundsException e) {
> // expected
> }
> try {
> rfl.read(new byte[1], -1, 1);
> System.out.println("method read: IndexOutOfBoundsException must be thrown if off <0");
> } catch (IndexOutOfBoundsException e) {
> // expected
> }
> try {
> rfl.read(new byte[1], 0, -1);
> System.out.println("method read: IndexOutOfBoundsException must be thrown if len <0") ;
> } catch (IndexOutOfBoundsException e) {
> // expected
> }
> try {
> rfl.read(new byte[1], 0, 5);
> System.out.println("method read: IndexOutOfBoundsException must be thrown if off+len > b.lengh");
> } catch (IndexOutOfBoundsException e) {
> // expected
> }
> }
> }
--
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