Skip to content

Commit

Permalink
Issue checkstyle#7581: Add default config and code examples for Empty…
Browse files Browse the repository at this point in the history
…CatchBlock
  • Loading branch information
SGanguly1999 committed Mar 10, 2021
1 parent ef77e6a commit e85b958
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
Expand Up @@ -53,6 +53,34 @@
* </li>
* </ul>
* <p>
* To configure the check:
* </p>
* <pre>
* &lt;module name=&quot;EmptyCatchBlock&quot;/&gt;
* </pre>
* <p>
* Example:
* </p>
* <pre>
* try {
*
* }
* catch(Exception e) {
*
* } // violation
* </pre>
* <p>
* Example to show that check allows empty catch block with any comment inside:
* </p>
* <pre>
* try {
*
* }
* catch(Exception e) { // Comments allowed inside empty catch block
*
* } // ok
* </pre>
* <p>
* To configure the check to suppress empty catch block if exception's variable name is
* {@code expected} or {@code ignore} or there's any comment inside:
* </p>
Expand Down
28 changes: 28 additions & 0 deletions src/xdocs/config_blocks.xml
Expand Up @@ -447,6 +447,34 @@ public class Test {
</subsection>

<subsection name="Examples" id="EmptyCatchBlock_Examples">
<p>
To configure the check:
</p>
<source>
&lt;module name=&quot;EmptyCatchBlock&quot;/&gt;
</source>
<p>
Example:
</p>
<source>
try {

}
catch(Exception e) {

} // violation
</source>
<p>
Example to show that check allows empty catch block with any comment inside:
</p>
<source>
try {

}
catch(Exception e) { // Comments allowed inside empty catch block

} // ok
</source>
<p>
To configure the check to suppress empty catch block if exception's variable name is
<code>expected</code> or <code>ignore</code> or there's any comment inside:
Expand Down

0 comments on commit e85b958

Please sign in to comment.