import java.io.IOException; class NullArrayTest { public static int x(int j) throws IOException { if (j == 0) { double [1d] local a; foreach (p in [1 : 3]) { if (a == null) return 11; a[p] = 7; } } else if (j < 3) return x(j + 1); else if (j > 3) return x(j - 1); else throw new IOException(); return 0; } public static void main(String[] args) { int [1d] local a; try { x(0); } catch (Throwable e) {} System.out.println("Test 0 passed"); foreach (p in [1 : 8]) { if (p == [1]) break; a[p] += 2; } System.out.println("Test 1 passed"); try { foreach (p in [1 : 8]) { if (p == [1]) throw new IOException(); a[p] += 2; } } catch (Throwable e) {} System.out.println("Test 2 passed"); try { foreach (p in [1 : 8]) { if (p == [1]) x(5); a[p] += 2; } } catch (Throwable e) {} System.out.println("Test 3 passed"); } }