From 2640c074ebd3bb021276c5ef830f3420b763bd2a Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Wed, 31 May 2023 21:52:39 +0200 Subject: [PATCH] [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 be6dfa69..bc0a31df 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 @@ private void renderSectionDependencyFileDetails() { 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 @@ private void renderSectionDependencyFileDetails() { String.valueOf(jarDetails.getNumEntries()), String.valueOf(jarDetails.getNumClasses()), String.valueOf(jarDetails.getNumPackages()), - jarDetails.getJdkRevision(), + jdkRevisionCellValue, debugInformationCellValue, sealedCellValue });