This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch 224
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git

commit 98f2944bb14375a674a741a4fc037aaeb5da1660
Author: Elliotte Rusty Harold <[email protected]>
AuthorDate: Sat Jul 5 09:10:33 2025 -0400

    load filesToProcess if needed
---
 src/main/java/org/apache/maven/plugins/pmd/CpdReport.java |  8 +++++++-
 src/main/java/org/apache/maven/plugins/pmd/PmdReport.java | 10 +++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

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 @@ public class CpdReport extends AbstractPmdReport {
         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 @@ public class PmdReport extends AbstractPmdReport {
     /**
      * 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 @@ public class PmdReport extends AbstractPmdReport {
         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 @@ public class PmdReport extends AbstractPmdReport {
             }
 
             renderer.render();
+        } catch (IOException ex) {
+          throw new MavenReportException(ex.getMessage(), ex);
         } finally {
             Thread.currentThread().setContextClassLoader(origLoader);
         }

Reply via email to