Sunday, March 13, 2011

Bug Fixes

I spent most of both days this weekend in Concord watching my daughter and her fellow dancers do a great job at a competition. It was a fun time being proud of my daughter, but I didn't make a lot of progress on this project.

I did manage to fix a few bugs with the interaction of the combo boxes to narrow down the accounts by categories. The major one was that when you double click on an item in the table or chart the corresponding combo box is selected. But, the list of available categories to group by was losing too many items. It was just supposed to lose the item that was just selected. It turns out that the first update to the list was causing a nested update that removed the wrong item. During the initial update I set a flag that I already had to prevent redundant updates and that made it work much better.

I also fixed a performance bug when the model RDF files were opened. I had added a cache for the Jena models, but it turned out I wasn't putting the models in the cache. That was an easy fix once I realized the cause. I found it when I added better logging using SLF4J. I've used log4j almost exclusively in prior projects, but Jena uses SLF4J so I looked into it. It allows the logging to be switched at deploy time, which is cool, and I am still using log4j underneath.

I fixed the sorting of the table column of budget amounts. I had rendered floats from Jena using NumberFormat into Strings that were added to the table. But, as I've seen countless times before, sorting numbers as Strings sorts the first digit, not by place value. I fixed this by using BigDecimal consistently so I can get numeric sorting, control over the decimal places so they always show cents, and I added a simple renderer to the table to add commas to separate the thousands.

Lastly, I started adding unit tests based on UISpec4J. I haven't used this before, but I've done a lot of unit testing of non-GUI code before and from what I read on the web, UISpec4J seems like a great framework for Swing applications like this. I have very basic tests working, but my first substantive test that opens an RDF file is stuck trying to capture the heavyweight FileDialog that is recommended for Mac OS X. Or, maybe I just don't have the window interceptors initialized properly. I added a menu item to open an RDF model from a file for faster and more targeted testing, but I still don't have this test working. Still a few bugs to work out....

No comments:

Post a Comment