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 2019/05/09 13:26:36 UTC

[tinkerpop] branch TINKERPOP-2212 created (now 1a7152e)

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a change to branch TINKERPOP-2212
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git.


      at 1a7152e  TINKERPOP-2212 Fixed detachement problem in Path

This branch includes the following new commits:

     new 1a7152e  TINKERPOP-2212 Fixed detachement problem in Path

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[tinkerpop] 01/01: TINKERPOP-2212 Fixed detachement problem in Path

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch TINKERPOP-2212
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 1a7152e77b1a05b42ad7c175ca46557eadc30d28
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu May 9 09:25:35 2019 -0400

    TINKERPOP-2212 Fixed detachement problem in Path
    
    If the Path contained a Collection it would not properly detach the objects within the collection.
---
 CHANGELOG.asciidoc                                 |  1 +
 .../structure/util/detached/DetachedPath.java      | 18 +++++------------
 .../structure/util/reference/ReferencePath.java    | 23 +++++-----------------
 3 files changed, 11 insertions(+), 31 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index f5e5562..a1e664b 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -32,6 +32,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Prevented client-side hangs if metadata generation fails on the server.
 * Fixed bug with `EventStrategy` in relation to `addE()` where detachment was not happening properly.
 * Ensured that `gremlin.sh` works when directories contain spaces.
+* Fixed bug in detachment of `Path` where embedded `List` objects would prevent that process.
 * Enabled `ctrl+c` to interrupt long running processes in Gremlin Console.
 * Quieted "host unavailable" warnings for both the driver and Gremlin Console.
 * Fixed bug in `GremlinGroovyScriptEngine` interpreter mode around class definitions.
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedPath.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedPath.java
index 3cf946c..250923f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedPath.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/detached/DetachedPath.java
@@ -32,9 +32,7 @@ import java.util.function.Function;
  */
 public class DetachedPath extends MutablePath implements Attachable<Path> {
 
-    private DetachedPath() {
-
-    }
+    private DetachedPath() {}
 
     public Path get() {
         return this;
@@ -42,17 +40,11 @@ public class DetachedPath extends MutablePath implements Attachable<Path> {
 
     protected DetachedPath(final Path path, final boolean withProperties) {
         path.forEach((object, labels) -> {
-            if (object instanceof DetachedElement || object instanceof DetachedProperty || object instanceof DetachedPath) {
+            if (object instanceof DetachedElement || object instanceof DetachedProperty || object instanceof DetachedPath)
                 this.objects.add(object);
-            } else if (object instanceof Element) {
-                this.objects.add(DetachedFactory.detach((Element) object, withProperties));
-            } else if (object instanceof Property) {
-                this.objects.add(DetachedFactory.detach((Property) object));
-            } else if (object instanceof Path) {
-                this.objects.add(DetachedFactory.detach((Path) object, withProperties));
-            } else {
-                this.objects.add(object);
-            }
+            else
+                this.objects.add(DetachedFactory.detach(object, withProperties));
+
             //Make a copy of the labels as its an UnmodifiableSet which can not be serialized.
             this.labels.add(new LinkedHashSet<>(labels));
         });
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferencePath.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferencePath.java
index e70554b..ea595a4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferencePath.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferencePath.java
@@ -32,9 +32,7 @@ import java.util.function.Function;
  */
 public class ReferencePath extends MutablePath implements Attachable<Path> {
 
-    private ReferencePath() {
-
-    }
+    private ReferencePath() {}
 
     public Path get() {
         return this;
@@ -42,22 +40,11 @@ public class ReferencePath extends MutablePath implements Attachable<Path> {
 
     protected ReferencePath(final Path path) {
         path.forEach((object, labels) -> {
-            if (object instanceof ReferenceElement || object instanceof ReferenceProperty || object instanceof ReferencePath) {
-                this.objects.add(object);
-                this.labels.add(new HashSet<>(labels));
-            } else if (object instanceof Element) {
-                this.objects.add(ReferenceFactory.detach((Element) object));
-                this.labels.add(new HashSet<>(labels));
-            } else if (object instanceof Property) {
-                this.objects.add(ReferenceFactory.detach((Property) object));
-                this.labels.add(new HashSet<>(labels));
-            } else if (object instanceof Path) {
-                this.objects.add(ReferenceFactory.detach((Path) object));
-                this.labels.add(new HashSet<>(labels));
-            } else {
+            if (object instanceof ReferenceElement || object instanceof ReferenceProperty || object instanceof ReferencePath)
                 this.objects.add(object);
-                this.labels.add(new HashSet<>(labels));
-            }
+            else
+                this.objects.add(ReferenceFactory.detach(object));
+            this.labels.add(new HashSet<>(labels));
         });
     }