[jsword-devel] YAP (yet another patch)
dmsmith555 at yahoo.com
Thu Jul 1 11:05:21 MST 2004
I will be on vacation until next Monday, so there is no rush and I may
not be able to respond to e-mail. For that reason, I have tried to
outline and explain each of the changes.
This patch does the following:
Performance bug in BibleViewPane
I found that when a bible was changed for a visible passage that it got
and displayed the data for that passage 4 times. I traced this to the
listener in BibleViewPane and to the method DisplaySelectPane.setPassage
What I saw was that the listener's two methods were reversed.
passageSelected was setting the book and the passage and
bookChosen was setting the passage (which through recursion called
I flipped the two methods, moving the diagnostic to
TextPaneBookDataDisplay.setBookData and made the setting of book and
passage conditional on it changing.
I also renamed
The reasoning behind this is that setBookData is always called when
either the book or the passage changes. So it is sufficient for both.
Also, in fixing the bug it was necessary to have it not set the passage
as it caused infinite recursion.
Change the signature of BookDataDisplay.setBookData to not throw
This affects the following derived classes insignificantly in removing
ReferencePane (in limbo)
It significantly affects the derived class
TextPaneBookDataDisplay This now uses Reporter to show the exception.
It has the effect of simplifying the following classes that call
setBookData by removing the try catch:
Note that other than BibleViewPane, this is the same list as the
previous since these are proxies to a TextPaneBookDataDisplay.
The following had unsupported operations throwing null pointer
exceptions. They now throw UnsuportedOperationException.
ReferencePane (in limbo)
Changed a few exceptions to an equivalent assert:
Note that asserts can be skipped by not running with -ea so the following
if (xxx == null) throw NPE;
is not equivalent (A):
if (xxx == null) assert false;
but the following would be (B):
assert xxx != null;
In A nothing happens if xxx == null and asserts are not enabled.
In B an exception is thrown. Which the program currently handles.
The following classes have changed:
Speed (actually no assert. Just removed test. The call to getData does
WordItemsMem (in limbo)
StubDictionrary (in limbo)
In ClassUtil, I changed the class passed to Logger to be ClassUtil and
Removed TODO on Book.getData. It always returns non-null or throws a
Removed Book.hasData as it was not used.
Removed character cleanup from SwordBook.getText. This was moved into
SwordUtils but not removed here. So the result was that it was looping
twice. This also got rid of Logger in SwordBook.
Marked PassageSet as dead
More information about the jsword-devel