Signed-off-by: Tomek Grabiec <[email protected]>
---
regression/jvm/ExceptionsTest.java | 58 ++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/regression/jvm/ExceptionsTest.java
b/regression/jvm/ExceptionsTest.java
index 152a043..b6e9876 100644
--- a/regression/jvm/ExceptionsTest.java
+++ b/regression/jvm/ExceptionsTest.java
@@ -388,6 +388,61 @@ public class ExceptionsTest extends TestCase {
takeObject(s);
}
+ public static void testAnewarray() {
+ boolean caught = false;
+ Object array[] = null;
+
+ try {
+ array = new Object[-1];
+ } catch (NegativeArraySizeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ takeObject(array);
+ }
+
+ public static void testNewarray() {
+ boolean caught = false;
+ int array[] = null;
+
+ try {
+ array = new int[-1];
+ } catch (NegativeArraySizeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ takeObject(array);
+ }
+
+ public static void testMultianewarray() {
+ boolean caught = false;
+ Object array[][] = null;
+
+ try {
+ array = new Object[1][-1];
+ } catch (NegativeArraySizeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ caught = false;
+ try {
+ array = new Object[-1][1];
+ } catch (NegativeArraySizeException e) {
+ caught = true;
+ }
+
+ assertTrue(caught);
+
+ takeObject(array);
+ }
+
+
public static void main(String args[]) {
testTryBlockDoesNotThrowAnything();
testThrowAndCatchInTheSameMethod();
@@ -411,6 +466,9 @@ public class ExceptionsTest extends TestCase {
testLdiv();
testLrem();
testCheckcast();
+ testAnewarray();
+ testNewarray();
+ testMultianewarray();
exit();
}
--
1.6.0.6
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel