Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render version string countability more imperturbable #136

Merged

Conversation

dhebbeker
Copy link
Contributor

Preamble

A version string shall be composed of version partitions which are concatenated by dots. A version partition can be for example the major version number.

Current situation

Non-number characters are removed in version number partitions.

Change

Empty version number partitions are replaced with 0. In case the resulting version string is invalid a checked exception is thrown. This exception is catched in UtilsLibrary.java.

Effect

A version string is transformed from 2.1.3.alpha.42.RC to 2.1.3..42. to 2.1.3.0.42.0. Without this change an integer conversion error occurs when attempting to convert the empty version partitions.

Non-number characters are replaced in version number partitions. Empty version number partitions are replaced with 0. In case the resulting version string is invalid a checked exception is thrown. This exception is catched in UtilsLibrary.java.
{
String trimmedVersion = version.replaceAll("[^0-9?!\\.]", "");
// replace all empty version number-parts with zeros
trimmedVersion = trimmedVersion.replaceAll("\\.(\\.|$)", "\\.0$1");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the crucial change for #136

@javiersantos javiersantos merged commit ed54068 into javiersantos:master Jul 5, 2018
@javiersantos
Copy link
Owner

Thank you 🥇

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.

2 participants