pstacktrace(e);
}
- try {
- p("NullPointerException (native):");
- System.arraycopy(null, 1, null, 1, 1);
- pln("FAILED");
- } catch (Exception e) {
- pln("OK");
- }
-
pln();
pln("---------- some asmpart exceptions --------------");
try {
- p("ExceptionInInitializerError (clinit):");
+ p("NullPointerException in <clinit> (PUTSTATIC):");
extest_clinit.i = 1;
pln("FAILED");
} catch (ExceptionInInitializerError e) {
}
}
+ try {
+ p("NullPointerException in <clinit> (GETSTATIC):");
+ int i = extest_clinit.i;
+ pln("FAILED");
+ } catch (ExceptionInInitializerError e) {
+ if (e.getCause().getClass() != NullPointerException.class) {
+ pln("FAILED");
+ } else {
+ pln("OK");
+ pstacktrace(e);
+ }
+ }
+
try {
p("ArithmeticException (idiv):");
int i = 1, j = 0, k = i / j;
pln();
+ pln("---------- native stub exceptions ---------------");
+
+ try {
+ p("NullPointerException (native):");
+ System.arraycopy(null, 1, null, 1, 1);
+ pln("FAILED");
+ } catch (Exception e) {
+ pln("OK");
+ }
+
+ try {
+ p("NullPointerException in <clinit>:");
+ extest_clinit.sub();
+ pln("FAILED");
+ } catch (ExceptionInInitializerError e) {
+ pln("OK");
+ pstacktrace(e);
+ }
+
+ pln();
+
+
pln("---------- no OK beyond this point --------------");
pln("NullPointerException (without catch):");
public static void p(String s) {
System.out.print(s);
- for (int i = s.length(); i < 42; i++) {
+ for (int i = s.length(); i < 46; i++) {
System.out.print(" ");
}
}