@Override
  public int compareTo(ModuleVersion other) {
    int result = this.apacheMajor - other.apacheMajor;
    if(result == 0) {
      result = this.apacheMinor - other.apacheMinor;
      if(result == 0) {
        result = this.internalMinor - other.internalMinor;
        if(result == 0) {
          result = this.internalMaint - other.internalMaint;
          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 module 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/ModuleVersion.java