From 81316fbcf583ce4469ce0332dc71556f25fb9cbb Mon Sep 17 00:00:00 2001 From: Tom Copeland Date: Fri, 26 Jul 2002 18:29:57 +0000 Subject: [PATCH] tweak git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@529 51baf565-9d33-0410-a72c-fc3788e3496d --- pmd/xdocs/howtowritearule.xml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/pmd/xdocs/howtowritearule.xml b/pmd/xdocs/howtowritearule.xml index f20ae4ab6b..35a4b828c9 100644 --- a/pmd/xdocs/howtowritearule.xml +++ b/pmd/xdocs/howtowritearule.xml @@ -160,6 +160,43 @@ public class WhileLoopsMustUseBracesRule extends AbstractRule { +

+ Now our rule is written - at least, the shell of it is - and now we need to tell PMD about it. We need + to add it to a rule set XML file. Look at rulesets/basic.xml; it's got lots of rule definitions that look like this: +

+ + + +Empty Catch Block finds instances where an exception is caught, +but nothing is done. In most circumstances, this swallows an exception +which should either be acted on or reported. + + + + public void doSomething() { + try { + FileInputStream fis = new FileInputStream("/tmp/bugger"); + } catch (IOException ioe) { + // not good + } + } + + + ]]> + +

+ Copy and paste one of these rules, then fill in the elements and attributes: +

+