[jsword-devel] Versification and Bible book names

Martin Denham mjdenham at gmail.com
Tue Feb 25 14:13:16 MST 2014


Bible book names are currently looked up in Versification code but I am not
sure this is correct because support for getting the name of a Bible book
not in the versification is not provided?.

Versifications throw a NullPointerException if an attempt is made to get
the name of a Bible book not contained in that versification.

I keep changing code to work around the above situation but realistically
if the user is in the NT and then chooses a Module that doesn't support the
NT it would be better if attempting to get the name (even to log an error)
did not throw an exception.

Here is a simple junit to demonstrate the issue:

        Versification MT = Versifications.instance().getVersification("MT");
        Verse v = new Verse(MT, BibleBook.MATT, 1, 1);
        v.toString();

Throws:
java.lang.NullPointerException
at
org.crosswire.jsword.versification.BibleNames.getPreferredName(BibleNames.java:64)
at
org.crosswire.jsword.versification.Versification.getPreferredName(Versification.java:290)
at org.crosswire.jsword.passage.Verse.doGetName(Verse.java:622)
at org.crosswire.jsword.passage.Verse.getName(Verse.java:271)
at org.crosswire.jsword.passage.Verse.getName(Verse.java:256)
at org.crosswire.jsword.passage.Verse.toString(Verse.java:249)

What do you think?

Thanks
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20140225/77a781da/attachment.html>


More information about the jsword-devel mailing list