You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ad...@apache.org on 2018/01/18 09:47:51 UTC
[maven-pmd-plugin] 02/02: [MPMD-251] Invalid report XML is
generated with includeXmlInSite=true
This is an automated email from the ASF dual-hosted git repository.
adangel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
commit 89687854bc1c965f26adbc78410f75e631f66088
Author: Andreas Dangel <ad...@apache.org>
AuthorDate: Thu Jan 18 10:43:40 2018 +0100
[MPMD-251] Invalid report XML is generated with includeXmlInSite=true
Use the renderer's flush method
---
src/main/java/org/apache/maven/plugins/pmd/PmdReport.java | 14 ++++++++++----
.../java/org/apache/maven/plugins/pmd/PmdReportTest.java | 2 +-
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
index fe39380..2a8a897 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -233,9 +233,16 @@ public class PmdReport
return getBundle( locale ).getString( "report.pmd.description" );
}
- public void setRulesets( String[] rules )
+ /**
+ * Configures the PMD rulesets to be used directly.
+ * Note: Usually the rulesets are configured via the property.
+ *
+ * @param rulesets the PMD rulesets to be used.
+ * @see #rulesets
+ */
+ public void setRulesets( String[] rulesets )
{
- rulesets = rules;
+ this.rulesets = Arrays.copyOf( rulesets, rulesets.length );
}
/**
@@ -596,7 +603,7 @@ public class PmdReport
r.start();
r.renderFileReport( report );
r.end();
- writer.flush();
+ r.flush();
if ( includeXmlInSite )
{
@@ -650,7 +657,6 @@ public class PmdReport
{
try
{
- @SuppressWarnings( "unchecked" )
List<String> classpath =
includeTests ? project.getTestClasspathElements() : project.getCompileClasspathElements();
getLog().debug( "Using aux classpath: " + classpath );
diff --git a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
index e108f96..72afd01 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
@@ -370,7 +370,7 @@ public class PmdReportTest
assertTrue( pmdXmlTarget.contains( "</pmd>" ) );
// check that pmd.xml file has the closing element
- String pmdXml = readFile( new File( getBasedir(), "target/test/unit/default-configuration/target/site/pmd.xml" ) );
+ String pmdXml = readFile( generatedXmlFile );
assertTrue( pmdXml.contains( "</pmd>" ) );
}
--
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.