cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject git commit: catch NumberFormatException
Date Mon, 25 Mar 2013 15:08:32 GMT
Updated Branches:
  refs/heads/trunk 772bacb18 -> a2ccd2f70


catch NumberFormatException


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

Branch: refs/heads/trunk
Commit: a2ccd2f706c03f5053e09c2a8bdaa23eb1795121
Parents: 772bacb
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Mon Mar 25 07:49:05 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Mon Mar 25 10:08:27 2013 -0500

----------------------------------------------------------------------
 .../apache/cassandra/service/CassandraDaemon.java  |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a2ccd2f7/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index 67c2bf2..d1c2cd0 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -144,7 +144,17 @@ public class CassandraDaemon
         {
             String[] java_version = javaVersion.split("_");
             String java_major = java_version[0];
-            int java_minor = (java_version.length > 1) ? Integer.parseInt(java_version[1])
: 0;
+            int java_minor;
+            try
+            {
+                java_minor = (java_version.length > 1) ? Integer.parseInt(java_version[1])
: 0;
+            }
+            catch (NumberFormatException e)
+            {
+                // have only seen this with java7 so far but no doubt there are other ways
to break this
+                logger.info("Unable to parse java version {}", Arrays.toString(java_version));
+                java_minor = 32;
+            }
             if (java_major.equals("1.6.0"))
             {
                 // These need to be updated from time to time, but these are currently valid
(12.18.2012)


Mime
View raw message