Skip to content

Commit

Permalink
Merge pull request #6631 from Pandrex247/FISH-8482-Comm6
Browse files Browse the repository at this point in the history
FISH-8482 Adjust parsing of version number.
  • Loading branch information
breakponchito authored Apr 15, 2024
2 parents 422e6f0 + 713d807 commit 89f4b88
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* holder.
*/

// Portions Copyright [2016-2023] [Payara Foundation and/or affiliates]
// Portions Copyright 2016-2024 Payara Foundation and/or affiliates

package com.sun.appserv.server.util;

Expand Down Expand Up @@ -158,11 +158,11 @@ public static String getVersionNumber() {
// construct version number
String maj = getMajorVersion();
String min = getMinorVersion();
String upd = getUpdateVersion().replaceAll("\\D+", "");
String upd = getUpdateVersion();
String v;
try {
if (min != null && min.length() > 0 && Integer.parseInt(min) >= 0) {
if (upd != null && upd.length() > 0 && Integer.parseInt(upd) >= 0) {
if (upd != null && upd.length() > 0) {
v = maj + "." + min + "." + upd;
} else {
v = maj + "." + min;
Expand Down Expand Up @@ -205,14 +205,14 @@ public static String getMajorVersion() {
* Returns Minor version
*/
public static String getMinorVersion() {
return getProperty(MINOR_VERSION_KEY, "0").replace("-SNAPSHOT", "");
return getProperty(MINOR_VERSION_KEY, "0");
}

/**
* Returns Update version
*/
public static String getUpdateVersion() {
return getProperty(UPDATE_VERSION_KEY, "0");
return getProperty(UPDATE_VERSION_KEY, "0").replace("-SNAPSHOT", "");
}

/**
Expand Down

0 comments on commit 89f4b88

Please sign in to comment.