minor fix in has(accessor, value, values)

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

Branch: refs/heads/TINKERPOP-1280
Commit: 957525104c856cb2924d0f690cb59158be52e756
Parents: dea8e84
Author: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Authored: Tue Sep 13 23:13:07 2016 +0200
Committer: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Committed: Tue Sep 13 23:13:07 2016 +0200

----------------------------------------------------------------------
 .../gremlin/process/traversal/dsl/graph/GraphTraversal.java    | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95752510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index 1aa5000..d025184 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@ -972,6 +972,9 @@ public interface GraphTraversal<S, E> extends Traversal<S, 
E> {
         if (value instanceof Object[]) {
             final Object[] arr = (Object[]) value;
             if (values.length == 0) {
+                if (arr.length == 1) {
+                    return has(accessor, P.eq(arr));
+                }
                 objects = arr;
             } else {
                 objects = new Object[arr.length + values.length];
@@ -979,6 +982,9 @@ public interface GraphTraversal<S, E> extends Traversal<S, 
E> {
                 System.arraycopy(values, 0, objects, arr.length, 
values.length);
             }
         } else {
+            if (values.length == 0) {
+                return has(accessor, value instanceof P ? (P) value : 
P.eq(value));
+            }
             objects = new Object[values.length + 1];
             objects[0] = value;
             System.arraycopy(values, 0, objects, 1, values.length);

Reply via email to