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/19 07:13:17 UTC
[jira] Created: (HARMONY-377)
java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't
throw IndexOutOfBoundsException
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
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
[jira] Closed: (HARMONY-377)
java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't
throw IndexOutOfBoundsException
Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-377?page=all ]
Mikhail Loenko closed HARMONY-377:
----------------------------------
verified by Svetlana
> 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
[jira] Updated: (HARMONY-377)
java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't
throw IndexOutOfBoundsException
Posted by "Svetlana Samoilenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-377?page=all ]
Svetlana Samoilenko updated HARMONY-377:
----------------------------------------
Attachment: RandomAccessFile.diffs
patch
> 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
> 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
[jira] Resolved: (HARMONY-377)
java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't
throw IndexOutOfBoundsException
Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-377?page=all ]
Mikhail Loenko resolved HARMONY-377:
------------------------------------
Resolution: Fixed
fixed in revision 395188
Svetlana, I have not apply your patch, I've fixed it in a different way, please verify that is resolves your problem.
> 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
[jira] Assigned: (HARMONY-377)
java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't
throw IndexOutOfBoundsException
Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-377?page=all ]
Mikhail Loenko reassigned HARMONY-377:
--------------------------------------
Assign To: Mikhail Loenko
> 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
[jira] Updated: (HARMONY-377)
java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't
throw IndexOutOfBoundsException
Posted by "Svetlana Samoilenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-377?page=all ]
Svetlana Samoilenko updated HARMONY-377:
----------------------------------------
Attachment: RandomAccessFileTest.java
unit test
> 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
> Attachments: 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
[jira] Commented: (HARMONY-377)
java.io.RandomAccessFile.read/write(byte[] b,int off,int len) methods don't
throw IndexOutOfBoundsException
Posted by "Svetlana Samoilenko (JIRA)" <ji...@apache.org>.
[ 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