You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "Glynn, Eoghan" <eo...@iona.com> on 2006/10/26 18:20:24 UTC
More odd PMD-related build failures
Folks,
Some questionable PMD violations have popped up in my builds after
updating to the commits that have gone in over the last few days. Not
sure why this doesn't seem to be impacting on the cruisecontrol builds
(maybe its running with -Pnochecks).
The first[1] seems to be a kosher warning, but the detail (line number
etc.) is lost, seemingly because the method is annotated with
@SuppressWarnings. This is broken ... PMD shouldn't be effected by a
@SupressWarnings annotation, but even it is, it should be fully
supressed not just stripped of any useful detail but still causing the
build to fail. In this particular class, there are only a few nested
ifs, so its clear where the bad code is, but still annoying.
The second[2] is spurious and seems to be caused by
AbstractEndpointFactory having both public and private methods called
setProperties().
The third[3] is another example of PMD's maddening stupidity when a
method name is overloaded (IriDecoderHelper.getElement()).
I'm also seeing PMD just completely dying on me when building
rt/ws/addr, arghh!
All in all I like PMD less and less, but as long as we're stuck with it,
PLEASE be sure to run a full PMD check before committing.
/Eoghan
[1] rt/frontend/jaxws/target/pmd.xml:
<?xml version="1.0" encoding="UTF-8"?>
<pmd version="3.6" timestamp="2006-10-26T15:29:03.979" elapsedTime="0s">
<suppressedviolation
filename="/work/cxf/work_25Sept2006/trunk/rt/frontend/jaxws/src/main/jav
a/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java"
suppressiontype="annotation" msg="These nested if statements could be
combined"/>
</pmd>
[2] rt/frontend/simple/target/pmd.xml:
<?xml version="1.0" encoding="UTF-8"?>
<pmd version="3.6" timestamp="2006-10-26T15:51:15.576" elapsedTime="0s">
<file
name="/work/cxf/work_25Sept2006/trunk/rt/frontend/simple/src/main/java/o
rg/apache/cxf/service/factory/AbstractEndpointFactory.java">
<violation line="81" rule="UnusedPrivateMethod" ruleset="Unused Code
Rules" package="org.apache.cxf.service.factory"
class="AbstractEndpointFactory" method="setProperties"
externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#Unused
PrivateMethod" priority="3">
Avoid unused private methods such as 'setProperties(EndpointInfo)'
</violation>
</file>
</pmd>
[3] rt/bindings/http/target/pmd.xml:
<?xml version="1.0" encoding="UTF-8"?>
<pmd version="3.6" timestamp="2006-10-26T16:15:12.435" elapsedTime="0s">
<file
name="/work/cxf/work_25Sept2006/trunk/rt/bindings/http/src/main/java/org
/apache/cxf/binding/http/IriDecoderHelper.java">
<violation line="247" rule="UnusedPrivateMethod" ruleset="Unused Code
Rules" package="org.apache.cxf.binding.http" class="IriDecoderHelper"
method="getElement"
externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#Unused
PrivateMethod" priority="3">
Avoid unused private methods such as 'getElement(Element,int)'
</violation>
</file>
</pmd>
Re: More odd PMD-related build failures
Posted by Andrea Smyth <an...@iona.com>.
I deleted that directory from my repository (and the pmd.xml file
generated in target shows it's using 3.7 now) but PMD still crashes when
checking code in ws-addr.
The problem seems to be the UselessOverridingMethod rule:
Andrea.
[WARNING] Failure executing PMD for:
C:\svn\workspace\cxf\rt\ws\addr\src\main\java\org\apache\cxf\ws\addressing\soap\MAPCodec.java
net.sourceforge.pmd.PMDException: Error while processing
C:\svn\workspace\cxf\rt\ws\addr\src\main\java\org\apache\cxf\ws\addressing\soap\MAPCodec.java
at net.sourceforge.pmd.PMD.processFile(PMD.java:109)
at net.sourceforge.pmd.PMD.processFile(PMD.java:66)
at net.sourceforge.pmd.PMD.processFile(PMD.java:152)
at
org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:204)
at
org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98)
at
org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:898)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:734)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:505)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.NullPointerException
at
net.sourceforge.pmd.rules.UselessOverridingMethod.visit(UselessOverridingMethod.java:47)
at
net.sourceforge.pmd.ast.ASTMethodDeclaration.jjtAccept(ASTMethodDeclaration.java:18)
at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.java:44)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:47)
at
net.sourceforge.pmd.ast.ASTClassOrInterfaceBodyDeclaration.jjtAccept(ASTClassOrInterfaceBodyDeclaration.java:34)
at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.java:44)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:43)
at
net.sourceforge.pmd.ast.ASTClassOrInterfaceBody.jjtAccept(ASTClassOrInterfaceBody.java:19)
at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.java:44)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:19)
at
net.sourceforge.pmd.rules.UselessOverridingMethod.visit(UselessOverridingMethod.java:34)
at
net.sourceforge.pmd.ast.ASTClassOrInterfaceDeclaration.jjtAccept(ASTClassOrInterfaceDeclaration.java:18)
at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.java:44)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:159)
at
net.sourceforge.pmd.ast.ASTTypeDeclaration.jjtAccept(ASTTypeDeclaration.java:33)
at
net.sourceforge.pmd.ast.SimpleJavaNode.childrenAccept(SimpleJavaNode.java:44)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:6)
at
net.sourceforge.pmd.ast.JavaParserVisitorAdapter.visit(JavaParserVisitorAdapter.java:135)
at net.sourceforge.pmd.AbstractRule.visitAll(AbstractRule.java:183)
at net.sourceforge.pmd.AbstractRule.apply(AbstractRule.java:144)
at net.sourceforge.pmd.RuleSet.apply(RuleSet.java:97)
at net.sourceforge.pmd.RuleSets.apply(RuleSets.java:99)
at net.sourceforge.pmd.PMD.processFile(PMD.java:104)
at net.sourceforge.pmd.PMD.processFile(PMD.java:66)
at net.sourceforge.pmd.PMD.processFile(PMD.java:152)
at
org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:204)
at
org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:98)
at
org.apache.maven.reporting.AbstractMavenReport.execute(AbstractMavenReport.java:73)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:898)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:734)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:505)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Daniel Kulp wrote:
>Eoghan,
>
>Delete your .m2/repository/org/apache/maven/plugins/maven-pmd-plugin/
>directory. The XML files you included below show it is using PMD 3.6
>instead of 3.7 which has the issues fixed in it. It looks like your
>maven is not updating. (you could try forcing an update with "mvn -U",
>but there are issues with that not always working)
>
>
>Dan
>
>
>
Re: More odd PMD-related build failures
Posted by Daniel Kulp <da...@iona.com>.
Eoghan,
Delete your .m2/repository/org/apache/maven/plugins/maven-pmd-plugin/
directory. The XML files you included below show it is using PMD 3.6
instead of 3.7 which has the issues fixed in it. It looks like your
maven is not updating. (you could try forcing an update with "mvn -U",
but there are issues with that not always working)
Dan
On Thursday October 26 2006 12:20 pm, Glynn, Eoghan wrote:
> Folks,
>
> Some questionable PMD violations have popped up in my builds after
> updating to the commits that have gone in over the last few days. Not
> sure why this doesn't seem to be impacting on the cruisecontrol builds
> (maybe its running with -Pnochecks).
>
> The first[1] seems to be a kosher warning, but the detail (line number
> etc.) is lost, seemingly because the method is annotated with
> @SuppressWarnings. This is broken ... PMD shouldn't be effected by a
> @SupressWarnings annotation, but even it is, it should be fully
> supressed not just stripped of any useful detail but still causing the
> build to fail. In this particular class, there are only a few nested
> ifs, so its clear where the bad code is, but still annoying.
>
> The second[2] is spurious and seems to be caused by
> AbstractEndpointFactory having both public and private methods called
> setProperties().
>
> The third[3] is another example of PMD's maddening stupidity when a
> method name is overloaded (IriDecoderHelper.getElement()).
>
> I'm also seeing PMD just completely dying on me when building
> rt/ws/addr, arghh!
>
> All in all I like PMD less and less, but as long as we're stuck with
> it, PLEASE be sure to run a full PMD check before committing.
>
> /Eoghan
>
>
> [1] rt/frontend/jaxws/target/pmd.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <pmd version="3.6" timestamp="2006-10-26T15:29:03.979"
> elapsedTime="0s"> <suppressedviolation
> filename="/work/cxf/work_25Sept2006/trunk/rt/frontend/jaxws/src/main/ja
>v a/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java"
> suppressiontype="annotation" msg="These nested if statements could be
> combined"/>
> </pmd>
>
> [2] rt/frontend/simple/target/pmd.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <pmd version="3.6" timestamp="2006-10-26T15:51:15.576"
> elapsedTime="0s"> <file
> name="/work/cxf/work_25Sept2006/trunk/rt/frontend/simple/src/main/java/
>o rg/apache/cxf/service/factory/AbstractEndpointFactory.java">
> <violation line="81" rule="UnusedPrivateMethod" ruleset="Unused Code
> Rules" package="org.apache.cxf.service.factory"
> class="AbstractEndpointFactory" method="setProperties"
> externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#Unuse
>d PrivateMethod" priority="3">
> Avoid unused private methods such as 'setProperties(EndpointInfo)'
> </violation>
> </file>
> </pmd>
>
> [3] rt/bindings/http/target/pmd.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <pmd version="3.6" timestamp="2006-10-26T16:15:12.435"
> elapsedTime="0s"> <file
> name="/work/cxf/work_25Sept2006/trunk/rt/bindings/http/src/main/java/or
>g /apache/cxf/binding/http/IriDecoderHelper.java">
> <violation line="247" rule="UnusedPrivateMethod" ruleset="Unused Code
> Rules" package="org.apache.cxf.binding.http" class="IriDecoderHelper"
> method="getElement"
> externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#Unuse
>d PrivateMethod" priority="3">
> Avoid unused private methods such as 'getElement(Element,int)'
> </violation>
> </file>
> </pmd>
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194 F:781-902-8001
daniel.kulp@iona.com
Re: More odd PMD-related build failures
Posted by Freeman Fang <fr...@iona.com>.
Hi Eoghan,
I also saw these problem on my machine. After mvn -U to update maven pmd
plugin, these pmd error will not cause build failure but only throw
exceptions.
Thanks very much
Freeman
Glynn, Eoghan wrote:
>Folks,
>
>Some questionable PMD violations have popped up in my builds after
>updating to the commits that have gone in over the last few days. Not
>sure why this doesn't seem to be impacting on the cruisecontrol builds
>(maybe its running with -Pnochecks).
>
>The first[1] seems to be a kosher warning, but the detail (line number
>etc.) is lost, seemingly because the method is annotated with
>@SuppressWarnings. This is broken ... PMD shouldn't be effected by a
>@SupressWarnings annotation, but even it is, it should be fully
>supressed not just stripped of any useful detail but still causing the
>build to fail. In this particular class, there are only a few nested
>ifs, so its clear where the bad code is, but still annoying.
>
>The second[2] is spurious and seems to be caused by
>AbstractEndpointFactory having both public and private methods called
>setProperties().
>
>The third[3] is another example of PMD's maddening stupidity when a
>method name is overloaded (IriDecoderHelper.getElement()).
>
>I'm also seeing PMD just completely dying on me when building
>rt/ws/addr, arghh!
>
>All in all I like PMD less and less, but as long as we're stuck with it,
>PLEASE be sure to run a full PMD check before committing.
>
>/Eoghan
>
>
>[1] rt/frontend/jaxws/target/pmd.xml:
><?xml version="1.0" encoding="UTF-8"?>
><pmd version="3.6" timestamp="2006-10-26T15:29:03.979" elapsedTime="0s">
><suppressedviolation
>filename="/work/cxf/work_25Sept2006/trunk/rt/frontend/jaxws/src/main/jav
>a/org/apache/cxf/jaxws/interceptors/DispatchOutInterceptor.java"
>suppressiontype="annotation" msg="These nested if statements could be
>combined"/>
></pmd>
>
>[2] rt/frontend/simple/target/pmd.xml:
><?xml version="1.0" encoding="UTF-8"?>
><pmd version="3.6" timestamp="2006-10-26T15:51:15.576" elapsedTime="0s">
><file
>name="/work/cxf/work_25Sept2006/trunk/rt/frontend/simple/src/main/java/o
>rg/apache/cxf/service/factory/AbstractEndpointFactory.java">
><violation line="81" rule="UnusedPrivateMethod" ruleset="Unused Code
>Rules" package="org.apache.cxf.service.factory"
>class="AbstractEndpointFactory" method="setProperties"
>externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#Unused
>PrivateMethod" priority="3">
>Avoid unused private methods such as 'setProperties(EndpointInfo)'
></violation>
></file>
></pmd>
>
>[3] rt/bindings/http/target/pmd.xml:
><?xml version="1.0" encoding="UTF-8"?>
><pmd version="3.6" timestamp="2006-10-26T16:15:12.435" elapsedTime="0s">
><file
>name="/work/cxf/work_25Sept2006/trunk/rt/bindings/http/src/main/java/org
>/apache/cxf/binding/http/IriDecoderHelper.java">
><violation line="247" rule="UnusedPrivateMethod" ruleset="Unused Code
>Rules" package="org.apache.cxf.binding.http" class="IriDecoderHelper"
>method="getElement"
>externalInfoUrl="http://pmd.sourceforge.net/rules/unusedcode.html#Unused
>PrivateMethod" priority="3">
>Avoid unused private methods such as 'getElement(Element,int)'
></violation>
></file>
></pmd
>
--
Freeman Fang
Software Engineer
IONA Asia Pacific Software Development Center
No.2 Floor A Unit Information Center
Zhongguancun Software Park Haidian District,
Beijing, P.R.China
Tel.: +86-10-82825151 - ex. 551
Fax: +86-10-8282-5210
freeman.fang@iona.com
-------------------------------------------------
Making Software Work Together TM