summaryrefslogtreecommitdiff
path: root/java/java-tests/testData/inspection/dataFlow/fixture/CatchThrowable.java
blob: a30d934f64b697d1a6f79013870bec85bb1107a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Random;

class BrokenAlignment {

  public static void main(String[] args) {

    Throwable error = null;
    try {
      doSomething();
    } catch (AssertionError e) {
      // rethrow error
      throw e;
    } catch (Throwable e) {
      // remember error
      error = e;
    }

    if (error != null) { // <<--- inspection warning
      // handle error ...
    }

  }

  public static void doSomething() {
    if (new Random().nextInt() > 2) throw new RuntimeException("dummy");
  }

}