##### Overview

- Download PMD 5.0.4
- What's new in PMD 5.0.4
- PMD in the news
- PMD-related products and books
- Best practices
- Future directions
- Similar projects
- Credits
- License
- What does 'PMD' mean?

##### Usage

- Installation
- Command line usage
- Ant task usage
- Maven plugin usage
- Mvn plugin usage
- IDE plugin usage
- Suppressing warnings
- Finding duplicated code
- JSP support

##### Customizing PMD

- Compiling PMD
- How to write a rule
- Writing XPath rules
- How to make a rule set
- How it works
- Rule guidelines
- PMD developers information
- PMD Release Process

##### For example

- Run PMD on a Sourceforge project

##### Misc.

- XPath tutorial (Gregorian)

##### Rule Sets

- ecmascript
  - Basic Ecmascript
  - Braces
  - Unnecessary
- java
  - Android
  - Basic
  - Braces
  - Clone Implementation
  - Code Size
  - Comments
  - Controversial
  - Coupling
  - Design
  - Empty Code
  - Finalizer
  - Import Statements
  - J2EE
  - JavaBeans
  - JUnit
  - Jakarta Commons Logging
  - Java Logging
  - Migration
  - Naming
  - Optimization
  - Strict Exceptions
  - String and StringBuffer
  - Security Code Guidelines
  - Type Resolution
  - Unnecessary
  - Unused Code
- jsp
  - Basic JSF
  - Basic JSP
- xml
  - Basic XML
- xsl
  - XPath in XSL

##### Project Documentation

- Project Information
- Project Reports
  - Source Xref
  - Test Source Xref
  - JavaDocs
  - Test JavaDocs
  - PMD Report
  - CPD Report
  - Checkstyle
  - Checkstyle
  - Surefire Report
  - Clover

## PMD Results

The following document contains the results of PMD 4.3.

## Files

### net/sourceforge/pmd/RuleSet.java

Violation | Line
--- | ---
A catch statement that catches an exception only to rethrow it should be avoided. | 285 - 287
A catch statement should never catch throwable since it includes errors. | 287

### net/sourceforge/pmd/cli/PMDCommandLineInterface.java

Violation | Line
--- | ---
Avoid unused imports such as 'net.sourceforge.pmd.lang.LanguageVersion' | 11

### net/sourceforge/pmd/cli/PMDParameters.java

Violation | Line
--- | ---
Avoid unused imports such as 'com.beust.jcommander.IParameterValidator' | 11

### net/sourceforge/pmd/cpd/CsTokenizer.java

Violation | Line
--- | ---
No need to call String.valueOf to append to a string. | 54
No need to call String.valueOf to append to a string. | 62
No need to call String.valueOf to append to a string. | 62
No need to call String.valueOf to append to a string. | 67
No need to call String.valueOf to append to a string. | 67
No need to call String.valueOf to append to a string. | 85
No need to call String.valueOf to append to a string. | 85
No need to call String.valueOf to append to a string. | 103

### net/sourceforge/pmd/dcd/graph/MemberNode.java

Violation | Line
--- | ---
Avoid unused private fields such as 'decoration'. | 26

### net/sourceforge/pmd/lang/ast/AbstractNode.java

Violation | Line
--- | ---
JUnit 4 tests that execute tests should use the @Test annotation | 111 - 113
JUnit 4 tests that execute tests should use the @Test annotation | 127 - 129
JUnit 4 tests that execute tests should use the @Test annotation | 135 - 137
JUnit 4 tests that execute tests should use the @Test annotation | 143 - 145

### net/sourceforge/pmd/lang/ast/xpath/saxon/AbstractNodeInfo.java

Violation | Line
--- | ---
Ensure you override both equals() and hashCode() | 105

### net/sourceforge/pmd/lang/dfa/SequenceChecker.java

Violation | Line
--- | ---
Avoid unused private fields such as 'type'. | 33

### net/sourceforge/pmd/lang/ecmascript/ast/EcmascriptTreeBuilder.java

Violation | Line
--- | ---
Avoid unused local variables such as 'problemStart'. | 220

### net/sourceforge/pmd/lang/java/rule/comments/CommentContentRule.java

Violation | Line
--- | ---
Perhaps 'wordsAreRegex' could be replaced by a local variable. | 30
Avoid unused private fields such as 'wordsAreRegex'. | 30

### net/sourceforge/pmd/lang/java/rule/comments/CommentRequiredRule.java

Violation | Line
--- | ---
Perhaps 'label' could be replaced by a local variable. | 17

### net/sourceforge/pmd/lang/java/rule/comments/HeaderCommentsRule.java

Violation | Line
--- | ---
Perhaps 'label' could be replaced by a local variable. | 30

### net/sourceforge/pmd/lang/java/rule/logging/MoreThanOneLoggerRule.java

Violation | Line
--- | ---
A catch statement should never catch throwable since it includes errors. | 27
A catch statement should never catch throwable since it includes errors. | 33

### net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java

Violation | Line
--- | ---
A catch statement should never catch throwable since it includes errors. | 695

### net/sourceforge/pmd/lang/java/typeresolution/PMDASMClassLoader.java

Violation | Line
--- | ---
Avoid unused imports such as 'java.util.Collections' | 8

### net/sourceforge/pmd/lang/ast/JavaCharStream.java

Violation | Line
--- | ---
A catch statement should never catch throwable since it includes errors. | 126

### net/sourceforge/pmd/lang/ast/SimpleCharStream.java

Violation | Line
--- | ---
A catch statement should never catch throwable since it includes errors. | 78

### net/sourceforge/pmd/lang/ast/TokenMgrError.java

Violation | Line
--- | ---
Overriding method merely calls super | 117 - 119

### net/sourceforge/pmd/lang/java/ast/JavaParser.java

Violation | Line
--- | ---
Avoid unused imports such as 'net.sourceforge.pmd.PMD' | 4
Avoid unused imports such as 'net.sourceforge.pmd.lang.ast.TokenMgrError' | 6
An empty statement (semicolon) not part of a loop | 133
An empty statement (semicolon) not part of a loop | 139
An empty statement (semicolon) not part of a loop | 166
An empty statement (semicolon) not part of a loop | 180
An empty statement (semicolon) not part of a loop | 188
A catch statement should never catch throwable since it includes errors. | 195
An empty statement (semicolon) not part of a loop | 227
A catch statement should never catch throwable since it includes errors. | 238
An empty statement (semicolon) not part of a loop | 273
An empty statement (semicolon) not part of a loop | 284
A catch statement should never catch throwable since it includes errors. | 287
An empty statement (semicolon) not part of a loop | 318
A catch statement should never catch throwable since it includes errors. | 433
An empty statement (semicolon) not part of a loop | 483
An empty statement (semicolon) not part of a loop | 504
An empty statement (semicolon) not part of a loop | 512
An empty statement (semicolon) not part of a loop | 520
A catch statement should never catch throwable since it includes errors. | 523
Avoid unused local variables such as 'extendsMoreThanOne'. | 548
An empty statement (semicolon) not part of a loop | 556
A catch statement should never catch throwable since it includes errors. | 566
An empty statement (semicolon) not part of a loop | 599
A catch statement should never catch throwable since it includes errors. | 608
An empty statement (semicolon) not part of a loop | 652
A catch statement should never catch throwable since it includes errors. | 655
An empty statement (semicolon) not part of a loop | 690
An empty statement (semicolon) not part of a loop | 702
An empty statement (semicolon) not part of a loop | 711
An empty statement (semicolon) not part of a loop | 724
An empty statement (semicolon) not part of a loop | 732
An empty statement (semicolon) not part of a loop | 767
An empty statement (semicolon) not part of a loop | 778
A catch statement should never catch throwable since it includes errors. | 781
An empty statement (semicolon) not part of a loop | 816
An empty statement (semicolon) not part of a loop | 824
A catch statement should never catch throwable since it includes errors. | 826
An empty statement (semicolon) not part of a loop | 860
A catch statement should never catch throwable since it includes errors. | 870
An empty statement (semicolon) not part of a loop | 905
A catch statement should never catch throwable since it includes errors. | 907
An empty statement (semicolon) not part of a loop | 940
A catch statement should never catch throwable since it includes errors. | 949
An empty statement (semicolon) not part of a loop | 1007
A catch statement should never catch throwable since it includes errors. | 1016
A catch statement should never catch throwable since it includes errors. | 1115
An empty statement (semicolon) not part of a loop | 1148
A catch statement should never catch throwable since it includes errors. | 1158
An empty statement (semicolon) not part of a loop | 1193
A catch statement should never catch throwable since it includes errors. | 1195
An empty statement (semicolon) not part of a loop | 1227
A catch statement should never catch throwable since it includes errors. | 1294
An empty statement (semicolon) not part of a loop | 1356
An empty statement (semicolon) not part of a loop | 1366
An empty statement (semicolon) not part of a loop | 1374
A catch statement should never catch throwable since it includes errors. | 1377
An empty statement (semicolon) not part of a loop | 1410
An empty statement (semicolon) not part of a loop | 1421
A catch statement should never catch throwable since it includes errors. | 1435
An empty statement (semicolon) not part of a loop | 1471
A catch statement should never catch throwable since it includes errors. | 1480
An empty statement (semicolon) not part of a loop | 1525
An empty statement (semicolon) not part of a loop | 1537
A catch statement should never catch throwable since it includes errors. | 1540
An empty statement (semicolon) not part of a loop | 1572
An empty statement (semicolon) not part of a loop | 1597
An empty statement (semicolon) not part of a loop | 1614
A catch statement should never catch throwable since it includes errors. | 1617
An empty statement (semicolon) not part of a loop | 1651
An empty statement (semicolon) not part of a loop | 1662
An empty statement (semicolon) not part of a loop | 1668
An empty statement (semicolon) not part of a loop | 1673
A catch statement should never catch throwable since it includes errors. | 1683
An empty statement (semicolon) not part of a loop | 1750
An empty statement (semicolon) not part of a loop | 1758
A catch statement should never catch throwable since it includes errors. | 1771
An empty statement (semicolon) not part of a loop | 1805
A catch statement should never catch throwable since it includes errors. | 1808
A catch statement should never catch throwable since it includes errors. | 1858
An empty statement (semicolon) not part of a loop | 1901
An empty statement (semicolon) not part of a loop | 1912
A catch statement should never catch throwable since it includes errors. | 1926
An empty statement (semicolon) not part of a loop | 1959
An empty statement (semicolon) not part of a loop | 1964
An empty statement (semicolon) not part of a loop | 1974
A catch statement should never catch throwable since it includes errors. | 1980
An empty statement (semicolon) not part of a loop | 2015
A catch statement should never catch throwable since it includes errors. | 2038
An empty statement (semicolon) not part of a loop | 2086
A catch statement should never catch throwable since it includes errors. | 2094
A catch statement should never catch throwable since it includes errors. | 2135
A catch statement should never catch throwable since it includes errors. | 2249
An empty statement (semicolon) not part of a loop | 2284
An empty statement (semicolon) not part of a loop | 2313
A catch statement should never catch throwable since it includes errors. | 2322
An empty statement (semicolon) not part of a loop | 2371
A catch statement should never catch throwable since it includes errors. | 2373
An empty statement (semicolon) not part of a loop | 2502
A catch statement should never catch throwable since it includes errors. | 2504
An empty statement (semicolon) not part of a loop | 2536
A catch statement should never catch throwable since it includes errors. | 2545
An empty statement (semicolon) not part of a loop | 2577
A catch statement should never catch throwable since it includes errors. | 2586
An empty statement (semicolon) not part of a loop | 2618
A catch statement should never catch throwable since it includes errors. | 2627
An empty statement (semicolon) not part of a loop | 2659
A catch statement should never catch throwable since it includes errors. | 2668
An empty statement (semicolon) not part of a loop | 2700
A catch statement should never catch throwable since it includes errors. | 2709
An empty statement (semicolon) not part of a loop | 2742
A catch statement should never catch throwable since it includes errors. | 2764
An empty statement (semicolon) not part of a loop | 2799
A catch statement should never catch throwable since it includes errors. | 2801
An empty statement (semicolon) not part of a loop | 2836
A catch statement should never catch throwable since it includes errors. | 2866
An empty statement (semicolon) not part of a loop | 2897
A catch statement should never catch throwable since it includes errors. | 2919
An empty statement (semicolon) not part of a loop | 2952
A catch statement should never catch throwable since it includes errors. | 2974
An empty statement (semicolon) not part of a loop | 3008
A catch statement should never catch throwable since it includes errors. | 3034
A catch statement should never catch throwable since it includes errors. | 3117
A catch statement should never catch throwable since it includes errors. | 3146
A catch statement should never catch throwable since it includes errors. | 3175
A catch statement should never catch throwable since it includes errors. | 3258
An empty statement (semicolon) not part of a loop | 3371
A catch statement should never catch throwable since it includes errors. | 3373
A catch statement should never catch throwable since it includes errors. | 3419
An empty statement (semicolon) not part of a loop | 3450
A catch statement should never catch throwable since it includes errors. | 3456
A catch statement should never catch throwable since it includes errors. | 3489
Avoid unused local variables such as 't'. | 3514
A catch statement should never catch throwable since it includes errors. | 3565
A catch statement should never catch throwable since it includes errors. | 3629
A catch statement should never catch throwable since it includes errors. | 3700
An empty statement (semicolon) not part of a loop | 3803
A catch statement should never catch throwable since it includes errors. | 3806
An empty statement (semicolon) not part of a loop | 3838
A catch statement should never catch throwable since it includes errors. | 3847
An empty statement (semicolon) not part of a loop | 3889
An empty statement (semicolon) not part of a loop | 3903
A catch statement should never catch throwable since it includes errors. | 3918
An empty statement (semicolon) not part of a loop | 3956
An empty statement (semicolon) not part of a loop | 3964
An empty statement (semicolon) not part of a loop | 3980
A catch statement should never catch throwable since it includes errors. | 3995
A catch statement should never catch throwable since it includes errors. | 4103
A catch statement should never catch throwable since it includes errors. | 4134
An empty statement (semicolon) not part of a loop | 4165
A catch statement should never catch throwable since it includes errors. | 4175
An empty statement (semicolon) not part of a loop | 4216
A catch statement should never catch throwable since it includes errors. | 4223
An empty statement (semicolon) not part of a loop | 4255
An empty statement (semicolon) not part of a loop | 4281
A catch statement should never catch throwable since it includes errors. | 4290
An empty statement (semicolon) not part of a loop | 4385
A catch statement should never catch throwable since it includes errors. | 4395
An empty statement (semicolon) not part of a loop | 4432
An empty statement (semicolon) not part of a loop | 4442
A catch statement should never catch throwable since it includes errors. | 4450
A catch statement should never catch throwable since it includes errors. | 4493
An empty statement (semicolon) not part of a loop | 4533
A catch statement should never catch throwable since it includes errors. | 4538
A catch statement should never catch throwable since it includes errors. | 4570
A catch statement should never catch throwable since it includes errors. | 4604
An empty statement (semicolon) not part of a loop | 4698
An empty statement (semicolon) not part of a loop | 4734
An empty statement (semicolon) not part of a loop | 4766
A catch statement should never catch throwable since it includes errors. | 4777
A catch statement should never catch throwable since it includes errors. | 4840
An empty statement (semicolon) not part of a loop | 4872
A catch statement should never catch throwable since it includes errors. | 4881
A catch statement should never catch throwable since it includes errors. | 4909
An empty statement (semicolon) not part of a loop | 4944
An empty statement (semicolon) not part of a loop | 4968
An empty statement (semicolon) not part of a loop | 5018
A catch statement should never catch throwable since it includes errors. | 5021
A catch statement should never catch throwable since it includes errors. | 5051
A catch statement should never catch throwable since it includes errors. | 5083
An empty statement (semicolon) not part of a loop | 5117
An empty statement (semicolon) not part of a loop | 5124
An empty statement (semicolon) not part of a loop | 5138
A catch statement should never catch throwable since it includes errors. | 5140
An empty statement (semicolon) not part of a loop | 5173
A catch statement should never catch throwable since it includes errors. | 5176
An empty statement (semicolon) not part of a loop | 5207
A catch statement should never catch throwable since it includes errors. | 5214
An empty statement (semicolon) not part of a loop | 5246
A catch statement should never catch throwable since it includes errors. | 5269
A catch statement should never catch throwable since it includes errors. | 5301
A catch statement should never catch throwable since it includes errors. | 5330
An empty statement (semicolon) not part of a loop | 5368
A catch statement should never catch throwable since it includes errors. | 5371
A catch statement should never catch throwable since it includes errors. | 5462
An empty statement (semicolon) not part of a loop | 5498
A catch statement should never catch throwable since it includes errors. | 5504
A catch statement should never catch throwable since it includes errors. | 5536
A catch statement should never catch throwable since it includes errors. | 5571
An empty statement (semicolon) not part of a loop | 5603
A catch statement should never catch throwable since it includes errors. | 5612
A catch statement should never catch throwable since it includes errors. | 5643
A catch statement should never catch throwable since it includes errors. | 5712
An empty statement (semicolon) not part of a loop | 5775
An empty statement (semicolon) not part of a loop | 5788
An empty statement (semicolon) not part of a loop | 5793
A catch statement should never catch throwable since it includes errors. | 5796
A catch statement should never catch throwable since it includes errors. | 5830
An empty statement (semicolon) not part of a loop | 5885
A catch statement should never catch throwable since it includes errors. | 5894
A catch statement should never catch throwable since it includes errors. | 5993
An empty statement (semicolon) not part of a loop | 6031
A catch statement should never catch throwable since it includes errors. | 6037
A catch statement should never catch throwable since it includes errors. | 6066
System.arraycopy is more efficient | 9808 - 9810

