cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject git commit: Fix SemanticVersion.isSupportedBy minor/patch handling
Date Thu, 18 Apr 2013 16:47:53 GMT
Updated Branches:
  refs/heads/cassandra-1.2 da93a1cfe -> 455a0fccf


Fix SemanticVersion.isSupportedBy minor/patch handling

patch by Aleksey Yeschenko; reviewed by Jonathan Ellis for
CASSANDRA-5496


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/455a0fcc
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/455a0fcc
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/455a0fcc

Branch: refs/heads/cassandra-1.2
Commit: 455a0fccfb6f2e679c4d69857ccca2899a5a1d33
Parents: da93a1c
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Thu Apr 18 19:47:13 2013 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Thu Apr 18 19:47:13 2013 +0300

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../apache/cassandra/utils/SemanticVersion.java    |    2 +-
 .../cassandra/utils/SemanticVersionTest.java       |    8 ++++++++
 3 files changed, 10 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/455a0fcc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 008a9fb..9929edf 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,7 @@
  * Allow empty blob literals in CQL3 (CASSANDRA-5452)
  * Fix streaming RangeTombstones at column index boundary (CASSANDRA-5418)
  * Fix preparing statements when current keyspace is not set (CASSANDRA-5468)
+ * Fix SemanticVersion.isSupportedBy minor/patch handling (CASSANDRA-5496)
 Merged from 1.1:
  * Fix trying to load deleted row into row cache on startup (CASSANDRA-4463)
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/455a0fcc/src/java/org/apache/cassandra/utils/SemanticVersion.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/SemanticVersion.java b/src/java/org/apache/cassandra/utils/SemanticVersion.java
index fd122ad..175a5bb 100644
--- a/src/java/org/apache/cassandra/utils/SemanticVersion.java
+++ b/src/java/org/apache/cassandra/utils/SemanticVersion.java
@@ -143,7 +143,7 @@ public class SemanticVersion implements Comparable<SemanticVersion>
 
     public boolean isSupportedBy(SemanticVersion version)
     {
-        return major == version.major && minor <= version.minor && patch
<= version.patch;
+        return major == version.major && this.compareTo(version) <= 0;
     }
 
     private static int compareIdentifiers(String[] ids1, String[] ids2, int defaultPred)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/455a0fcc/test/unit/org/apache/cassandra/utils/SemanticVersionTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/utils/SemanticVersionTest.java b/test/unit/org/apache/cassandra/utils/SemanticVersionTest.java
index 010964f..4ead709 100644
--- a/test/unit/org/apache/cassandra/utils/SemanticVersionTest.java
+++ b/test/unit/org/apache/cassandra/utils/SemanticVersionTest.java
@@ -68,6 +68,9 @@ public class SemanticVersionTest
     {
         SemanticVersion v1, v2;
 
+        v1 = new SemanticVersion("3.0.2");
+        assert v1.isSupportedBy(v1);
+
         v1 = new SemanticVersion("1.2.3");
         v2 = new SemanticVersion("1.2.4");
         assert v1.isSupportedBy(v2);
@@ -82,6 +85,11 @@ public class SemanticVersionTest
         v2 = new SemanticVersion("1.3.3");
         assert !v1.isSupportedBy(v2);
         assert !v2.isSupportedBy(v1);
+
+        v1 = new SemanticVersion("3.1.0");
+        v2 = new SemanticVersion("3.0.1");
+        assert !v1.isSupportedBy(v2);
+        assert v2.isSupportedBy(v1);
     }
 
     @Test


Mime
View raw message