You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2018/11/01 14:34:17 UTC

[ambari] branch trunk updated: [AMBARI-24854] VersionUtils JavaDoc Changes For Signing the SPI (#2569)

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

jonathanhurley pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ac89512  [AMBARI-24854] VersionUtils JavaDoc Changes For Signing the SPI (#2569)
ac89512 is described below

commit ac89512b6ad6e1e6b47c80e2d7edff9672624fd7
Author: Jonathan Hurley <jo...@apache.org>
AuthorDate: Thu Nov 1 10:34:10 2018 -0400

    [AMBARI-24854] VersionUtils JavaDoc Changes For Signing the SPI (#2569)
---
 .../apache/ambari/server/utils/VersionUtils.java   | 24 ++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/ambari-server-spi/src/main/java/org/apache/ambari/server/utils/VersionUtils.java b/ambari-server-spi/src/main/java/org/apache/ambari/server/utils/VersionUtils.java
index d4a06ce..5959648 100644
--- a/ambari-server-spi/src/main/java/org/apache/ambari/server/utils/VersionUtils.java
+++ b/ambari-server-spi/src/main/java/org/apache/ambari/server/utils/VersionUtils.java
@@ -203,8 +203,10 @@ public class VersionUtils {
 
   /**
    * Return N.N.N from N.N.N.xyz
+   *
    * @param version
-   * @return
+   *          the version to extract the first three sections from.
+   * @return the first three sections of the specified version.
    */
   public static String getVersionSubstring(String version) {
     String[] versionParts = version.split("\\.");
@@ -216,16 +218,18 @@ public class VersionUtils {
   }
 
   /**
-   * Compares versions, using a build number using a dash separator, if one exists.
-   * This is is useful when comparing repository versions with one another that include
-   * build number
+   * Compares versions, using a build number using a dash separator, if one
+   * exists. This is is useful when comparing repository versions with one
+   * another that include build number
+   *
    * @param version1
    *          the first version
    * @param version2
    *          the second version
    * @param places
    *          the number of decimal-separated places to compare
-   * @return
+   * @return {@code -1} if {@code version1} is less than {@code version2},
+   *         {@code 1} if it is greater, and {@code 0} if they are equal.
    */
   public static int compareVersionsWithBuild(String version1, String version2, int places) {
     version1 = (null == version1) ? "0" : version1;
@@ -258,9 +262,13 @@ public class VersionUtils {
 
   /**
    * Helper function to compare two comparable versions with null checks
-   * @param v1 The first version
-   * @param v2 The second version
-   * @return 0 if both are equal, <0 if first one is lower, >0 otherwise
+   * 
+   * @param v1
+   *          The first version
+   * @param v2
+   *          The second version
+   * @return {@code -1} if {@code v1} is less than {@code v2}, {@code 1} if it
+   *         is greater, and {@code 0} if they are equal.
    */
   public static int compareTo(Comparable v1, Comparable v2) {
     return v1 == null ? (v2 == null ? 0 : -1) : v2 == null ? 1 : v1.compareTo(v2);