removed the Exception handling in the getRepeatTraversal() per @dkuppitz 
comment. Yes, it was stupid to throw the exception there -- lazy, dumb thinking 
on my part.


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

Branch: refs/heads/TINKERPOP-1730
Commit: 53db262511e9d84b1262522fc841ded825df4fc6
Parents: b28701f
Author: Marko A. Rodriguez <okramma...@gmail.com>
Authored: Wed Sep 13 09:50:26 2017 -0600
Committer: Marko A. Rodriguez <okramma...@gmail.com>
Committed: Wed Sep 13 09:50:26 2017 -0600

----------------------------------------------------------------------
 .../gremlin/process/traversal/step/branch/RepeatStep.java      | 6 ++----
 .../traversal/strategy/optimization/RepeatUnrollStrategy.java  | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/53db2625/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 15c8be1..bf2c203 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,8 +91,6 @@ 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;
     }
 
@@ -183,7 +181,7 @@ public final class RepeatStep<S> extends 
ComputerAwareStep<S, S> implements Trav
 
     @Override
     protected Iterator<Traverser.Admin<S>> standardAlgorithm() throws 
NoSuchElementException {
-        if(null == this.repeatTraversal)
+        if (null == this.repeatTraversal)
             throw new IllegalStateException("The repeat()-traversal was not 
defined: " + this);
 
         while (true) {
@@ -207,7 +205,7 @@ public final class RepeatStep<S> extends 
ComputerAwareStep<S, S> implements Trav
 
     @Override
     protected Iterator<Traverser.Admin<S>> computerAlgorithm() throws 
NoSuchElementException {
-        if(null == this.repeatTraversal)
+        if (null == this.repeatTraversal)
             throw new IllegalStateException("The repeat()-traversal was not 
defined: " + this);
 
         final Traverser.Admin<S> start = this.starts.next();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/53db2625/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RepeatUnrollStrategy.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RepeatUnrollStrategy.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RepeatUnrollStrategy.java
index 078e749..aaf1a55 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RepeatUnrollStrategy.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/RepeatUnrollStrategy.java
@@ -56,7 +56,7 @@ public final class RepeatUnrollStrategy extends 
AbstractTraversalStrategy<Traver
         for (int i = 0; i < traversal.getSteps().size(); i++) {
             if (traversal.getSteps().get(i) instanceof RepeatStep) {
                 final RepeatStep<?> repeatStep = (RepeatStep) 
traversal.getSteps().get(i);
-                if (null == repeatStep.getEmitTraversal() &&
+                if (null == repeatStep.getEmitTraversal() && null != 
repeatStep.getRepeatTraversal() &&
                         repeatStep.getUntilTraversal() instanceof 
LoopTraversal && ((LoopTraversal) repeatStep.getUntilTraversal()).getMaxLoops() 
> 0 &&
                         
!TraversalHelper.hasStepOfAssignableClassRecursively(Scope.global, 
DedupGlobalStep.class, repeatStep.getRepeatTraversal()) &&
                         
!TraversalHelper.hasStepOfAssignableClassRecursively(INVALIDATING_STEPS, 
repeatStep.getRepeatTraversal())) {

Reply via email to