OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [pr83.java] - Blame information for rev 765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 765 jeremybenn
// PR 83
2
 
3
/*
4
 * test that caught null pointers exceptions in finalizers work correctly
5
 * and that local variables are accessible in null pointer exception handlers.
6
 */
7
import java.io.*;
8
 
9
public class pr83 {
10
 
11
    static String s;
12
 
13
    public static void main(String[] args) {
14
        System.out.println(tryfinally() + s);
15
    }
16
 
17
    public static String tryfinally() {
18
        String yuck = null;
19
        String local_s = null;
20
 
21
        try {
22
            return "This is ";
23
        } finally {
24
            try {
25
                local_s = "Perfect";
26
                /* trigger null pointer exception */
27
                String x = yuck.toLowerCase();
28
            } catch (Exception _) {
29
                /*
30
                 * when the null pointer exception is caught, we must still
31
                 * be able to access local_s.
32
                 * Our return address for the finally clause must also still
33
                 * be intact.
34
                 */
35
                s = local_s;
36
            }
37
        }
38
    }
39
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.