NullPointerException post upgrading Neo4j 3.3.1 while accessing Index

45 Views Asked by At

I have upgraded Neo4j from 2.3.8 to 3.3.1. While accessing hits = index.query(query); I'm getting nullPointerException. Below is my code.

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);
    }
}

You can check in the above code I'm checking query!=null, but still getting nullpointer. Is the problem with Index?

Below is the error

 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)
0

There are 0 best solutions below