LOG.debug(db.debugPageContents(p));
	public Object next() {		Lock lock = db.getLock();		NodeImpl nextNode = null;		try {			try {				lock.acquire(Lock.READ_LOCK);			} catch (LockException e) {				return null;			}			if(gotoNextPosition()) {			    boolean skipped = false;			    do {					DOMFile.DOMFilePageHeader ph = p.getPageHeader();					// next value larger than length of the current page?					if (offset >= ph.getDataLength()) {						// load next page in chain						long nextPage = ph.getNextDataPage();						if (nextPage < 0) {							LOG.debug("bad link to next " + p.page.getPageInfo() + "; previous: " +									ph.getPrevDataPage());							return null;						}//						LOG.debug(page + " -> " + nextPage);						page = nextPage;						p = db.getCurrentPage(nextPage);						db.addToBuffer(p);						offset = 0;					}					// extract the tid					lastTID = ByteConversion.byteToShort(p.data, offset);					offset += 2;					//	check if this is just a link to a relocated node					if(ItemId.isLink(lastTID)) {						// skip this						long link = ByteConversion.byteToLong(p.data, offset);						offset += 8;//						System.out.println("skipping link on p " + page + " -> " + //								StorageAddress.pageFromPointer(link));						skipped = true;						continue;					}					// read data length					short l = ByteConversion.byteToShort(p.data, offset);					offset += 2;					if(ItemId.isRelocated(lastTID)) {						// found a relocated node. Skip the next 8 bytes						offset += 8;					}					//	overflow page? load the overflow value					if(l == DOMFile.OVERFLOW) {//					    LOG.warn("unexpected overflow page at " + p.getPageNum() + "; tid = " + //					            ItemId.getId(lastTID) + "; offset = " + offset + "; skipped = " + skipped);						l = 8;						final long overflow = ByteConversion.byteToLong(p.data, offset);						offset += 8;						final byte[] odata = db.getOverflowValue(overflow);						nextNode = NodeImpl.deserialize(odata, 0, odata.length, doc, useNodePool);					// normal node					} else {						nextNode = NodeImpl.deserialize(p.data, offset, l, doc, useNodePool);						offset += l;					}					if(nextNode == null) {					    LOG.warn("illegal node on page " + p.getPageNum() + "; tid = " + ItemId.getId(lastTID) +					            "; next = " + p.getPageHeader().getNextDataPage() + "; prev = " + 					            p.getPageHeader().getPrevDataPage() + "; offset = " + (offset - l) +					            "; len = " + p.getPageHeader().getDataLength());					    return null;					}					nextNode.setInternalAddress(						StorageAddress.createPointer((int) page, ItemId.getId(lastTID))					);					nextNode.setOwnerDocument(doc);//					System.out.println("Next: " + nextNode.getNodeName() + " [" + page + "]");			    } while(nextNode == null);			}			return nextNode;		} catch (BTreeException e) {			LOG.warn(e.getMessage(), e);		} catch (IOException e) {			LOG.warn(e.getMessage(), e);		} finally {			lock.release();		}		return null;	}