In countries with east arabic digits (for example locale hi_IN) version.getNormalVersion().toString() returns non arabic digits that may lead to problems.
Example test:
@Test
public void testNormalVersion() {
Locale.setDefault(new Locale("hi", "IN"));
System.out.println(Locale.getDefault());
Version version = Version.valueOf("2.2.0");
assertEquals("2.2.0", version.getNormalVersion().toString());
}
will break:
junit.framework.ComparisonFailure:
Expected :2.2.0
Actual :२.२.०
Also running the build in tests with VM args will fail.
A simple fix would be the following patch:
--- a/src/main/java/com/github/zafarkhaja/semver/NormalVersion.java
+++ b/src/main/java/com/github/zafarkhaja/semver/NormalVersion.java
@@ -23,6 +23,8 @@
*/
package com.github.zafarkhaja.semver;
+import java.util.Locale;
+
/**
* The {@code NormalVersion} class represents the version core.
*
@@ -174,6 +176,6 @@ class NormalVersion implements Comparable<NormalVersion> {
*/
@Override
public String toString() {
- return String.format("%d.%d.%d", major, minor, patch);
+ return String.format(Locale.US, "%d.%d.%d", major, minor, patch);
}
}
In countries with east arabic digits (for example locale hi_IN) version.getNormalVersion().toString() returns non arabic digits that may lead to problems.
Example test:
will break:
Also running the build in tests with VM args will fail.
A simple fix would be the following patch: