You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/05/26 12:58:04 UTC

[41/45] tinkerpop git commit: Improved error messaging in addV() CTR

Improved error messaging in addV() CTR


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

Branch: refs/heads/tp32-glv
Commit: 1ee5b37535467cf60c7d4671ab3728af18d3e057
Parents: 7bf6883
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 25 08:19:36 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 25 08:19:36 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                               | 1 +
 .../process/traversal/dsl/graph/GraphTraversalSource.java        | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1ee5b375/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index be8059d..31a4064 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Improved error messaging on the `g.addV(Object...)` when passing an invalid arguments.
 * Reduced memory usage for TinkerGraph deserialization in GraphSON by streaming vertices and edges.
 * Now using Groovy `[...]` map notation in `GroovyTranslator` instead of `new LinkedHashMap(){{ }}`.
 * Maintained type information on `Traversal.promise()`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1ee5b375/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index af78add..1b6a218 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -41,6 +41,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Transaction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.util.ArrayList;
@@ -263,16 +264,15 @@ public class GraphTraversalSource implements TraversalSource {
      */
     @Deprecated
     public GraphTraversal<Vertex, Vertex> addV(final Object... keyValues) {
+        ElementHelper.legalPropertyKeyValueArray(keyValues);
         if (keyValues.length != 0 && keyValues[0].equals(T.label)) {
             final GraphTraversal<Vertex, Vertex> traversal = this.addV(keyValues[1].toString());
-            this.addV(keyValues[1].toString());
             for (int i = 2; i < keyValues.length; i = i + 2) {
                 traversal.property(keyValues[i], keyValues[i + 1]);
             }
             return traversal;
         } else {
             final GraphTraversal<Vertex, Vertex> traversal = this.addV();
-            this.addV(keyValues[1].toString());
             for (int i = 0; i < keyValues.length; i = i + 2) {
                 traversal.property(keyValues[i], keyValues[i + 1]);
             }