boolean txnDone = false;
NextObjectResults result;
try {
DbCursor cursor = oidsDb.openCursor(txn);
try {
boolean found = (oid == -1) ? cursor.findFirst()
: cursor.findNext(encodeLong(oid));
long nextOid = !found ? -1 : decodeLong(cursor.getKey());
if (oid != -1 && oid == nextOid) {
found = cursor.findNext();
nextOid = !found ? -1 : decodeLong(cursor.getKey());