Hello,
I seem to have stumbled on a bug (or at least I think I have). Do the following:
- Create a simple database with a single document - Insert a text node before the start of the document root ("insert node "test" before /root") - Attempt to optimize the database
You will get a NullPointerException at org.basex.index.Names.index(Names.java:84). It appears as though the index is attempting to set statistics information for key id 0 (because the parent is a document), but the stats[] array only gets initialized with objects from index 1 and up.
The other possibility is that text nodes should not be allowed before or after the document root element. I'm a little hazy on what the standards say in this regard. My understanding is that the document node can have prolog content before the root and other content after. I've also seen many documents which parse correctly that have text content before the opening tag (though again, this may not be strictly standard-compliant behavior). If this is the case, then the bug is probably that the insertion update operation is allowed to succeed.
Dave