### net/sourceforge/pmd/lang/java/ast/JavaParserTokenManager.java

Violation | Line
--- | ---
Avoid unused imports such as 'net.sourceforge.pmd.PMD' | 4
Avoid unused private fields such as 'lengthOfMatch'. | 2062

### net/sourceforge/pmd/lang/jsp/ast/JJTJspParserState.java

Violation | Line
--- | ---
Avoid instantiating Integer objects. Call Integer.valueOf() instead. | 79

### net/sourceforge/pmd/lang/jsp/ast/JspParser.java

Violation | Line
--- | ---
Avoid unused imports such as 'net.sourceforge.pmd.lang.ast.TokenMgrError' | 5
A catch statement should never catch throwable since it includes errors. | 58
An empty statement (semicolon) not part of a loop | 90
An empty statement (semicolon) not part of a loop | 111
An empty statement (semicolon) not part of a loop | 119
An empty statement (semicolon) not part of a loop | 140
An empty statement (semicolon) not part of a loop | 167
A catch statement should never catch throwable since it includes errors. | 195
An empty statement (semicolon) not part of a loop | 269
A catch statement should never catch throwable since it includes errors. | 278
An empty statement (semicolon) not part of a loop | 418
A catch statement should never catch throwable since it includes errors. | 428
An empty statement (semicolon) not part of a loop | 605
An empty statement (semicolon) not part of a loop | 646
An empty statement (semicolon) not part of a loop | 668
A catch statement should never catch throwable since it includes errors. | 683
A catch statement should never catch throwable since it includes errors. | 714
An empty statement (semicolon) not part of a loop | 758
An empty statement (semicolon) not part of a loop | 803
An empty statement (semicolon) not part of a loop | 848
A catch statement should never catch throwable since it includes errors. | 883
An empty statement (semicolon) not part of a loop | 960
An empty statement (semicolon) not part of a loop | 993
A catch statement should never catch throwable since it includes errors. | 1002
An empty statement (semicolon) not part of a loop | 1039
An empty statement (semicolon) not part of a loop | 1051
An empty statement (semicolon) not part of a loop | 1056
A catch statement should never catch throwable since it includes errors. | 1059
Avoid unused local variables such as 'tagName'. | 1124
An empty statement (semicolon) not part of a loop | 1133
An empty statement (semicolon) not part of a loop | 1150
A catch statement should never catch throwable since it includes errors. | 1172
System.arraycopy is more efficient | 1706 - 1708

