Skip to content

Commit

Permalink
FISH-8482 Adjust parsing of version number.
Browse files Browse the repository at this point in the history
The SNAPSHOT snipping was in the wrong place, and the update version can contain non-integers.

Signed-off-by: Andrew Pielage <[email protected]>
  • Loading branch information
Pandrex247 committed Apr 4, 2024
1 parent a3a0e46 commit c435ea8
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 c435ea8

Please sign in to comment.