[jsword-devel] Another patch

DM Smith dmsmith555 at yahoo.com
Wed Jun 30 13:03:26 MST 2004

When I submit a patch, I usually find it easier to wait before doing 
more changes. So I frequently go the Synchronize view and check for updates.

Anyway, thanks for applying it.

Right now I am working on some performance improvements. I have found 
that some code is being invoked redundantly for a single action. By 
fixing it, the program is much more responsive in displaying large passages.

I am also going through and reviewing the use of exceptions.

I have found quite a bit of the following construct:

if (xxx == null)
    throw new NullPointerException();

While in a few cases there was a message, it did not add to the meaning.

Where the test represents an expectation of the programmer to do the 
right thing, I am changing it to:
assert xxx != null;
or getting rid of it all together.

I also have found some overridden methods of the form:
void doSomething()
	throw new NullPointerException("Not implemented");

I am also changing the signature of setBookData to not throw a 
BookException. It was only needed in one place where the setting Book 
data also displayed the text. In that one case, I have it reporting the 
exception directly.


Joe Walker wrote:
> Hi,
> Just realized that I applied the patch a while ago and forgot to say.
> Thanks, lots of improvements.
> Joe.
> DM Smith wrote:
>> Joe,
>> I have merged your changes and have prepared another patch.
>> This patch has a bunch of bug fixes and updates.
>> Whenever moving the mouse (mouse enter, mouse move, mouse leave) over a
>> checkbox, the checkbox listener was fired. The upshot is that
>> unnecessary work was being repeated.
>> ChangeListner listens for all changes concerning a checkbox not just
>> whether it is set or cleared. ItemListner does just that.
>> Changed code:
>>     DisplaySelectPane
>>     ExceptionPane
>> I improved ExceptionPane to show file name and line number even when 
>> there is source. Ultimately, the line should be highlighted.
>> In Desktop.java the hyperlink listener was on the list twice. I removed
>> one of them.
>> Hebrew text display now works correctly. To do this the following had to
>> be done:
>>   o Compute and store the orientation of the language in BookMetaData.
>>     (Note, this uses Sw*ng to compute it. So this may need changing.)
>>   o Each time a passage viewed, set the viewer's ComponentOrientation.
>>   o Pass the orientation to the XSLT.
>> This caused a bunch of code to change:
>> DesktopActions passes orientation to the XLST.
>> TextPaneBookDataDisplay passes orientation to the XSLT.
>> simple.xsl was changed:
>>   to accept an orientation
>>   to use it to change the layout of the table when there are notes
>>   I also improved this table's layout in general.
>> BookMetaData I added boolean isLeftToRight()
>> DefaultBookMetaData I had it return true and added a task to do it right
>> SwordBookMetaData computes the value of isLeftToRight.
>> Fixed bugs in Msg.properties where ever it occurred:
>> In a MsgFormat a single apostrophe ' is an indicator that everything
>> between it and the next, if there is one, is to be treated as a literal.
>> The symptom that led me to this was that the {0} and {1} for an
>> Exception pane were showing up. To have a single quote, you use two in a
>> row.
>> I also un-escaped double quotes. I think this was an artifact of moving
>> the strings from code to a resource bundle.
>> I also fixed a cut and paste error in a Msg.properties.
>> Based on the earlier thread for EventListenerList, I put it back to the
>> non-Sw*ng version in non-Sw*ng code.
>> Removed "RealFont" from ConfigurableSwingConverter as it was not used.
>> Changed ViewSourcePane to copy from the selected tab.
>> In PathField I changed the "do" methods to have the expected names:
>>   doAddEntry -> doAddPathEntry
>>   doUpdateEntry -> doUpdatePathEntry
>>   doRemoveEntry -> doRemovePathEntry
>> In StringUtil I removed methods that have direct equivalents in apache
>> commons and methods that are not used at all.
>> Fixed a bug in ExceptionPane and did some general improvements.
>> In MapTable I got rid of a couple of error messages by replacing them
>> with asserts.
>> In Project.java I moved a couple of unused/dead symbolic constants to
>> the new limbo/.../BookRoot.
>> There were too many places in the code that were doing the conversion of
>> the byte array to a String.
>> I changed the signature in Backend of
>>     byte[] getRawText(Key)
>> to
>>     String getRawText(Key key, String charset)
>> In support of this I added
>> String SwordUtil.decode(Key key, byte[] data, String charset)
>> and
>> String SwordUtil.clean(Key key, String data)
>> In both cases Key is being passed for reporting purposes only.
>> ------------------------------------------------------------------------
>> _______________________________________________
>> jsword-devel mailing list
>> jsword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/jsword-devel
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel

More information about the jsword-devel mailing list