1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="SuppressWithNearbyCommentFilter"> 5 <property name="commentFormat" 6 value="ok,?\s*(?:allowed\s+)?to catch (\w+) here"/> 7 <property name="checkFormat" value="IllegalCatchCheck"/> 8 <property name="messageFormat" value="$1"/> 9 <property name="influenceFormat" value="-1"/> 10 </module> 11 <module name="IllegalCatch"/> 12 </module> 13 </module> 14 */ 15 package com.puppycrawl.tools.checkstyle.filters.suppresswithnearbycommentfilter; 16 // xdoc section -- start 17 public class Example3 { 18 public void doStuff() { 19 try { 20 // blah blah blah 21 } 22 // filtered violation below 'Catching 'RuntimeException' is not allowed' 23 catch(RuntimeException re) { 24 // ok, allowed to catch RuntimeException here 25 } 26 } 27 } 28 // xdoc section -- end