### net/sourceforge/pmd/lang/jsp/ast/JspParserTokenManager.java

Violation | Line
--- | ---
Avoid unused local variables such as 'l'. | 1231
Avoid unused local variables such as 'l'. | 1784
Avoid unused local variables such as 'l'. | 1942
Avoid unused local variables such as 'l'. | 2162
Avoid unused local variables such as 'i1'. | 2365
Avoid unused local variables such as 'l1'. | 2366
Avoid unused local variables such as 'i2'. | 2367
Avoid unused local variables such as 'l2'. | 2368
Avoid unused local variables such as 'l'. | 2407
Avoid unused local variables such as 'l'. | 2435
Avoid unused local variables such as 'i1'. | 2447
Avoid unused local variables such as 'l1'. | 2448
Avoid unused local variables such as 'i2'. | 2449
Avoid unused local variables such as 'l2'. | 2450
Avoid unused local variables such as 'l'. | 3009
Avoid unused local variables such as 'l'. | 3158
Avoid unused local variables such as 'l'. | 3488
Avoid unused local variables such as 'i1'. | 3500
Avoid unused local variables such as 'l1'. | 3501
Avoid unused local variables such as 'i2'. | 3502
Avoid unused local variables such as 'l2'. | 3503
Avoid unused private fields such as 'lengthOfMatch'. | 3933