You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2017/04/26 17:41:11 UTC
svn commit: r1792783 - in /pivot/branches/2.0.x: ./
core/src/org/apache/pivot/util/Version.java
core/test/org/apache/pivot/util/test/VersionTest.java
Author: rwhitcomb
Date: Wed Apr 26 17:41:11 2017
New Revision: 1792783
URL: http://svn.apache.org/viewvc?rev=1792783&view=rev
Log:
PIVOT-996: Update the Version.decode() method to deal gracefully with a known fail
case from the SAP JVM where the JVM version string doesn't have the "canonical" form.
Add another test to the VersionTest class for this specific fail case.
This is a merge of revision 1792775 from "trunk" to "branches/2.0.x".
Modified:
pivot/branches/2.0.x/ (props changed)
pivot/branches/2.0.x/core/src/org/apache/pivot/util/Version.java
pivot/branches/2.0.x/core/test/org/apache/pivot/util/test/VersionTest.java
Propchange: pivot/branches/2.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Apr 26 17:41:11 2017
@@ -1 +1 @@
-/pivot/trunk:1346574,1347051,1394847,1394858,1398511,1399331,1401781,1405882,1407585,1409081,1410536,1410555,1417081,1417258,1428056,1428650,1435351,1436707,1438126,1438659,1444260,1444910,1502657,1510821,1516518,1519859,1522078,1523205,1523736,1523776,1525982,1526005,1536829,1537222,1604238,1610563,1611829,1614462,1624381,1675204,1675517,1678238,1678251,1687873-1687874,1688306,1688484,1688523,1691618,1712175,1717360,1727931,1728247,1729480,1729493,1730100,1730108,1735181,1735282,1740570,1747445,1750549,1756534,1783447,1792531,1792556,1792559
+/pivot/trunk:1346574,1347051,1394847,1394858,1398511,1399331,1401781,1405882,1407585,1409081,1410536,1410555,1417081,1417258,1428056,1428650,1435351,1436707,1438126,1438659,1444260,1444910,1502657,1510821,1516518,1519859,1522078,1523205,1523736,1523776,1525982,1526005,1536829,1537222,1604238,1610563,1611829,1614462,1624381,1675204,1675517,1678238,1678251,1687873-1687874,1688306,1688484,1688523,1691618,1712175,1717360,1727931,1728247,1729480,1729493,1730100,1730108,1735181,1735282,1740570,1747445,1750549,1756534,1783447,1792531,1792556,1792559,1792775
Modified: pivot/branches/2.0.x/core/src/org/apache/pivot/util/Version.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/core/src/org/apache/pivot/util/Version.java?rev=1792783&r1=1792782&r2=1792783&view=diff
==============================================================================
--- pivot/branches/2.0.x/core/src/org/apache/pivot/util/Version.java (original)
+++ pivot/branches/2.0.x/core/src/org/apache/pivot/util/Version.java Wed Apr 26 17:41:11 2017
@@ -133,7 +133,11 @@ public class Version implements Comparab
String build = null;
String revision;
- int i = string.indexOf("-");
+ // Some "version" strings separate fields with a space
+ int i = string.indexOf(" ");
+ if (i == -1) {
+ i = string.indexOf("-");
+ }
if (i == -1) {
revision = string;
} else {
Modified: pivot/branches/2.0.x/core/test/org/apache/pivot/util/test/VersionTest.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/core/test/org/apache/pivot/util/test/VersionTest.java?rev=1792783&r1=1792782&r2=1792783&view=diff
==============================================================================
--- pivot/branches/2.0.x/core/test/org/apache/pivot/util/test/VersionTest.java (original)
+++ pivot/branches/2.0.x/core/test/org/apache/pivot/util/test/VersionTest.java Wed Apr 26 17:41:11 2017
@@ -89,4 +89,20 @@ public class VersionTest {
System.out.format("test getNumber(): %1$s -> %2$d%n", vNum, num);
assertEquals("long number", num, 562954248454244L);
}
+
+ @Test
+ public void testOtherVersions() {
+ // Taken from PIVOT-996 test case
+ final String PIVOT_996_SUFFIX = "25.51-b14";
+ final String PIVOT_996_INPUT = "8.1.028 " + PIVOT_996_SUFFIX;
+ final String PIVOT_996_OUTPUT = "8.1.28_00-" + PIVOT_996_SUFFIX;
+
+ Version jvmVersionParsed = Version.decode(PIVOT_996_INPUT);
+ Version jvmVersionExplicit = new Version(8, 1, 28, 0, PIVOT_996_SUFFIX);
+ String parsedToString = jvmVersionParsed.toString();
+
+ assertEquals("PIVOT-996 test case", jvmVersionParsed, jvmVersionExplicit);
+ System.out.format("PIVOT-996 parsed/toString: %1$s, expected: %2$s%n", parsedToString, PIVOT_996_OUTPUT);
+ assertEquals("PIVOT-996 toString", parsedToString, PIVOT_996_OUTPUT);
+ }
}