Fix NPE when artifact dependency version is null 25/22825/2
authorGary Wu <gary.i.wu@huawei.com>
Wed, 8 Nov 2017 17:33:58 +0000 (09:33 -0800)
committerGary Wu <gary.i.wu@huawei.com>
Wed, 8 Nov 2017 17:35:26 +0000 (09:35 -0800)
Change-Id: I56d6813b54ea769ca4bc6f0d7bf098b12cd0c6bc
Issue-ID: INT-330
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
version-manifest/pom.xml
version-manifest/src/main/java/org/onap/integration/versionmanifest/VersionCheckMojo.java

index 0826aeb..361262e 100644 (file)
@@ -8,7 +8,7 @@
   </parent>
   <groupId>org.onap.integration</groupId>
   <artifactId>version-manifest</artifactId>
-  <version>0.1.0-SNAPSHOT</version>
+  <version>0.1.1-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
   <name>ONAP Version Manifest and Maven Plugin</name>
   <url>https://www.onap.org</url>
index 75da50f..dfac6cd 100644 (file)
@@ -130,9 +130,9 @@ public class VersionCheckMojo extends AbstractMojo {
 
         // used for formatting
         int[] columnWidths = new int[10];
-        columnWidths[0] = actualVersions.keySet().stream().mapToInt(String::length).max().orElse(1);
-        columnWidths[1] = actualVersions.values().stream().mapToInt(String::length).max().orElse(1);
-        columnWidths[2] = expectedVersions.values().stream().mapToInt(String::length).max().orElse(1);
+        columnWidths[0] = actualVersions.keySet().stream().mapToInt(s -> ("" + s).length()).max().orElse(1);
+        columnWidths[1] = actualVersions.values().stream().mapToInt(s -> ("" + s).length()).max().orElse(1);
+        columnWidths[2] = expectedVersions.values().stream().mapToInt(s -> ("" + s).length()).max().orElse(1);
         String format = "  %-" + columnWidths[0] + "s" + "  %" + columnWidths[1] + "s -> %" + columnWidths[2] + "s";
 
         if (mismatches.isEmpty()) {