cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/3] git commit: fix potential NPE
Date Thu, 14 Jun 2012 23:04:09 GMT
Updated Branches:
  refs/heads/trunk 15577ba86 -> aae0dfc92


fix potential NPE


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

Branch: refs/heads/trunk
Commit: aae0dfc92aa6e17e1b977788ec8a4280cd4fce42
Parents: 6a858a3
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Jun 14 17:57:25 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Jun 14 18:03:47 2012 -0500

----------------------------------------------------------------------
 .../org/apache/cassandra/net/MessagingService.java |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/aae0dfc9/src/java/org/apache/cassandra/net/MessagingService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java
index a9cb1a6..9c92402 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -764,10 +764,14 @@ public final class MessagingService implements MessagingServiceMBean
         return buffer;
     }
 
-    public Integer setVersion(InetAddress address, int version)
+    /**
+     * @return the last version associated with address, or @param version if this is the
first such version
+     */
+    public int setVersion(InetAddress address, int version)
     {
         logger.debug("Setting version {} for {}", version, address);
-        return versions.put(address, version);
+        Integer v = versions.put(address, version);
+        return v == null ? version : v;
     }
 
     public void resetVersion(InetAddress endpoint)


Mime
View raw message