aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjack870131 <jack870131@outlook.com>2018-09-19 22:16:36 +0100
committerrnveach <rveach02@gmail.com>2018-09-19 20:43:04 -0400
commit27512b0acc3ad3cb4e28306d4f8936b9108c5bca (patch)
tree0e1f7635d1c94068d9162b57a8b5ec5c9d8c3505
parentecaa42035e4637106d442562cc151f9ec6d5a854 (diff)
downloadcheckstyle-mirror-upstream-master.tar.gz
Issue #5832: Add javadoc and xdoc Example for CatchParameterNamemirror-upstream-master
-rw-r--r--src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java21
-rw-r--r--src/xdocs/config_naming.xml20
2 files changed, 40 insertions, 1 deletions
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java
index 9871c01ac..e3530fe13 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.java
@@ -56,12 +56,31 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes;
* An example of how to configure the check for names that begin with a lower case letter,
* followed by any letters or digits is:
* </p>
+ * <p>Configuration:</p>
* <pre>
* &lt;module name="CatchParameterName"&gt;
* &lt;property name="format" value="^[a-z][a-zA-Z0-9]+$"/&gt;
* &lt;/module&gt;
* </pre>
- *
+ * <p>Example:</p>
+ * <pre>
+ * public class MyTest {
+ * public void myTest() {
+ * try {
+ * // ...
+ * } catch (ArithmeticException ex) { //OK
+ * // ...
+ * } catch (ArrayIndexOutOfBoundsException ex2) { //OK
+ * // ...
+ * } catch (IOException thirdException) { //OK
+ * // ...
+ * } catch (Exception FourthException) { // violation, the initial letter
+ * // should be lowercase
+ * // ...
+ * }
+ * }
+ * }
+ * </pre>
* @since 6.14
*/
public class CatchParameterNameCheck extends AbstractNameCheck {
diff --git a/src/xdocs/config_naming.xml b/src/xdocs/config_naming.xml
index ec6ea1ced..71bd1edbb 100644
--- a/src/xdocs/config_naming.xml
+++ b/src/xdocs/config_naming.xml
@@ -376,11 +376,31 @@ class AbstractThirdClass {} // OK, no "abstract" modifier
An example of how to configure the check for names that begin with
a lower case letter, followed by any letters or digits is:
</p>
+ <p>Configuration:</p>
<source>
&lt;module name="CatchParameterName"&gt;
&lt;property name="format" value="^[a-z][a-zA-Z0-9]+$"/&gt;
&lt;/module&gt;
</source>
+ <p>Example:</p>
+ <pre>
+public class MyTest {
+ public void myTest() {
+ try {
+ // ...
+ } catch (ArithmeticException ex) { //OK
+ // ...
+ } catch (ArrayIndexOutOfBoundsException ex2) { //OK
+ // ...
+ } catch (IOException thirdException) { //OK
+ // ...
+ } catch (Exception FourthException) { // violation, the initial letter
+ // should be lowercase
+ // ...
+ }
+ }
+}
+ </pre>
</subsection>
<subsection name="Example of Usage" id="CatchParameterName_Example_of_Usage">