cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Don't encapsulate exception more than needed
Date Mon, 08 Oct 2012 15:49:51 GMT
Updated Branches:
  refs/heads/trunk 9a0d9e586 -> fa56af133


Don't encapsulate exception more than needed


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

Branch: refs/heads/trunk
Commit: fa56af1336073ea19950b37d2403a761690d0ab1
Parents: 9a0d9e5
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Mon Oct 8 17:49:37 2012 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Mon Oct 8 17:49:46 2012 +0200

----------------------------------------------------------------------
 .../cql3/statements/SchemaAlteringStatement.java   |   15 +++------------
 .../cassandra/transport/messages/ErrorMessage.java |    5 ++++-
 2 files changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fa56af13/src/java/org/apache/cassandra/cql3/statements/SchemaAlteringStatement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/statements/SchemaAlteringStatement.java b/src/java/org/apache/cassandra/cql3/statements/SchemaAlteringStatement.java
index 95fc473..e9d4450 100644
--- a/src/java/org/apache/cassandra/cql3/statements/SchemaAlteringStatement.java
+++ b/src/java/org/apache/cassandra/cql3/statements/SchemaAlteringStatement.java
@@ -79,18 +79,9 @@ public abstract class SchemaAlteringStatement extends CFStatement implements
CQL
 
     public ResultMessage execute(ClientState state, List<ByteBuffer> variables) throws
RequestValidationException
     {
-        try
-        {
-            announceMigration();
-            String tableName = cfName == null || columnFamily() == null ? "" : columnFamily();
-            return new ResultMessage.SchemaChange(changeType(), keyspace(), tableName);
-        }
-        catch (ConfigurationException e)
-        {
-            InvalidRequestException ex = new InvalidRequestException(e.toString());
-            ex.initCause(e);
-            throw ex;
-        }
+        announceMigration();
+        String tableName = cfName == null || columnFamily() == null ? "" : columnFamily();
+        return new ResultMessage.SchemaChange(changeType(), keyspace(), tableName);
     }
 
     public ResultMessage executeInternal(ClientState state)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fa56af13/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java b/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java
index 29fc5a6..73a965f 100644
--- a/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java
+++ b/src/java/org/apache/cassandra/transport/messages/ErrorMessage.java
@@ -113,7 +113,10 @@ public class ErrorMessage extends Message.Response
                 case ALREADY_EXISTS:
                     String ksName = CBUtil.readString(body);
                     String cfName = CBUtil.readString(body);
-                    te = new AlreadyExistsException(ksName, cfName);
+                    if (cfName.isEmpty())
+                        te = new AlreadyExistsException(ksName);
+                    else
+                        te = new AlreadyExistsException(ksName, cfName);
                     break;
             }
             return new ErrorMessage(te);


Mime
View raw message