Better error handling for PMDException ---------------------------------------
Key: MPMD-65 URL: http://jira.codehaus.org/browse/MPMD-65 Project: Maven 2.x PMD Plugin Issue Type: Improvement Components: PMD Reporter: Xavier Le Vourch Attachments: PMDException.patch PMDException is not caught and this means an exception stack is displayed when an error occurs, for instance when annotations are used with targetJdk set to 1.4. With the attached patch, the plugin now displays a single line: [WARNING] Error while parsing /home/xlv/dev/pmd/maven/mvn_test/src/main/java/com/brittanysoftware/pmd/test/App.java: Can't use annotations when running in JDK 1.4 mode! instead of an exception stack: [WARNING] Failure executing PMD for: /home/xlv/dev/pmd/maven/mvn_test/src/main/java/com/brittanysoftware/pmd/test/App.java net.sourceforge.pmd.PMDException: Error while parsing /home/xlv/dev/pmd/maven/mvn_test/src/main/java/com/brittanysoftware/pmd/test/App.java at net.sourceforge.pmd.PMD.processFile(PMD.java:123) at net.sourceforge.pmd.PMD.processFile(PMD.java:72) at net.sourceforge.pmd.PMD.processFile(PMD.java:166) at org.apache.maven.plugin.pmd.PmdReport.executeReport(PmdReport.java:228) 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:447) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126) at org.apache.maven.cli.MavenCli.main(MavenCli.java:282) 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:597) 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: net.sourceforge.pmd.ast.ParseException: Can't use annotations when running in JDK 1.4 mode! at net.sourceforge.pmd.ast.JavaParser.checkForBadAnnotationUsage(JavaParser.java:32) at net.sourceforge.pmd.ast.JavaParser.MarkerAnnotation(JavaParser.java:5351) at net.sourceforge.pmd.ast.JavaParser.Annotation(JavaParser.java:5270) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira