View Javadoc
1   /**                                                                         //indent:0 exp:0
2    * This test-input is intended to be checked using following configuration: //indent:1 exp:1
3    *                                                                          //indent:1 exp:1
4    * arrayInitIndent = 2                                                      //indent:1 exp:1
5    * basicOffset = 2                                                          //indent:1 exp:1
6    * braceAdjustment = 2                                                      //indent:1 exp:1
7    * caseIndent = 2                                                           //indent:1 exp:1
8    * forceStrictCondition = false                                             //indent:1 exp:1
9    * lineWrappingIndentation = 4                                              //indent:1 exp:1
10   * tabWidth = 4                                                             //indent:1 exp:1
11   * throwsIndent = 4                                                         //indent:1 exp:1
12   *                                                                          //indent:1 exp:1
13   */                                                                         //indent:1 exp:1
14  
15  package com.puppycrawl.tools.checkstyle.checks.indentation.indentation;     //indent:0 exp:0
16  
17  public class InputIndentationCatchParametersOnNewLine {                     //indent:0 exp:0
18    public void test1() {                                                     //indent:2 exp:2
19      try {                                                                   //indent:4 exp:4
20        System.out.println("try0");                                           //indent:6 exp:6
21      } catch (NullPointerException                                           //indent:4 exp:4
22  | IllegalArgumentException t) {                                             //indent:0 exp:8 warn
23      }                                                                       //indent:4 exp:4
24    }                                                                         //indent:2 exp:2
25  
26    void test2() {                                                            //indent:2 exp:2
27      try {                                                                   //indent:4 exp:4
28        System.out.println("try");                                            //indent:6 exp:6
29      } catch (                                                               //indent:4 exp:4
30          @SuppressWarnings("PMD.AvoidCatchingGenericException")              //indent:8 exp:8
31      Exception e) {                                                          //indent:4 exp:8 warn
32        java.util.logging.Logger.getAnonymousLogger().severe(e.toString());   //indent:6 exp:6
33      }                                                                       //indent:4 exp:4
34  
35      try {                                                                   //indent:4 exp:4
36        System.out.println("try1");                                           //indent:6 exp:6
37      } catch (                                                               //indent:4 exp:4
38      @SuppressWarnings("PMD.AvoidCatchingGenericException")                  //indent:4 exp:8 warn
39          Exception e) {                                                      //indent:8 exp:8
40        java.util.logging.Logger.getAnonymousLogger().severe(e.toString());   //indent:6 exp:6
41      }                                                                       //indent:4 exp:4
42    }                                                                         //indent:2 exp:2
43  
44    void test3() {                                                            //indent:2 exp:2
45      try {                                                                   //indent:4 exp:4
46        System.out.println("try");                                            //indent:6 exp:6
47      } catch (                                                               //indent:4 exp:4
48              @SuppressWarnings("PMD.AvoidCatchingGenericException")          //indent:12 exp:8 warn
49          Exception e) {                                                      //indent:8 exp:8
50        java.util.logging.Logger.getAnonymousLogger().severe(e.toString());   //indent:6 exp:6
51      }                                                                       //indent:4 exp:4
52    }                                                                         //indent:2 exp:2
53  
54    void test4() {                                                            //indent:2 exp:2
55      try {                                                                   //indent:4 exp:4
56        System.out.println("try");                                            //indent:6 exp:6
57      } catch (NullPointerException                                           //indent:4 exp:4
58          | IllegalArgumentException t) {                                     //indent:8 exp:8
59      }                                                                       //indent:4 exp:4
60      try {                                                                   //indent:4 exp:4
61        System.out.println("try");                                            //indent:6 exp:6
62      } catch (                                                               //indent:4 exp:4
63          NullPointerException                                                //indent:8 exp:8
64          | IllegalArgumentException t) {                                     //indent:8 exp:12 warn
65      }                                                                       //indent:4 exp:4
66    }                                                                         //indent:2 exp:2
67  }                                                                           //indent:0 exp:0