##### Overview

- Download PMD 5.0.5
- What's new in PMD 5.0.5
- 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. | 3632
A catch statement should never catch throwable since it includes errors. | 3703
An empty statement (semicolon) not part of a loop | 3806
A catch statement should never catch throwable since it includes errors. | 3809
An empty statement (semicolon) not part of a loop | 3841
A catch statement should never catch throwable since it includes errors. | 3850
An empty statement (semicolon) not part of a loop | 3892
An empty statement (semicolon) not part of a loop | 3906
A catch statement should never catch throwable since it includes errors. | 3921
An empty statement (semicolon) not part of a loop | 3959
An empty statement (semicolon) not part of a loop | 3967
An empty statement (semicolon) not part of a loop | 3983
A catch statement should never catch throwable since it includes errors. | 3998
A catch statement should never catch throwable since it includes errors. | 4106
A catch statement should never catch throwable since it includes errors. | 4137
An empty statement (semicolon) not part of a loop | 4168
A catch statement should never catch throwable since it includes errors. | 4178
An empty statement (semicolon) not part of a loop | 4219
A catch statement should never catch throwable since it includes errors. | 4226
An empty statement (semicolon) not part of a loop | 4258
An empty statement (semicolon) not part of a loop | 4284
A catch statement should never catch throwable since it includes errors. | 4293
An empty statement (semicolon) not part of a loop | 4388
A catch statement should never catch throwable since it includes errors. | 4398
An empty statement (semicolon) not part of a loop | 4435
An empty statement (semicolon) not part of a loop | 4445
A catch statement should never catch throwable since it includes errors. | 4453
A catch statement should never catch throwable since it includes errors. | 4496
An empty statement (semicolon) not part of a loop | 4536
A catch statement should never catch throwable since it includes errors. | 4541
A catch statement should never catch throwable since it includes errors. | 4573
A catch statement should never catch throwable since it includes errors. | 4607
An empty statement (semicolon) not part of a loop | 4701
An empty statement (semicolon) not part of a loop | 4737
An empty statement (semicolon) not part of a loop | 4769
A catch statement should never catch throwable since it includes errors. | 4780
A catch statement should never catch throwable since it includes errors. | 4843
An empty statement (semicolon) not part of a loop | 4875
A catch statement should never catch throwable since it includes errors. | 4884
A catch statement should never catch throwable since it includes errors. | 4912
An empty statement (semicolon) not part of a loop | 4947
An empty statement (semicolon) not part of a loop | 4971
An empty statement (semicolon) not part of a loop | 5021
A catch statement should never catch throwable since it includes errors. | 5024
A catch statement should never catch throwable since it includes errors. | 5054
A catch statement should never catch throwable since it includes errors. | 5086
An empty statement (semicolon) not part of a loop | 5120
An empty statement (semicolon) not part of a loop | 5127
An empty statement (semicolon) not part of a loop | 5141
A catch statement should never catch throwable since it includes errors. | 5143
An empty statement (semicolon) not part of a loop | 5176
A catch statement should never catch throwable since it includes errors. | 5179
An empty statement (semicolon) not part of a loop | 5210
A catch statement should never catch throwable since it includes errors. | 5217
An empty statement (semicolon) not part of a loop | 5249
A catch statement should never catch throwable since it includes errors. | 5272
A catch statement should never catch throwable since it includes errors. | 5304
A catch statement should never catch throwable since it includes errors. | 5333
An empty statement (semicolon) not part of a loop | 5371
A catch statement should never catch throwable since it includes errors. | 5374
A catch statement should never catch throwable since it includes errors. | 5465
An empty statement (semicolon) not part of a loop | 5501
A catch statement should never catch throwable since it includes errors. | 5507
A catch statement should never catch throwable since it includes errors. | 5539
A catch statement should never catch throwable since it includes errors. | 5574
An empty statement (semicolon) not part of a loop | 5606
A catch statement should never catch throwable since it includes errors. | 5615
A catch statement should never catch throwable since it includes errors. | 5646
A catch statement should never catch throwable since it includes errors. | 5715
An empty statement (semicolon) not part of a loop | 5778
An empty statement (semicolon) not part of a loop | 5791
An empty statement (semicolon) not part of a loop | 5796
A catch statement should never catch throwable since it includes errors. | 5799
A catch statement should never catch throwable since it includes errors. | 5833
An empty statement (semicolon) not part of a loop | 5888
A catch statement should never catch throwable since it includes errors. | 5897
A catch statement should never catch throwable since it includes errors. | 5996
An empty statement (semicolon) not part of a loop | 6034
A catch statement should never catch throwable since it includes errors. | 6040
A catch statement should never catch throwable since it includes errors. | 6069
System.arraycopy is more efficient | 9827 - 9829

### 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