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/12 20:00:42 UTC

[maven-project-info-reports-plugin] branch MPIR-436 updated (eb5a2a1 -> 23cd034)

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

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


    omit eb5a2a1  [MPIR-436] Don't use DecimalFormat which is identical with String#valueOf(long)
     add 73b2652  [MPIR-435] Custom bundle sometimes not loaded due to parent-first class loading
     new 23cd034  [MPIR-436] Don't use DecimalFormat which is identical with String#valueOf(long)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (eb5a2a1)
            \
             N -- N -- N   refs/heads/MPIR-436 (23cd034)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../site/custom/project-info-reports.properties    |  6 ++--
 .../custom/project-info-reports_de.properties}     | 36 +++++++++++-----------
 .../custom/project-info-reports_fr.properties}     | 36 +++++++++++-----------
 src/it/full-pom/verify.bsh                         | 30 ++++++++++++++++--
 .../projectinfo/AbstractProjectInfoReport.java     |  2 +-
 .../report/projectinfo/MailingListsReportTest.java | 27 ++++++++++++++++
 .../{IndexStub.java => MailingListsStub2.java}     | 11 +++++--
 .../plugin-config.xml}                             |  3 +-
 .../site/custom/project-info-reports.properties    |  0
 9 files changed, 105 insertions(+), 46 deletions(-)
 copy src/{test/resources/iso-8859-5-encoded.txt => it/full-pom/src/site/custom/project-info-reports_de.properties} (92%)
 copy src/{test/resources/iso-8859-5-encoded.txt => it/full-pom/src/site/custom/project-info-reports_fr.properties} (92%)
 copy src/test/java/org/apache/maven/report/projectinfo/stubs/{IndexStub.java => MailingListsStub2.java} (80%)
 copy src/test/resources/plugin-configs/{mailing-lists-plugin-config.xml => custom-bundle/plugin-config.xml} (92%)
 copy src/{it/full-pom => test/resources/plugin-configs/custom-bundle}/src/site/custom/project-info-reports.properties (100%)


[maven-project-info-reports-plugin] 01/01: [MPIR-436] Don't use DecimalFormat which is identical with String#valueOf(long)

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 23cd034b578055b9ef4ddb6fc3c3b7bcb9066171
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Tue May 9 10:05:12 2023 +0200

    [MPIR-436] Don't use DecimalFormat which is identical with String#valueOf(long)
    
    This closes #49
---
 .../renderer/DependenciesRenderer.java             | 43 ++++++++++++----------
 1 file changed, 24 insertions(+), 19 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 c846c84..2b4e4f1 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
@@ -75,9 +75,6 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
     /** URL for the 'close.gif' image */
     private static final String IMG_CLOSE_URL = "./images/close.gif";
 
-    /** Used to format decimal values in the "Dependency File Details" table */
-    protected static final DecimalFormat DEFAULT_DECIMAL_FORMAT = new DecimalFormat("###0");
-
     private static final Set<String> JAR_SUBTYPE;
 
     private final DependencyNode dependencyNode;
@@ -181,10 +178,6 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
         this.projectBuilder = projectBuilder;
         this.buildingRequest = buildingRequest;
         this.licenseMappings = licenseMappings;
-
-        // Using the right set of symbols depending of the locale
-        DEFAULT_DECIMAL_FORMAT.setDecimalFormatSymbols(new DecimalFormatSymbols(locale));
-
         this.fileLengthDecimalFormat = new FileDecimalFormat(i18n, locale);
         this.fileLengthDecimalFormat.setDecimalFormatSymbols(new DecimalFormatSymbols(locale));
     }
@@ -501,14 +494,14 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
 
         startTable(justification, false);
 
-        TotalCell totaldeps = new TotalCell(DEFAULT_DECIMAL_FORMAT);
+        TotalCell totaldeps = new TotalCell();
         TotalCell totaldepsize = new TotalCell(fileLengthDecimalFormat);
-        TotalCell totalentries = new TotalCell(DEFAULT_DECIMAL_FORMAT);
-        TotalCell totalclasses = new TotalCell(DEFAULT_DECIMAL_FORMAT);
-        TotalCell totalpackages = new TotalCell(DEFAULT_DECIMAL_FORMAT);
+        TotalCell totalentries = new TotalCell();
+        TotalCell totalclasses = new TotalCell();
+        TotalCell totalpackages = new TotalCell();
         double highestJavaVersion = 0.0;
-        TotalCell totalDebugInformation = new TotalCell(DEFAULT_DECIMAL_FORMAT);
-        TotalCell totalsealed = new TotalCell(DEFAULT_DECIMAL_FORMAT);
+        TotalCell totalDebugInformation = new TotalCell();
+        TotalCell totalsealed = new TotalCell();
 
         boolean hasSealed = hasSealed(alldeps);
 
@@ -579,9 +572,9 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
                     tableRow(hasSealed, new String[] {
                         name,
                         fileLength,
-                        DEFAULT_DECIMAL_FORMAT.format(jarDetails.getNumEntries()),
-                        DEFAULT_DECIMAL_FORMAT.format(jarDetails.getNumClasses()),
-                        DEFAULT_DECIMAL_FORMAT.format(jarDetails.getNumPackages()),
+                        String.valueOf(jarDetails.getNumEntries()),
+                        String.valueOf(jarDetails.getNumClasses()),
+                        String.valueOf(jarDetails.getNumPackages()),
                         jarDetails.getJdkRevision(),
                         debugInformationCellValue,
                         sealedCellValue
@@ -1143,7 +1136,7 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
     static class TotalCell {
         static final int SCOPES_COUNT = 5;
 
-        final DecimalFormat decimalFormat;
+        DecimalFormat decimalFormat;
 
         long total = 0;
 
@@ -1157,6 +1150,8 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
 
         long totalSystemScope = 0;
 
+        TotalCell() {}
+
         TotalCell(DecimalFormat decimalFormat) {
             this.decimalFormat = decimalFormat;
         }
@@ -1210,7 +1205,12 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
             if (index >= 0) {
                 sb.append(getScope(index)).append(": ");
             }
-            sb.append(decimalFormat.format(getTotal(index)));
+            if (decimalFormat != null) {
+                sb.append(decimalFormat.format(getTotal(index)));
+            } else {
+                sb.append(getTotal(index));
+            }
+
             return sb.toString();
         }
 
@@ -1233,7 +1233,12 @@ public class DependenciesRenderer extends AbstractProjectInfoRenderer {
         /** {@inheritDoc} */
         public String toString() {
             StringBuilder sb = new StringBuilder();
-            sb.append(decimalFormat.format(total));
+            if (decimalFormat != null) {
+                sb.append(decimalFormat.format(total));
+            } else {
+                sb.append(total);
+            }
+
             sb.append(" (");
 
             boolean needSeparator = false;