You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2023/05/31 19:55:34 UTC

[maven-project-info-reports-plugin] branch master updated: [MPIR-449] Don't count and display debug information if dependency does not contain class files

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

michaelo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-project-info-reports-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 2640c07  [MPIR-449] Don't count and display debug information if dependency does not contain class files
2640c07 is described below

commit 2640c074ebd3bb021276c5ef830f3420b763bd2a
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Wed May 31 21:52:39 2023 +0200

    [MPIR-449] Don't count and display debug information if dependency does not contain class files
---
 .../renderer/DependenciesRenderer.java             | 38 ++++++++++++----------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
index be6dfa6..bc0a31d 100644
--- a/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
+++ b/src/main/java/org/apache/maven/report/projectinfo/dependencies/renderer/DependenciesRenderer.java
@@ -548,34 +548,38 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
                 try {
                     JarData jarDetails = dependencies.getJarDependencyDetails(artifact);
 
-                    String debugInformationCellValue = debugInformationCellNo;
-                    if (jarDetails.isDebugPresent()) {
-                        debugInformationCellValue = debugInformationCellYes;
-                        totalDebugInformation.incrementTotal(artifact.getScope());
-                    }
-
                     totalentries.addTotal(jarDetails.getNumEntries(), artifact.getScope());
                     totalclasses.addTotal(jarDetails.getNumClasses(), artifact.getScope());
                     totalpackages.addTotal(jarDetails.getNumPackages(), artifact.getScope());
 
-                    try {
-                        if (jarDetails.getJdkRevision() != null) {
-                            double jdkRevision = Double.parseDouble(jarDetails.getJdkRevision());
+                    String jdkRevisionCellValue = jarDetails.getJdkRevision();
+                    String debugInformationCellValue = null;
+                    String sealedCellValue = null;
+
+                    if (jdkRevisionCellValue != null) {
+                        try {
+                            double jdkRevision = Double.parseDouble(jdkRevisionCellValue);
                             boolean isTestScope = Artifact.SCOPE_TEST.equalsIgnoreCase(artifact.getScope());
                             if (isTestScope) {
                                 highestTestJavaVersion = Math.max(highestTestJavaVersion, jdkRevision);
                             } else {
                                 highestNonTestJavaVersion = Math.max(highestNonTestJavaVersion, jdkRevision);
                             }
+                        } catch (NumberFormatException e) {
+                            // ignore
                         }
-                    } catch (NumberFormatException e) {
-                        // ignore
-                    }
 
-                    String sealedCellValue = sealedCellNo;
-                    if (jarDetails.isSealed()) {
-                        sealedCellValue = sealedCellYes;
-                        totalsealed.incrementTotal(artifact.getScope());
+                        debugInformationCellValue = debugInformationCellNo;
+                        if (jarDetails.isDebugPresent()) {
+                            debugInformationCellValue = debugInformationCellYes;
+                            totalDebugInformation.incrementTotal(artifact.getScope());
+                        }
+
+                        sealedCellValue = sealedCellNo;
+                        if (jarDetails.isSealed()) {
+                            sealedCellValue = sealedCellYes;
+                            totalsealed.incrementTotal(artifact.getScope());
+                        }
                     }
 
                     String name = artifactFile.getName();
@@ -593,7 +597,7 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
                         String.valueOf(jarDetails.getNumEntries()),
                         String.valueOf(jarDetails.getNumClasses()),
                         String.valueOf(jarDetails.getNumPackages()),
-                        jarDetails.getJdkRevision(),
+                        jdkRevisionCellValue,
                         debugInformationCellValue,
                         sealedCellValue
                     });