[ 
https://issues.apache.org/jira/browse/TINKERPOP-1832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16258432#comment-16258432
 ] 

ASF GitHub Bot commented on TINKERPOP-1832:
-------------------------------------------

GitHub user pietermartin opened a pull request:

    https://github.com/apache/tinkerpop/pull/751

    TINKERPOP-1832: TraversalHelper.replaceStep sets previousStep to the wrong 
step

    https://issues.apache.org/jira/browse/TINKERPOP-1832
    
    `TraversalHelper.replaceStep` needs to first remove the step before adding 
in the new step. Else it gets its `previousStep` pointer wrong.
    
    Added `TraversalHelperTest.shouldSetPreviousStepToEmptyStep` which was the 
scenario that originally made me aware of the issue.
    
    Ran `mvn clean install` and tested Sqlg's tests with the fix.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pietermartin/tinkerpop TINKERPOP-1832

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/751.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #751
    
----
commit d40381c337ade06cf02388d014b7cc6d4ac8d7a1
Author: pieter <[email protected]>
Date:   2017-11-19T10:17:50Z

    TINKERPOP-1832 - Fix bug where TraversalHelper.replaceStep sets the steps' 
previousStep incorrectly.
    It needs to remove the replaced step before inserting the new step.

----


> TraversalHelper.replaceStep sets previousStep to the wrong step
> ---------------------------------------------------------------
>
>                 Key: TINKERPOP-1832
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1832
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.3.0
>            Reporter: pieter martin
>            Assignee: Daniel Kuppitz
>
> The bug is described over 
> [here|http://mail-archives.apache.org/mod_mbox/tinkerpop-dev/201710.mbox/browser]
> I have tested [~dkuppitz] fix for it and all seems well.
> {code:java}
>     public static <S, E> void replaceStep(final Step<S, E> removeStep, final 
> Step<S, E> insertStep, final Traversal.Admin<?, ?> traversal) {
>         final int i;
>         traversal.removeStep(i = stepIndex(removeStep, traversal));
>         traversal.addStep(i, insertStep);
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to