Wednesday, April 25, 2007

Java: En Guard update

The En Guard Call Tracking System had a few known bugs that we were living with for the past few months until I could find time to correct them. Specifically a record could be overwritten without any prompt and the old information lost. Also when a new record was saved the default text from the top field was added to the record on occasion. Solving the second problem was the easier of the two. At the end of the constructor the New() method was called, the one used when the Reset button is pressed. This seemed to resolve the problem as it was only happening on the very first record entered after En Guard was opened. After some testing it was found that if the Reset button was pressed after opening En Guard the issue would not arise, so this is now done automatically when En Guard is initialized.

The second issue was a little more serious, but still not too difficult. There is a test when saving that checks if the file already exists so that the old information can be inserted before the new call information. Using that check I wrote a boolean If statement that would cancel the save attempt and post an error message. This would happen only if both the file already existed and the text in the Current Record JTextArea field was still the default text instead of the output from the existing file. The user would be prompted to open the old record and copy the last call's data into the Additional Information field before saving the record.

Now the next bug to fix is the word wrapping for the JTextArea fields. Currently any text will wrap, but it does so in a way that leaves part of a word on one line and continues it on the next. It wraps separate characters instead of the entire word and I think I'll need to completely rewrite that part of the program to correct this issue.

No comments: