Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D33D911826 for ; Tue, 26 Aug 2014 15:29:55 +0000 (UTC) Received: (qmail 5402 invoked by uid 500); 26 Aug 2014 15:29:55 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 5364 invoked by uid 500); 26 Aug 2014 15:29:55 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 5342 invoked by uid 99); 26 Aug 2014 15:29:55 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Aug 2014 15:29:55 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2BE0DA02C9A; Tue, 26 Aug 2014 15:29:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: slebresne@apache.org To: commits@cassandra.apache.org Date: Tue, 26 Aug 2014 15:29:55 -0000 Message-Id: <681dc1ff983e48a5965d6b8b88a56d9b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: Fix error messages Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 fdf293dc1 -> 8c1fc4130 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 Commit: 86e3012633866d049ac3898ed710ee278b7de3ee Parents: d1f38cd Author: Sylvain Lebresne Authored: Tue Aug 26 17:16:37 2014 +0200 Committer: Sylvain Lebresne 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 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.emptyMap()); - ColumnSpecification valueSpec = Sets.valueSpecOf(receiver); Set values = new HashSet(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)