View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.coding.requirethis;
2   
3   public class InputRequireThisCatchVariables extends Thread {
4       private Throwable ex;
5   
6       public InputRequireThisCatchVariables(Throwable ex) {
7           this.ex = ex;
8       }
9   
10      @Override
11      public void run() {
12          if (this.ex != null) {
13              try {
14                  exceptional(this.ex);
15              }
16              catch (RuntimeException ex) {
17                  if (ex == this.ex) {
18                      debug("Expected exception thrown", ex);
19                  }
20                  else {
21                      ex.printStackTrace();
22                  }
23              }
24              catch (Error err) {
25                  if (err == this.ex) {
26                      debug("Expected exception thrown", err);
27                  }
28                  else {
29                      ex.printStackTrace();
30                  }
31              }
32              catch (Throwable ex) {
33                  ex.printStackTrace();
34              }
35          }
36      }
37  
38      private static void exceptional(Throwable ex) {}
39      private static void debug(String message, Throwable err) {}
40  }