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/24 18:50:14 UTC

svn commit: r1792532 - 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: Mon Apr 24 18:50:14 2017
New Revision: 1792532

URL: http://svn.apache.org/viewvc?rev=1792532&view=rev
Log:
PIVOT-993:  Update Version.java to correctly calculate the long
"getNumber()" value.  Update IllegalArgumentException messages to
indicate up to 7FFF inclusive.

Add a core "VersionTest.java" to test the new Version parsing and
"getNumber" calculations.

This is a merge of revision 1792531 from "trunk" to "branches/2.0.x".

Added:
    pivot/branches/2.0.x/core/test/org/apache/pivot/util/test/VersionTest.java
      - copied unchanged from r1792531, pivot/trunk/core/test/org/apache/pivot/util/test/VersionTest.java
Modified:
    pivot/branches/2.0.x/   (props changed)
    pivot/branches/2.0.x/core/src/org/apache/pivot/util/Version.java

Propchange: pivot/branches/2.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr 24 18:50:14 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
+/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

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=1792532&r1=1792531&r2=1792532&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 Mon Apr 24 18:50:14 2017
@@ -42,22 +42,22 @@ public class Version implements Comparab
     public Version(int majorRevision, int minorRevision, int maintenanceRevision,
         int updateRevision, String build) {
         if (majorRevision > 0x7fff) {
-            throw new IllegalArgumentException("majorRevision must be less than "
+            throw new IllegalArgumentException("majorRevision must be less than or equal "
                 + 0x7fff + ".");
         }
 
         if (minorRevision > 0x7fff) {
-            throw new IllegalArgumentException("minorRevision must be less than "
+            throw new IllegalArgumentException("minorRevision must be less than or equal "
                 + 0x7fff + ".");
         }
 
         if (maintenanceRevision > 0x7fff) {
-            throw new IllegalArgumentException("maintenanceRevision must be less than "
+            throw new IllegalArgumentException("maintenanceRevision must be less than or equal "
                 + 0x7fff + ".");
         }
 
         if (updateRevision > 0x7fff) {
-            throw new IllegalArgumentException("updateRevision must be less than "
+            throw new IllegalArgumentException("updateRevision must be less than or equal "
                 + 0x7fff + ".");
         }
 
@@ -85,10 +85,10 @@ public class Version implements Comparab
     }
 
     public long getNumber() {
-        long number = ((majorRevision) & 0xffff) << (16 * 3)
-            | ((minorRevision) & 0xffff) << (16 * 2)
-            | ((maintenanceRevision) & 0xffff) << (16 * 1)
-            | ((updateRevision) & 0xffff) << (16 * 0);
+        long number = (long)((majorRevision) & 0xffff) << (16 * 3)
+            | (long)((minorRevision) & 0xffff) << (16 * 2)
+            | (long)((maintenanceRevision) & 0xffff) << (16 * 1)
+            | (long)((updateRevision) & 0xffff) << (16 * 0);
 
         return number;
     }