[jsword-devel] YAP (yet another patch)
DM Smith
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
passageSelected)
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
DisplaySelectPane.setPassage(Passage ref)
to
DisplaySelectPane.setPassageLabel(String text)
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
BookException.
This affects the following derived classes insignificantly in removing
the exception:
CommentaryPane
DictionaryPane
ProxyBookDataDisplay
ReferencePane (in limbo)
SplitBookDataDisplay
TabbedBookDataDisplay
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:
BibleViewPane
CommentaryPane
DictionaryPane
ProxyBookDataDisplay
SplitBookDataDisplay
TabbedBookDataDisplay
ReferencePane.
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)
DictionaryPane
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;
xxx.doSomething()
is not equivalent (A):
if (xxx == null) assert false;
else xxx.doSomething;
but the following would be (B):
assert xxx != null;
xxx.doSomething();
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:
bibledesktop
Desktop
PassageListModel
common
Config
EventListenerList
ExceptionShelf
jsword
Defaults
SentanceUtil
PassageAbstractBook
InstallManager
SwordDictionary
AbstractPassage
VerseRange
ConverterFactory
Speed (actually no assert. Just removed test. The call to getData does
the assert)
WordItemsMem (in limbo)
StubDictionrary (in limbo)
In ClassUtil, I changed the class passed to Logger to be ClassUtil and
not StringUtil.
Removed TODO on Book.getData. It always returns non-null or throws a
BookException.
Removed Book.hasData as it was not used.
This affected:
AbstractBook
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
mailing list