Article:
  Custom PMD Rules
Subject:   problem with pmd 3.4
Date:   2005-12-20 07:42:31
From:   nicolasGrossi
People:
I had a set of pmd rules that i run agaist my project
sources. This task is performed by one script (.bat), this script works
fine with pmd-3-3.jar and doesn't work with pmd-3-4.jar. When I run this
script with 3.4 I get this exception:


Exception in thread "main" java.lang.NoSuchMethodError:
net.sourceforge.pmd.rule
s.BusinessDontThrowingCatchRule.createRuleViolation(Lnet/sourceforge/pmd/RuleCon
text;Lnet/sourceforge/pmd/ast/SimpleNode;)Lnet/sourceforge/pmd/RuleViolation;
at
net.sourceforge.pmd.rules.BusinessDontThrowingCatchRule.visit(Busines
sDontThrowingCatchRule.java:28)
at
net.sourceforge.pmd.ast.ASTCatchStatement.jjtAccept(ASTCatchStatement
.java:17)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:442)
at
net.sourceforge.pmd.ast.ASTTryStatement.jjtAccept(ASTTryStatement.jav
a:21)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:358)
at
net.sourceforge.pmd.ast.ASTStatement.jjtAccept(ASTStatement.java:19)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:370)
at
net.sourceforge.pmd.ast.ASTBlockStatement.jjtAccept(ASTBlockStatement
.java:19)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:366)
at net.sourceforge.pmd.ast.ASTBlock.jjtAccept(ASTBlock.java:19)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:358)
at
net.sourceforge.pmd.ast.ASTStatement.jjtAccept(ASTStatement.java:19)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:406)
at
net.sourceforge.pmd.ast.ASTForStatement.jjtAccept(ASTForStatement.jav
a:19)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:358)
at
net.sourceforge.pmd.ast.ASTStatement.jjtAccept(ASTStatement.java:19)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:370)
at
net.sourceforge.pmd.ast.ASTBlockStatement.jjtAccept(ASTBlockStatement
.java:19)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:366)
at net.sourceforge.pmd.ast.ASTBlock.jjtAccept(ASTBlock.java:19)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:186)
at
net.sourceforge.pmd.ast.ASTMethodDeclaration.jjtAccept(ASTMethodDecla
ration.java:18)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:47)
at
net.sourceforge.pmd.ast.ASTClassOrInterfaceBodyDeclaration.jjtAccept(
ASTClassOrInterfaceBodyDeclaration.java:32)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:43)
at
net.sourceforge.pmd.ast.ASTClassOrInterfaceBody.jjtAccept(ASTClassOrI
nterfaceBody.java:17)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:19)
at
net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration.jjtAccept(ASTC
lassOrInterfaceDeclaration.java:16)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:159)
at
net.sourceforge.pmd.ast.ASTTypeDeclaration.jjtAccept(ASTTypeDeclarati
on.java:32)
at
net.sourceforge.pmd.ast.SimpleNode.childrenAccept(SimpleNode.java:266
)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisi
torAdapter.java:135)
at net.sourceforge.pmd.AbstractRule.visitAll(AbstractRule.java:182)
at net.sourceforge.pmd.AbstractRule.apply(AbstractRule.java:143)
at net.sourceforge.pmd.RuleSet.apply(RuleSet.java:91)
at net.sourceforge.pmd.PMD.processFile(PMD.java:75)
at net.sourceforge.pmd.PMD.processFile(PMD.java:98)
at net.sourceforge.pmd.PMD.main(PMD.java:170)


any ideas?


thanks in advance


cheers
nico

Full Threads Newest First

Showing messages 1 through 1 of 1.

  • problem with pmd 3.4
    2005-12-20 08:18:02  tcopeland [View]

    Hi Nicholas -
    Yup, you'll need to replace the call to createRuleViolation() with a call to addViolation(); I've replied with more details to your post on pmd-devel as well.
    Yours,
    Tom