tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [01/11] tinkerpop git commit: added better error message for RepeatStep usage errors. [Forced Update!]
Date Wed, 20 Sep 2017 15:16:25 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1731 a42b04fc7 -> 212660377 (forced update)


added better error message for RepeatStep usage errors.


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

Branch: refs/heads/TINKERPOP-1731
Commit: b28701f7c660c87b05edee3404a66c2fb3671089
Parents: c59393f
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Mon Sep 11 11:56:20 2017 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Mon Sep 11 11:56:20 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                           | 1 +
 .../gremlin/process/traversal/step/branch/RepeatStep.java    | 8 ++++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b28701f7/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index c15835c..6876fde 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.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added better error message for illegal use of `repeat()`-step.
 * Bump to Jackson 2.8.10.
 * Added an `EmbeddedRemoteConnection` so that it's possible to mimic a remote connection
within the same JVM.
 * The Console's `plugin.txt` file is only updated if there were manually uninstalled plugins.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b28701f7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
index 0fc2cdd..15c8be1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/RepeatStep.java
@@ -91,6 +91,8 @@ public final class RepeatStep<S> extends ComputerAwareStep<S, S>
implements Trav
     }
 
     public Traversal.Admin<S, S> getRepeatTraversal() {
+        if(null == this.repeatTraversal)
+            throw new IllegalStateException("The repeat()-traversal was not defined: " +
this);
         return this.repeatTraversal;
     }
 
@@ -181,6 +183,9 @@ public final class RepeatStep<S> extends ComputerAwareStep<S,
S> implements Trav
 
     @Override
     protected Iterator<Traverser.Admin<S>> standardAlgorithm() throws NoSuchElementException
{
+        if(null == this.repeatTraversal)
+            throw new IllegalStateException("The repeat()-traversal was not defined: " +
this);
+
         while (true) {
             if (this.repeatTraversal.getEndStep().hasNext()) {
                 return this.repeatTraversal.getEndStep();
@@ -202,6 +207,9 @@ public final class RepeatStep<S> extends ComputerAwareStep<S,
S> implements Trav
 
     @Override
     protected Iterator<Traverser.Admin<S>> computerAlgorithm() throws NoSuchElementException
{
+        if(null == this.repeatTraversal)
+            throw new IllegalStateException("The repeat()-traversal was not defined: " +
this);
+
         final Traverser.Admin<S> start = this.starts.next();
         if (doUntil(start, true)) {
             start.resetLoops();


Mime
View raw message