From 119fc53d7272184333b0a90fc911b988bc25d5a1 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 29 Apr 2019 11:43:05 -0400 Subject: Fix sonar issue with double compare The gson code to convert Double to Long/Integer use a direct comparison of the original double with a long. However, sonar does not like that so changed the code to use the Double.compare() method instead. Also fixed sonar issue with diamond operator. Addressed some sonar issues in ServiceManager. Addressed some sonar issues in Version. Change-Id: I0959603918d251db671e87e12c295c6ec911f427 Issue-ID: POLICY-1707 Signed-off-by: Jim Hahn --- .../policy/common/utils/validation/Version.java | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'utils/src/main/java/org/onap/policy/common/utils/validation/Version.java') diff --git a/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java b/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java index d8106ec6..41ff832a 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java +++ b/utils/src/main/java/org/onap/policy/common/utils/validation/Version.java @@ -50,6 +50,26 @@ public class Version implements Comparable { private final int patch; + /** + * String constructor. + * + * @param versionString the version string + */ + public Version(@NonNull final String versionString) { + Version newVersion = makeVersion("String", "constructor", versionString); + + if (newVersion != null) { + this.major = newVersion.major; + this.minor = newVersion.minor; + this.patch = newVersion.patch; + } + else { + this.major = 0; + this.minor = 0; + this.patch = 0; + } + } + /** * Creates a version object. * @@ -83,26 +103,6 @@ public class Version implements Comparable { } } - /** - * String constructor. - * - * @param versionString the version string - */ - public Version(@NonNull final String versionString) { - Version newVersion = makeVersion("String", "constructor", versionString); - - if (newVersion != null) { - this.major = newVersion.major; - this.minor = newVersion.minor; - this.patch = newVersion.patch; - } - else { - this.major = 0; - this.minor = 0; - this.patch = 0; - } - } - /** * Generates a new version from a string. * -- cgit 1.2.3-korg