cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Fix error messages
Date Tue, 26 Aug 2014 15:26:53 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1.0 d1f38cd27 -> 86e301263


Fix error messages


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

Branch: refs/heads/cassandra-2.1.0
Commit: 86e3012633866d049ac3898ed710ee278b7de3ee
Parents: d1f38cd
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Tue Aug 26 17:16:37 2014 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Tue Aug 26 17:26:43 2014 +0200

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cql3/Lists.java   |  6 +++---
 src/java/org/apache/cassandra/cql3/Maps.java    |  8 +++----
 .../org/apache/cassandra/cql3/Operation.java    | 22 ++++++++++----------
 src/java/org/apache/cassandra/cql3/Sets.java    |  8 +++----
 4 files changed, 22 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/86e30126/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 c214fa8..224af50 100644
--- a/src/java/org/apache/cassandra/cql3/Lists.java
+++ b/src/java/org/apache/cassandra/cql3/Lists.java
@@ -76,7 +76,7 @@ public abstract class Lists
                 Term t = rt.prepare(keyspace, valueSpec);
 
                 if (t.containsBindMarker())
-                    throw new InvalidRequestException(String.format("Invalid list literal
for %s: bind variables are not supported inside collection literals", receiver));
+                    throw new InvalidRequestException(String.format("Invalid list literal
for %s: bind variables are not supported inside collection literals", receiver.name));
 
                 if (t instanceof Term.NonTerminal)
                     allTerminal = false;
@@ -90,13 +90,13 @@ public abstract class Lists
         private void validateAssignableTo(String keyspace, ColumnSpecification receiver)
throws InvalidRequestException
         {
             if (!(receiver.type instanceof ListType))
-                throw new InvalidRequestException(String.format("Invalid list literal for
%s of type %s", receiver, receiver.type.asCQL3Type()));
+                throw new InvalidRequestException(String.format("Invalid list literal for
%s of type %s", receiver.name, receiver.type.asCQL3Type()));
 
             ColumnSpecification valueSpec = Lists.valueSpecOf(receiver);
             for (Term.Raw rt : elements)
             {
                 if (!rt.isAssignableTo(keyspace, valueSpec))
-                    throw new InvalidRequestException(String.format("Invalid list literal
for %s: value %s is not of type %s", receiver, rt, valueSpec.type.asCQL3Type()));
+                    throw new InvalidRequestException(String.format("Invalid list literal
for %s: value %s is not of type %s", receiver.name, rt, valueSpec.type.asCQL3Type()));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/86e30126/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 e6beb7e..ce0ba2a 100644
--- a/src/java/org/apache/cassandra/cql3/Maps.java
+++ b/src/java/org/apache/cassandra/cql3/Maps.java
@@ -79,7 +79,7 @@ public abstract class Maps
                 Term v = entry.right.prepare(keyspace, valueSpec);
 
                 if (k.containsBindMarker() || v.containsBindMarker())
-                    throw new InvalidRequestException(String.format("Invalid map literal
for %s: bind variables are not supported inside collection literals", receiver));
+                    throw new InvalidRequestException(String.format("Invalid map literal
for %s: bind variables are not supported inside collection literals", receiver.name));
 
                 if (k instanceof Term.NonTerminal || v instanceof Term.NonTerminal)
                     allTerminal = false;
@@ -93,16 +93,16 @@ public abstract class Maps
         private void validateAssignableTo(String keyspace, ColumnSpecification receiver)
throws InvalidRequestException
         {
             if (!(receiver.type instanceof MapType))
-                throw new InvalidRequestException(String.format("Invalid map literal for
%s of type %s", receiver, receiver.type.asCQL3Type()));
+                throw new InvalidRequestException(String.format("Invalid map literal for
%s of type %s", receiver.name, receiver.type.asCQL3Type()));
 
             ColumnSpecification keySpec = Maps.keySpecOf(receiver);
             ColumnSpecification valueSpec = Maps.valueSpecOf(receiver);
             for (Pair<Term.Raw, Term.Raw> entry : entries)
             {
                 if (!entry.left.isAssignableTo(keyspace, keySpec))
-                    throw new InvalidRequestException(String.format("Invalid map literal
for %s: key %s is not of type %s", receiver, entry.left, keySpec.type.asCQL3Type()));
+                    throw new InvalidRequestException(String.format("Invalid map literal
for %s: key %s is not of type %s", receiver.name, entry.left, keySpec.type.asCQL3Type()));
                 if (!entry.right.isAssignableTo(keyspace, valueSpec))
-                    throw new InvalidRequestException(String.format("Invalid map literal
for %s: value %s is not of type %s", receiver, entry.right, valueSpec.type.asCQL3Type()));
+                    throw new InvalidRequestException(String.format("Invalid map literal
for %s: value %s is not of type %s", receiver.name, entry.right, valueSpec.type.asCQL3Type()));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/86e30126/src/java/org/apache/cassandra/cql3/Operation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cql3/Operation.java b/src/java/org/apache/cassandra/cql3/Operation.java
index 3aeed2e..103606f 100644
--- a/src/java/org/apache/cassandra/cql3/Operation.java
+++ b/src/java/org/apache/cassandra/cql3/Operation.java
@@ -162,7 +162,7 @@ public abstract class Operation
             Term v = value.prepare(keyspace, receiver);
 
             if (receiver.type instanceof CounterColumnType)
-                throw new InvalidRequestException(String.format("Cannot set the value of
counter column %s (counters can only be incremented/decremented, not set)", receiver));
+                throw new InvalidRequestException(String.format("Cannot set the value of
counter column %s (counters can only be incremented/decremented, not set)", receiver.name));
 
             if (!(receiver.type instanceof CollectionType))
                 return new Constants.Setter(receiver, v);
@@ -206,7 +206,7 @@ public abstract class Operation
         public Operation prepare(String keyspace, ColumnDefinition receiver) throws InvalidRequestException
         {
             if (!(receiver.type instanceof CollectionType))
-                throw new InvalidRequestException(String.format("Invalid operation (%s) for
non collection column %s", toString(receiver), receiver));
+                throw new InvalidRequestException(String.format("Invalid operation (%s) for
non collection column %s", toString(receiver), receiver.name));
 
             switch (((CollectionType)receiver.type).kind)
             {
@@ -215,7 +215,7 @@ public abstract class Operation
                     Term lval = value.prepare(keyspace, Lists.valueSpecOf(receiver));
                     return new Lists.SetterByIndex(receiver, idx, lval);
                 case SET:
-                    throw new InvalidRequestException(String.format("Invalid operation (%s)
for set column %s", toString(receiver), receiver));
+                    throw new InvalidRequestException(String.format("Invalid operation (%s)
for set column %s", toString(receiver), receiver.name));
                 case MAP:
                     Term key = selector.prepare(keyspace, Maps.keySpecOf(receiver));
                     Term mval = value.prepare(keyspace, Maps.valueSpecOf(receiver));
@@ -226,7 +226,7 @@ public abstract class Operation
 
         protected String toString(ColumnSpecification column)
         {
-            return String.format("%s[%s] = %s", column, selector, value);
+            return String.format("%s[%s] = %s", column.name, selector, value);
         }
 
         public boolean isCompatibleWith(RawUpdate other)
@@ -253,7 +253,7 @@ public abstract class Operation
             if (!(receiver.type instanceof CollectionType))
             {
                 if (!(receiver.type instanceof CounterColumnType))
-                    throw new InvalidRequestException(String.format("Invalid operation (%s)
for non counter column %s", toString(receiver), receiver));
+                    throw new InvalidRequestException(String.format("Invalid operation (%s)
for non counter column %s", toString(receiver), receiver.name));
                 return new Constants.Adder(receiver, v);
             }
 
@@ -271,7 +271,7 @@ public abstract class Operation
 
         protected String toString(ColumnSpecification column)
         {
-            return String.format("%s = %s + %s", column, column, value);
+            return String.format("%s = %s + %s", column.name, column.name, value);
         }
 
         public boolean isCompatibleWith(RawUpdate other)
@@ -296,7 +296,7 @@ public abstract class Operation
             if (!(receiver.type instanceof CollectionType))
             {
                 if (!(receiver.type instanceof CounterColumnType))
-                    throw new InvalidRequestException(String.format("Invalid operation (%s)
for non counter column %s", toString(receiver), receiver));
+                    throw new InvalidRequestException(String.format("Invalid operation (%s)
for non counter column %s", toString(receiver), receiver.name));
                 return new Constants.Substracter(receiver, v);
             }
 
@@ -314,7 +314,7 @@ public abstract class Operation
 
         protected String toString(ColumnSpecification column)
         {
-            return String.format("%s = %s - %s", column, column, value);
+            return String.format("%s = %s - %s", column.name, column.name, value);
         }
 
         public boolean isCompatibleWith(RawUpdate other)
@@ -337,14 +337,14 @@ public abstract class Operation
             Term v = value.prepare(keyspace, receiver);
 
             if (!(receiver.type instanceof ListType))
-                throw new InvalidRequestException(String.format("Invalid operation (%s) for
non list column %s", toString(receiver), receiver));
+                throw new InvalidRequestException(String.format("Invalid operation (%s) for
non list column %s", toString(receiver), receiver.name));
 
             return new Lists.Prepender(receiver, v);
         }
 
         protected String toString(ColumnSpecification column)
         {
-            return String.format("%s = %s - %s", column, value, column);
+            return String.format("%s = %s - %s", column.name, value, column.name);
         }
 
         public boolean isCompatibleWith(RawUpdate other)
@@ -393,7 +393,7 @@ public abstract class Operation
         public Operation prepare(String keyspace, ColumnDefinition receiver) throws InvalidRequestException
         {
             if (!(receiver.type instanceof CollectionType))
-                throw new InvalidRequestException(String.format("Invalid deletion operation
for non collection column %s", receiver));
+                throw new InvalidRequestException(String.format("Invalid deletion operation
for non collection column %s", receiver.name));
 
             switch (((CollectionType)receiver.type).kind)
             {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/86e30126/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 1acaacb..20d9ac5 100644
--- a/src/java/org/apache/cassandra/cql3/Sets.java
+++ b/src/java/org/apache/cassandra/cql3/Sets.java
@@ -72,7 +72,6 @@ public abstract class Sets
             if (receiver.type instanceof MapType && elements.isEmpty())
                 return new Maps.Value(Collections.<ByteBuffer, ByteBuffer>emptyMap());
 
-
             ColumnSpecification valueSpec = Sets.valueSpecOf(receiver);
             Set<Term> values = new HashSet<Term>(elements.size());
             boolean allTerminal = true;
@@ -81,7 +80,7 @@ public abstract class Sets
                 Term t = rt.prepare(keyspace, valueSpec);
 
                 if (t.containsBindMarker())
-                    throw new InvalidRequestException(String.format("Invalid set literal
for %s: bind variables are not supported inside collection literals", receiver));
+                    throw new InvalidRequestException(String.format("Invalid set literal
for %s: bind variables are not supported inside collection literals", receiver.name));
 
                 if (t instanceof Term.NonTerminal)
                     allTerminal = false;
@@ -101,14 +100,14 @@ public abstract class Sets
                 if (receiver.type instanceof MapType && elements.isEmpty())
                     return;
 
-                throw new InvalidRequestException(String.format("Invalid set literal for
%s of type %s", receiver, receiver.type.asCQL3Type()));
+                throw new InvalidRequestException(String.format("Invalid set literal for
%s of type %s", receiver.name, receiver.type.asCQL3Type()));
             }
 
             ColumnSpecification valueSpec = Sets.valueSpecOf(receiver);
             for (Term.Raw rt : elements)
             {
                 if (!rt.isAssignableTo(keyspace, valueSpec))
-                    throw new InvalidRequestException(String.format("Invalid set literal
for %s: value %s is not of type %s", receiver, rt, valueSpec.type.asCQL3Type()));
+                    throw new InvalidRequestException(String.format("Invalid set literal
for %s: value %s is not of type %s", receiver.name, rt, valueSpec.type.asCQL3Type()));
             }
         }
 
@@ -283,6 +282,7 @@ public abstract class Sets
         }
     }
 
+    // Note that this is reused for Map substraction too (we substract a set from a map)
     public static class Discarder extends Operation
     {
         public Discarder(ColumnDefinition column, Term t)


Mime
View raw message