View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks;
2   
3   import java.io.IOException;
4   
5   public class InputEmptyCatchBlockViolationsByComment
6   {
7       private void foo() {
8           try {
9               throw new RuntimeException();
10          } catch (Exception expected) //ok
11          {
12              //Expected
13          }
14      }
15      
16      private void foo1() {
17          try {
18              throw new RuntimeException();
19          } catch (Exception e) //warn
20          {}
21          
22      }
23      
24      private void foo2() {
25          try {
26              throw new IOException();
27          } catch (IOException | NullPointerException | ArithmeticException ignore) //warn 
28          {
29          }
30      }
31      
32      private void foo3() { // comment
33          try {
34              throw new IOException();
35          } catch (IOException | NullPointerException | ArithmeticException e) { //This is expected
36          }
37      }
38      
39      private void foo4() {
40          try {
41              throw new IOException();
42          } catch (IOException | NullPointerException | ArithmeticException e) { /* This is expected*/
43          }
44      }
45      
46      private void foo5() {
47          try {
48              throw new IOException();
49          } catch (IOException | NullPointerException | ArithmeticException e) { // Some singleline comment
50          }
51      }
52      private void some() {
53          try {
54              throw new IOException();
55          } catch (IOException e) //ok
56          {
57              /* ololo
58               * blalba
59               */
60          }
61      }
62      private void some1() {
63          try {
64              throw new IOException();
65          } catch (IOException e) //ok
66          {
67              /* lalala
68               * This is expected
69               */
70          }
71      }
72      private void some2() {
73          try {
74              throw new IOException();
75          } catch (IOException e) //ok
76          {
77              /*
78               * This is expected
79               * lalala
80               */
81          }
82      }
83      private void some3() {
84          try {
85              throw new IOException();
86          } catch (IOException e) //ok
87          {
88              // some comment
89              //This is expected
90          }
91      }
92      private void some4() {
93          try {
94              throw new IOException();
95          } catch (IOException e) //ok
96          {
97              //This is expected
98              // some comment
99          }
100     }
101     private void some5() {
102         try {
103             throw new IOException();
104         } catch (IOException e) //ok
105         {
106             /* some comment */
107             //This is expected
108         }
109     }
110 }