You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dec 30, 2015 1:55:44 PM com.orientechnologies.common.log.OLogManager log
INFO: OrientDB auto-config DISKCACHE=10,695MB (heap=3,641MB os=16,384MB disk=62,946MB)
user1
user2
Exception in thread "main" java.lang.NullPointerException
at com.kruth.orientdb.OrientDBTesting.main(OrientDBTesting.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
There seems to be two issues here:
The iterator doesn't start at 'user0'.
The iterator runs into nulls at the end instead of ending properly.
@kruthar Index cursor is correct, cursor implements 2 interfaces Iterator#hasNext() and Iterator#next() and IndexCursor#nextEntry both those interfaces are not related to each other.
Can you help me explain the behaviour I'm seeing? Were the errors I posted reproducible? Is there obvious errors in what I am attempting to do in the sample?
Perfectly acceptable if the cursor code is correct, but the null pointer still happens with what I assumed was the correct usage.
Also if you look at Javadoc of nextEntry() method is will find that it is not related to hasNext() method and designed to return null if there are no more elements inside of cursor.
I am trying to use an iterator over entries in an ODictionary. Small test class looks like this:
I'm using this dependency through Maven:
The output looks like this:
There seems to be two issues here:
From what I can see, both issues stem from OSBTreeIndexEngine#OSBTreeIndexCursor not using
nextEntry
. This class extends OIndexAbstractCursor which maintains iterator state withnextEntry
as you can see here: https://github.com/orientechnologies/orientdb/blob/master/core/src/main/java/com/orientechnologies/orient/core/index/OIndexAbstractCursor.java#L80-L100. So, OSBTreeIndexEngine#OSBTreeIndexCursor should use nextEntry also, or potentially override hasNext() and next().I did not look to see if any of the other OIndexCursor implementations have the same issue.
The text was updated successfully, but these errors were encountered: