Updated Branches:
  refs/heads/cassandra-1.2 05a39610d -> a19a15a2b

Remove unreachable (and unecessary) code


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

Branch: refs/heads/cassandra-1.2
Commit: a19a15a2bacd12c758180da0cf51e0af5e0411c1
Parents: 05a3961
Author: Sylvain Lebresne <sylv...@datastax.com>
Authored: Thu Apr 4 19:37:39 2013 +0200
Committer: Sylvain Lebresne <sylv...@datastax.com>
Committed: Thu Apr 4 19:37:53 2013 +0200

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cql3/Lists.java |   13 ++++---------
 src/java/org/apache/cassandra/cql3/Maps.java  |    9 ++-------
 src/java/org/apache/cassandra/cql3/Sets.java  |   11 ++++-------
 3 files changed, 10 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a19a15a2/src/java/org/apache/cassandra/cql3/Lists.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Lists.java 
b/src/java/org/apache/cassandra/cql3/Lists.java
index 36694e5..b579b8c 100644
--- a/src/java/org/apache/cassandra/cql3/Lists.java
+++ b/src/java/org/apache/cassandra/cql3/Lists.java
@@ -70,15 +70,10 @@ public abstract class Lists
             {
                 Term t = rt.prepare(valueSpec);
 
-                if (!(t instanceof Constants.Value))
-                {
-                    if (t instanceof Term.NonTerminal)
-                        throw new 
InvalidRequestException(String.format("Invalid list literal for %s: bind 
variables are not supported inside collection literals", receiver));
-                    else
-                        throw new 
InvalidRequestException(String.format("Invalid list literal for %s: nested 
collections are not supported", receiver));
-                }
-
-                // We don't allow prepared marker in collections, nor nested 
collections
+                if (t instanceof Term.NonTerminal)
+                    throw new InvalidRequestException(String.format("Invalid 
list literal for %s: bind variables are not supported inside collection 
literals", receiver));
+
+                // We don't allow prepared marker in collections, nor nested 
collections (for the later, prepare will throw an exception)
                 assert t instanceof Constants.Value;
                 ByteBuffer bytes = ((Constants.Value)t).bytes;
                 if (bytes == null)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a19a15a2/src/java/org/apache/cassandra/cql3/Maps.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Maps.java 
b/src/java/org/apache/cassandra/cql3/Maps.java
index 875dc47..ed282bf 100644
--- a/src/java/org/apache/cassandra/cql3/Maps.java
+++ b/src/java/org/apache/cassandra/cql3/Maps.java
@@ -71,13 +71,8 @@ public abstract class Maps
                 Term k = entry.left.prepare(keySpec);
                 Term v = entry.right.prepare(valueSpec);
 
-                if (!(k instanceof Constants.Value && v instanceof 
Constants.Value))
-                {
-                    if (k instanceof Term.NonTerminal || v instanceof 
Term.NonTerminal)
-                        throw new 
InvalidRequestException(String.format("Invalid map literal for %s: bind 
variables are not supported inside collection literals", receiver));
-                    else
-                        throw new 
InvalidRequestException(String.format("Invalid map literal for %s: nested 
collections are not supported", receiver));
-                }
+                if (k instanceof Term.NonTerminal || v instanceof 
Term.NonTerminal)
+                    throw new InvalidRequestException(String.format("Invalid 
map literal for %s: bind variables are not supported inside collection 
literals", receiver));
 
                 // We don't support values > 64K because the serialization 
format encode the length as an unsigned short.
                 ByteBuffer keyBytes = ((Constants.Value)k).bytes;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/a19a15a2/src/java/org/apache/cassandra/cql3/Sets.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Sets.java 
b/src/java/org/apache/cassandra/cql3/Sets.java
index 8d67761..fed6625 100644
--- a/src/java/org/apache/cassandra/cql3/Sets.java
+++ b/src/java/org/apache/cassandra/cql3/Sets.java
@@ -72,14 +72,11 @@ public abstract class Sets
             {
                 Term t = rt.prepare(valueSpec);
 
-                if (!(t instanceof Constants.Value))
-                {
-                    if (t instanceof Term.NonTerminal)
-                        throw new 
InvalidRequestException(String.format("Invalid set literal for %s: bind 
variables are not supported inside collection literals", receiver));
-                    else
-                        throw new 
InvalidRequestException(String.format("Invalid set literal for %s: nested 
collections are not supported", receiver));
-                }
+                if (t instanceof Term.NonTerminal)
+                    throw new InvalidRequestException(String.format("Invalid 
set literal for %s: bind variables are not supported inside collection 
literals", receiver));
 
+                // We don't allow prepared marker in collections, nor nested 
collections (for the later, prepare will throw an exception)
+                assert t instanceof Constants.Value;
                 ByteBuffer bytes = ((Constants.Value)t).bytes;
                 if (bytes == null)
                     throw new InvalidRequestException("null is not supported 
inside collections");

Reply via email to