* sreal.h (sreal::shift): Fix sanity check.
[official-gcc.git] / libjava / testsuite / libjava.lang / Throw_3.java
blob5d9a2dc7ad44b44cf1ac3a81f708a25fcf2567c8
1 // Check that a NPE likely thrown from the first instruction of a
2 // method (foo) is properly caught.
3 public class Throw_3
5 public static void main(String[] args)
7 Throw_3 al = new Throw_3();
8 try
10 al.foo(null);
12 catch (NullPointerException npe)
14 StackTraceElement ste[] = npe.getStackTrace();
15 StackTraceElement top = ste[0];
16 if ("foo".equals(top.getMethodName()))
18 System.out.println("ok");
19 return;
22 System.out.println("bad");
25 public int bar(int[] a)
27 System.out.println("Bar");
28 return 5;
31 /**
32 * If the second parameter ('this' being the first) is passed in a
33 * register, then the first machine instruction in foo is likely to
34 * fault when null is passed.
36 public int foo(int[] a)
38 int l = a.length;
39 return l + l;