Re: org.apache.xindice.core.filer.BTree

Vadim Gritsenko <[email protected]>
Newsgroups gmane.text.xml.xindice.devel
Message-ID <[email protected]>
Todd Byrne wrote:
> In getBTreeNode(long page, BTreeNode parent)(line ) if an exception gets
> thrown for what ever reason it just gets ignored and null returned. This
> seems problematic because nothing that calls this method checks for
> null. Worse seems getChildNode(int idx)(line 534) doesn't check and is
> called in about 11 places and none of their callers check for null.
> 
> My hunch is to let the exception be thrown and then we will get meaning
> full stack traces instead of NPEs later and have to search the log files
> later. If an exception was thrown like PageNotFound we could catch it in
> the result code and gracefully skip the document.
> 
> Thoughts Ideas?

The only exception which should be thrown from this method is IOException, as 
far as I can see. And I agree, I think it is better to get IOException rather 
then rather pointless NPE.

So for a quick fix, I'd try and change method signature(s) to include 
IOException and pass it up instead of eating it.


It brings though a point of how xindice should handle exceptional situations 
like this. If it is at all possible, it should recover. E.g., it is better to be 
able to extract some documents from damaged collection then none at all.


Vadim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.