Skip to content

Commit 200017a

Browse files
committed
Add test for ArrayIndexOutOfBoundsException
The new test is similar to ArrayIndexOutOfBoundsException1. It checks that an ArrayIndexOutOfBoundsException is correctly caught if the catch block specifies one of its superclasses.
1 parent 379e415 commit 200017a

9 files changed

+32
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class ArrayIndexOutOfBoundsExceptionTest {
2+
public static void main(String args[]) {
3+
try {
4+
int[] a=new int[4];
5+
a[4]=0;
6+
}
7+
catch (Exception exc) {
8+
assert false;
9+
}
10+
}
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package java.lang;
2+
3+
public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package java.lang;
2+
3+
public class IndexOutOfBoundsException extends RuntimeException {
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package java.lang;
2+
3+
public class RuntimeException extends Exception {
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
ArrayIndexOutOfBoundsExceptionTest.class
3+
--java-throw-runtime-exceptions
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^.*assertion at file ArrayIndexOutOfBoundsExceptionTest.java line 8 function.*: FAILURE$
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring

0 commit comments

Comments
 (0)