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

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

commit 6582e159135a31b582eb02fa1e25d78de2d8858c
Author: Andreas Dangel <adan...@apache.org>
AuthorDate: Thu Jun 1 10:36:25 2023 +0200

    Upgrade to PMD 7.0.0-rc3
---
 pom.xml                                                           | 2 +-
 src/it/MPMD-219-pmd-processing-error/verify.groovy                | 2 +-
 .../org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java   | 7 +++++--
 src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java  | 2 +-
 src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java     | 8 ++++----
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index b945e06..e1c0f14 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,7 +83,7 @@ under the License.
   <properties>
     <mavenVersion>3.2.5</mavenVersion>
     <javaVersion>8</javaVersion>
-    <pmdVersion>7.0.0-rc2</pmdVersion>
+    <pmdVersion>7.0.0-rc3</pmdVersion>
     <slf4jVersion>1.7.36</slf4jVersion>
     <aetherVersion>1.0.0.v20140518</aetherVersion>
     <doxiaVersion>1.12.0</doxiaVersion>
diff --git a/src/it/MPMD-219-pmd-processing-error/verify.groovy 
b/src/it/MPMD-219-pmd-processing-error/verify.groovy
index b9212f2..6e74b57 100644
--- a/src/it/MPMD-219-pmd-processing-error/verify.groovy
+++ b/src/it/MPMD-219-pmd-processing-error/verify.groovy
@@ -20,5 +20,5 @@
 File buildLog = new File( basedir, 'build.log' )
 assert buildLog.exists()
 assert buildLog.text.contains( "PMD processing errors" )
-assert buildLog.text.contains( "BrokenFile.java: ParseException: Parse 
exception in file")
+assert buildLog.text.contains( "BrokenFile.java: ParseException: Parse 
exception in file" )
 assert buildLog.text.contains( "Encountered" )
diff --git 
a/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java 
b/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java
index 38919a4..e207e4e 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/ExcludeViolationsFromFile.java
@@ -84,8 +84,11 @@ public class ExcludeViolationsFromFile implements 
ExcludeFromFile<Violation> {
      * @return <code>true</code> if the violation should be excluded, 
<code>false</code> otherwise.
      */
     public boolean isExcludedFromFailure(final RuleViolation errorDetail) {
-        final String className =
-                extractClassName(errorDetail.getPackageName(), 
errorDetail.getClassName(), errorDetail.getFilename());
+        final Map<String, String> additionalInfo = 
errorDetail.getAdditionalInfo();
+        final String className = extractClassName(
+                additionalInfo.get(RuleViolation.PACKAGE_NAME),
+                additionalInfo.get(RuleViolation.CLASS_NAME),
+                errorDetail.getFileId().getAbsolutePath());
         return isExcludedFromFailure(className, 
errorDetail.getRule().getName());
     }
 
diff --git a/src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java 
b/src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java
index 55f069b..807259d 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/exec/PmdExecutor.java
@@ -259,7 +259,7 @@ public class PmdExecutor extends Executor {
     private String getErrorsAsString(List<Report.ProcessingError> errors, 
boolean withDetails) {
         List<String> errorsAsString = new ArrayList<>(errors.size());
         for (Report.ProcessingError error : errors) {
-            errorsAsString.add(error.getFile() + ": " + error.getMsg());
+            errorsAsString.add(error.getFileId().getAbsolutePath() + ": " + 
error.getMsg());
             if (withDetails) {
                 errorsAsString.add(error.getDetail());
             }
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 0d344ab..84cbaf4 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
@@ -540,12 +540,12 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         String str = readFile(generatedFile);
         // The parse exception must be in the XML report
         assertTrue(str.contains("ParseException:"));
-        assertTrue(str.contains("Encountered  at line 23, column 5."));
+        assertTrue(str.contains("at line 23, column 5: Encountered"));
 
         str = readFile(generatedReport);
         // The parse exception must also be in the HTML report
         assertTrue(str.contains("ParseException:"));
-        assertTrue(str.contains("Encountered  at line 23, column 5."));
+        assertTrue(str.contains("at line 23, column 5: Encountered"));
     }
 
     public void testPMDProcessingErrorWithDetailsNoReport() throws Exception {
@@ -561,12 +561,12 @@ public class PmdReportTest extends 
AbstractPmdReportTestCase {
         String str = readFile(generatedFile);
         // The parse exception must be in the XML report
         assertTrue(str.contains("ParseException:"));
-        assertTrue(str.contains("Encountered  at line 23, column 5."));
+        assertTrue(str.contains("at line 23, column 5: Encountered"));
 
         str = readFile(generatedReport);
         // The parse exception must NOT be in the HTML report, since 
reportProcessingErrors is false
         assertFalse(str.contains("ParseException:"));
-        assertFalse(str.contains("Encountered  at line 23, column 5."));
+        assertFalse(str.contains("at line 23, column 5: Encountered"));
     }
 
     public void testPMDExcludeRootsShouldExcludeSubdirectories() throws 
Exception {

Reply via email to