View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="RegexpSinglelineJava">
5         <property name="format" value="\.info(.*)"/>
6         <property name="maximum" value="2"/>
7       </module>
8     </module>
9   </module>
10  */
11  package com.puppycrawl.tools.checkstyle.checks.regexp.regexpsinglelinejava;
12  
13  import java.io.FileReader;
14  import java.io.FileWriter;
15  import java.io.IOException;
16  import java.util.logging.Logger;
17  
18  // xdoc section -- start
19  class Example5 {
20  
21    private void testMethod1() {
22      int debug = 0;
23      System.out.println("");
24      System.out.
25      println("");
26    }
27  
28    private void testMethod2() throws IOException {
29      FileReader in = new FileReader("path/to/input");
30      int ch = in.read();
31      while(ch != -1) {
32        System.out.print((char)ch);
33        ch = in.read();
34      }
35  
36      FileWriter out = new FileWriter("path/to/output");
37      out.write("something");
38    }
39  
40    public void testMethod3(){
41      final Logger logger = Logger.getLogger(Example5.class.getName());
42      logger.info("first");
43      logger.info("second"); // violation, 'Line matches the illegal pattern'
44      logger.info("third");  // violation, 'Line matches the illegal pattern'
45      System.out.println("fourth");
46      logger.info("fifth");  // violation, 'Line matches the illegal pattern'
47    }
48  }
49  // xdoc section -- end