1
2
3
4
5
6
7
8
9 package com.puppycrawl.tools.checkstyle.checks.coding.fallthrough;
10
11 import java.io.IOException;
12
13 public class InputFallThroughTryCatchInSwitch {
14 public int foo(int x) {
15 switch (x) {
16 case 1:
17 try {
18
19 throw new IOException("Exception occurred.");
20 } catch (IOException e) {
21
22 if (e.getMessage().contains("Exception")) {
23 break;
24 } else {
25 return 0;
26 }
27 } catch (Exception e) {
28
29 for (int i = 0; i < 3; i++) {
30 if (i == 1) {
31 break;
32 }
33 }
34 } finally {
35
36 }
37 default:
38
39 }
40
41 return 0;
42 }
43 }