If pageId
is null then standard Blueprints behavior is to throw an IllegalArgumentException
which is enforced by this test:
That said, I think you are talking about vertex existence (as you wrote "if pageId
doesn't exist). In the case of existence, standard Blueprints behavior is to return null
if the identifier does not find a vertex with it. This behavior is enforced by this test:
As you can see in my REPL session, Titan works as expected given the tests:
gremlin> g = TitanFactory.open('conf/titan-cassandra.properties')
==>titangraph[cassandrathrift:127.0.0.1]
gremlin> g.getVertex(4)
==>v[4]
gremlin> g.getVertex(8)
==>null
gremlin> g.getVertex(null)
Vertex id can not be null
Display stack trace? [yN] y
java.lang.IllegalArgumentException: Vertex id can not be null
This is all expected behavior given the Blueprints API. As far as "why" it works this way....I think that IllegalArgumentException
wouldn't be appropriate for a "not found" situation. At the end of the day, this was largely just a design decision and we thought that returning null
was better than tossing an exception to provide feedback on "existence".