Fix bug in version comparison

This commit is contained in:
Grahame Grieve 2023-09-13 21:37:56 -07:00
parent 518adf9826
commit fada7b2f50
3 changed files with 13 additions and 2 deletions

View File

@ -88,9 +88,15 @@ public class TimeTracker {
}
public String milestone() {
long start = milestone == 0 ? globalStart : milestone ;
long start = milestone == 0 ? globalStart : milestone;
milestone = System.nanoTime();
return DurationUtil.presentDuration(milestone - start);
}
public boolean longerThan(int i) {
long start = milestone == 0 ? globalStart : milestone;
long diff = (System.nanoTime() - start)/ 1000000;
return diff > i * 1000;
}
}

View File

@ -334,7 +334,8 @@ public class VersionUtilities {
if (pc!=null) {
if (pt.contains("-") && !pc.contains("-")) {
pt = pt.substring(0, pt.indexOf("-"));
return pt.compareTo(pc) >= 0;
int res = pc.compareTo(pt);
return res >= 0;
} else {
return compareVersionPart(pt, pc);
}

View File

@ -53,4 +53,8 @@ public class VersionUtilitiesTest {
assertFalse(VersionUtilities.isThisOrLater("0.9.x", "0.8.1"));
}
@Test
public void bugFixTests() {
assertTrue(VersionUtilities.isThisOrLater("1.0.0-ballot", "1.0.1"));
}
}