aboutsummaryrefslogtreecommitdiffstats
path: root/tests/harness/ajctest/Driver.java
blob: dca23a71777d9e64ed2c5a1785a8d2bb531f4823 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/** Drive normal, system.exit, error or exception result from main */
public class Driver {

    /**
     * @param args {[-exit <number>|[-error|-exception] <string>]}
     */
    public static void main (String[] args) throws Exception {
        for (int i = 0; i < args.length; i++) {
            String arg = args[i];
            if ("-exit".equals(arg)) {
                System.exit(Integer.valueOf(args[i+1]).intValue());
            } else if ("-error".equals(arg)) {
                throw new Error(args[i+1]);
            } else if ("-exception".equals(arg)) {
                throw new RuntimeException(args[i+1]);
            }
        } 
    } 
}