You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/10/31 18:25:14 UTC
incubator-tinkerpop git commit: Tweaks to Neo4jHelper as
NotFoundException should be checked as the reason for isNotFound() catch.
Also, static String construction for cost savings.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/TINKERPOP3-899 4c6ba90fc -> 1a31b78c4
Tweaks to Neo4jHelper as NotFoundException should be checked as the reason for isNotFound() catch. Also, static String construction for cost savings.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/1a31b78c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/1a31b78c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/1a31b78c
Branch: refs/heads/TINKERPOP3-899
Commit: 1a31b78c4a158f7fcdbbf01f09d9d2801a12ab11
Parents: 4c6ba90
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 31 11:25:00 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 31 11:25:00 2015 -0600
----------------------------------------------------------------------
.../gremlin/neo4j/structure/Neo4jHelper.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/1a31b78c/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java
index 7c8c0d0..b205019 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java
@@ -19,16 +19,15 @@
package org.apache.tinkerpop.gremlin.neo4j.structure;
import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Element;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.neo4j.tinkerpop.api.Neo4jNode;
-import org.neo4j.tinkerpop.api.Neo4jRelationship;
/**
* @author Marko A. Rodriguez (http://markorodriguez.com)
*/
public final class Neo4jHelper {
+ private static final String NOT_FOUND_EXCEPTION = "NotFoundException";
+
private Neo4jHelper() {
}
@@ -45,13 +44,16 @@ public final class Neo4jHelper {
try {
node.getKeys();
return false;
- } catch (final IllegalStateException e) {
- return true;
+ } catch (final RuntimeException e) {
+ if (isNotFound(e))
+ return true;
+ else
+ throw e;
}
}
- public static boolean isNotFound(RuntimeException ex) {
- return ex.getClass().getSimpleName().equals("NotFoundException");
+ public static boolean isNotFound(final RuntimeException ex) {
+ return ex.getClass().getSimpleName().equals(NOT_FOUND_EXCEPTION);
}
public static Neo4jNode getVertexPropertyNode(final Neo4jVertexProperty vertexProperty) {