[jsword-devel] NPE in RawFileBackend#getCardinality

DM Smith dmsmith at crosswire.org
Mon Feb 11 15:54:24 MST 2013


On Feb 11, 2013, at 5:27 PM, Chris Burrell <chris at burrell.me.uk> wrote:

> Hi
> 
> On line 124, we have a potential NPE:
> 
> state.getIdxRaf() can return a null value if for some reason we are attempting to read the cardinality of a module, but the idx file for the module is not present.
> 
> In this case, I'm looking at the 2babdict module, for which I have a conf file but no module files under modules/lexdict/rawld
> 
> Obviously, this is an issue, but I wonder if the reading of the .conf file should identify the absence of modules and therefore 
> a- report early to the user that something is wrong
> b- not show-up in the list of installed() modules

The code regarding backends is in process of change, maybe done.

The way the code used to work:
For the list of installed books (i.e. for each conf) build an appropriate backend, which would log an error and throw an exception if the files for the module were not present and mark the module as unsupported.

The problem with that model is that it is expensive on startup when lots of modules are installed. There is a Jira issue regarding improving this performance.

The other problem is that it has no memory of the error and on next startup, it does the work again.

It seems to me that when the module is installed, that'd be a great time to validate it fully and mark it as validated.

In JSword we have ReporterUtil to let the user know of events like this. It might not work in STEP as it is tied to a listener mechanism.

It'd be good to iterate on this to get a good solution.

I'm looking at 2babdict to see if I can identify the problem.

In Him,	
	DM




More information about the jsword-devel mailing list