@Override
  public int compareTo(MpackVersion other) {
    int result = this.major - other.major;
    if(result == 0) {
      result = this.minor - other.minor;
      if(result == 0) {
        result = this.maint - other.maint;
        if(result == 0) {
          result = this.hotfix - other.hotfix;
          if(result == 0) {
            result = this.build - other.build;
          }
        }
      }
    }
    return result > 0 ? 1 : result < 0 ? -1 : 0;
  }
Method validate mpack version not to be
empty or null. Also check if passed version
has valid format.
@param version string
@return Matcher for passed version
@throws IllegalArgumentException() if version empty/null/not valid
ambari-server/src/main/java/org/apache/ambari/server/utils/MpackVersion.java