Skip to content

fix: version comparison logic for remote update checks - #543

Open
eduardomozart wants to merge 1 commit into
angryip:masterfrom
eduardomozart:fix-version-comparison
Open

eduardomozart wants to merge 1 commit into
angryip:masterfrom
eduardomozart:fix-version-comparison

Conversation

@eduardomozart

Copy link
Copy Markdown

Description

This PR fixes a bug where the application would prompt the user to download an "older" stable version if the user was running a newer patch version (e.g., prompting to downgrade from 3.10.1 to 3.10.0).

image

"The latest stable version is 3.10.0, but you are running v3.10.1. Would you like to open the download page now?"

Previously, the version check in HelpMenuActions.java relied on simple string equality (!Version.getVersion().equals(latestVersion)). This evaluates to true anytime the running version differs from the remote version, regardless of which one is newer.

Changes

  • Implemented a robust compareTo method in Version.java that handles semantic version string comparison by evaluating their numeric parts.
  • Updated HelpMenuActions.java to use the new compareTo method, ensuring the update prompt only appears when the current version is strictly older than the latest stable remote version (Version.compareTo(current, latest) < 0).
  • Added unit tests in VersionTest.java to verify the new version comparison logic against multiple scenarios (e.g., standard versions, omitted patch numbers, and betas).

Testing

  • VersionTest covers the comparison logic.
  • CI pipeline will automatically run the tests across platforms.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant