View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   ///////////////////////////////////////////////////////////////////////////////////////////////
4   package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks;
5   
6   import java.io.IOException;
7   
8   public class InputEmptyCatchBlockNoViolations
9   {
10      private void foo6() {
11          try {
12              throw new IOException();
13          } catch (IOException expected) { // This is expected
14              int k = 0;
15          }
16      }
17  
18      public void testTryCatch()
19      {
20          try {
21              int y=0;
22              int u=8;
23              int e=u-y;
24              return;
25          }
26          catch (Exception e) {
27              System.identityHashCode(e);
28              return;
29          }
30          finally
31          {
32              return;
33          }
34      }
35  
36      public void testTryCatch3()
37      {
38          try {
39              int y=0;
40              int u=8;
41              int e=u-y;
42          }
43          catch (IllegalArgumentException e) {
44              System.identityHashCode(e); //some comment
45              return;
46          }
47          catch (IllegalStateException ex) {
48                  System.identityHashCode(ex);
49                  return;
50          }
51      }
52  
53      public void testTryCatch4()
54      {
55          int y=0;
56          int u=8;
57          try {
58              int e=u-y;
59          }
60          catch (IllegalArgumentException e) {
61              System.identityHashCode(e);
62              return;
63          }
64      }
65      public void setFormats() {
66          try {
67              int k = 4;
68          } catch (Exception e) {
69              Object k = null;
70              if (k != null)
71                  k = "ss";
72              else {
73                  return;
74              }
75          }
76      }
77  }