You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2013/11/28 06:55:13 UTC

svn commit: r1546292 - /maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java

Author: olamy
Date: Thu Nov 28 05:55:13 2013
New Revision: 1546292

URL: http://svn.apache.org/r1546292
Log:
merge https://github.com/apache/maven-plugins/pull/16

Modified:
    maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java

Modified: maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java?rev=1546292&r1=1546291&r2=1546292&view=diff
==============================================================================
--- maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java (original)
+++ maven/plugins/trunk/maven-pmd-plugin/src/main/java/org/apache/maven/plugin/pmd/PmdReport.java Thu Nov 28 05:55:13 2013
@@ -123,7 +123,7 @@ public class PmdReport
     /**
      * Controls whether the project's compile/test classpath should be passed to PMD to enable its type resolution
      * feature.
-     * 
+     *
      * @since 3.0
      */
     @Parameter( property = "pmd.typeResolution", defaultValue = "false" )
@@ -270,12 +270,16 @@ public class PmdReport
 
         RuleSetFactory ruleSetFactory = new RuleSetFactory();
         ruleSetFactory.setMinimumPriority( RulePriority.valueOf( this.minimumPriority ) );
-        String[] sets = new String[rulesets.length];
+
+        // Workaround for https://sourceforge.net/p/pmd/bugs/1155/: add a dummy ruleset.
+        String[] presentRulesets = rulesets.length > 0 ? rulesets : new String [] { "/rulesets/dummy.xml" };
+
+        String[] sets = new String[presentRulesets.length];
         try
         {
-            for ( int idx = 0; idx < rulesets.length; idx++ )
+            for ( int idx = 0; idx < presentRulesets.length; idx++ )
             {
-                String set = rulesets[idx];
+                String set = presentRulesets[idx];
                 getLog().debug( "Preparing ruleset: " + set );
                 RuleSetReferenceId id = new RuleSetReferenceId( set );
                 File ruleset = locator.getResourceAsFile( id.getRuleSetFileName(), getLocationTemp( set ) );
@@ -569,4 +573,4 @@ public class PmdReport
         return renderer;
     }
 
-}
\ No newline at end of file
+}