load filesToProcess if needed
diff --git a/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java b/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
index 90c983d..7217773 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/CpdReport.java
@@ -18,6 +18,8 @@
*/
package org.apache.maven.plugins.pmd;
+import java.io.File;
+import java.util.Map;
import javax.inject.Inject;
import java.io.IOException;
@@ -141,10 +143,14 @@
ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-
+ if (filesToProcess == null) {
+ filesToProcess = getFilesToProcess();
+ }
CpdReportRenderer renderer = new CpdReportRenderer(
getSink(), i18n, locale, filesToProcess, cpdResult.getDuplications(), isAggregator());
renderer.render();
+ } catch (IOException ex) {
+ throw new MavenReportException(ex.getMessage(), ex);
} finally {
Thread.currentThread().setContextClassLoader(origLoader);
}
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 a6dca73..bc15fd6 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -165,9 +165,9 @@
/**
* The location of the analysis cache, if it is enabled.
* This file contains the results of the last PMD run and must not be cleaned
- * between consecutive PMD runs. Otherwise the cache is not in use.
+ * between consecutive PMD runs. Otherwise, the cache is not in use.
* If the file doesn't exist, PMD executes as if there is no cache enabled and
- * all files are analyzed. Otherwise only changed files will be analyzed again.
+ * all files are analyzed. Otherwise, only changed files will be analyzed again.
*
* @since 3.8
*/
@@ -292,7 +292,9 @@
ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
-
+ if (filesToProcess == null) {
+ filesToProcess = getFilesToProcess();
+ }
PmdReportRenderer renderer = new PmdReportRenderer(
getLog(),
getSink(),
@@ -311,6 +313,8 @@
}
renderer.render();
+ } catch (IOException ex) {
+ throw new MavenReportException(ex.getMessage(), ex);
} finally {
Thread.currentThread().setContextClassLoader(origLoader);
}