我已将Neo4j从2.3.8升级到3.3.1。访问 hits = index.query(query); 时,我得到了nullPointerException。 下面是我的代码。
protected Record getNext() throws Exception {
Transaction tx=neo.beginTx();
try {
if (hits == null) {
if (query!=null) {
hits = index.query(query);
tx.success();
}
}
T next = hits.next();
if (next == null) {
return finished();
} else {
return nodeToRecord.call(next);
}
}
您可以在上面的代码中检查我正在检查的查询!= null,但仍会得到nullpointer。索引有问题吗?
以下是错误
Unexpected error : java.lang.NullPointerException
at au.com.graph.NodeIterator.getNext(GraphNodeIterator.java:64)
at au.com.graph.NodeIterator.getNext.getNext(GraphNodeIterator.java:22)
at com.googlecode.totallylazy.iterators.StatefulIterator.hasNext(StatefulIterator.java:23)
at com.googlecode.totallylazy.iterators.StatefulIterator.next(StatefulIterator.java:36)
at com.googlecode.totallylazy.Computation$2.call(Computation.java:80)
at com.googlecode.totallylazy.callables.LazyCallable.get(LazyCallable.java:19)
at com.googlecode.totallylazy.Lazy.call(Lazy.java:22)
at com.googlecode.totallylazy.Computation.isEmpty(Computation.java:121)