blob: 94c6f5b8eb6061bb53549b6c306ab365954b8354 [file] [log] [blame]
Brian Carlstrom33f741e2011-10-03 11:24:05 -07001// Copyright 2011 Google Inc. All Rights Reserved.
2import java.io.IOException;
3
4public class ExceptionHandle {
5 int f() throws Exception {
6 try {
7 g(1);
8 } catch (IOException e) {
9 return 1;
10 } catch (Exception e) {
11 return 2;
12 }
13 try {
14 g(2);
15 } catch (IOException e) {
16 return 3;
17 }
18 return 0;
19 }
20 void g(int doThrow) throws Exception {
21 if (doThrow == 1) {
22 throw new Exception();
23 } else if (doThrow == 2) {
24 throw new IOException();
25 }
26 }
27}