Creation of "Nul" Favorites

Bug #193423 reported by wcstarks
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
FreeGuide-TV
Fix Released
Medium
Unassigned

Bug Description

After adding a few Favorites, all of a sudden, all entries in the program grid became marked as favorites. After some struggling to get rid of the unwanted Favorites, I right clicked on an (any) entry in the guide and selected to remove the associated favorite status. The program then said it was removing a "Nul" Favorite. When it did that, all the entries in the guide gride lost their favorite status and were returned to normal.

Evidentally, The program had allowed me to accidentally create a "Nul" Favorite, which was not visable in the Favorites list and which was interpreted by the program as a "wild card", causing all entries in the grid to become marked favorites. After removing the Nul Favorite, everthing became normal again and I was able to create a usuable list of Favorites.

This is evidence of the need of a fix in the program module which creates Favorites, to prevent the creation of Nul Favorites.

I am not sure exactly what I did to cause the creation of a nul record, but just before it happened, I think I may have either left edit screen without any data entered or somehow canceled the screen in such a way as to save a nul record.

Wade

Changed in freeguide-tv:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Arisian (mmclagan) wrote :

The following patch corrects the missing entry in the Favourites List dialog when a "nul" favourite is created. The resulting favourite was left out previously, this shows up as "All Programs" or the foreign language equivalent.

Revision history for this message
Arisian (mmclagan) wrote :

One path for creation of a null favourite was the following:

Bring up the favourites dialog
Select Add
Select Cancel
Select a different favourite and Select Edit
Select Ok
Select Ok

You now have a null favourite. Most programs (except those with anti-select records) are now highlighted and bear the heart icon.

Revision history for this message
Arisian (mmclagan) wrote :

The following patch makes several changes and fixes a number of related issues within the scope of this bug:

1) The following error is shown when creating a null as in comment #2 then trying to access the favourites dialog:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at java.text.CollationElementIterator.<init>(CollationElementIterator.java:102)
        at java.text.RuleBasedCollator.getCollationElementIterator(RuleBasedCollator.java:303)
        at java.text.RuleBasedCollator.compare(RuleBasedCollator.java:351)
        at freeguide.common.lib.fgspecific.selection.Favourite$FavouriteComparator.compare(Favourite.java:341)
        at java.util.Arrays.mergeSort(Arrays.java:1270)
        at java.util.Arrays.mergeSort(Arrays.java:1282)
        .....

The removing of the redundant sort at line 53 resolves this problem.

2) The example in comment #2 is resolved by changes in lines 91 - 112.

3) Removed the redundant call to getSelectedIndex at line 118.

4) Editing a favourite did not properly update the list dialog (any chance which modifies the "name" of the favourite).

FWIW, even after this patch you can still create a null favourite (different method than comment 2).

Revision history for this message
Arisian (mmclagan) wrote :

The final way to create a null favourite is:

Select Tools/Favorites...
Select Add
Select Ok
Select Ok

That creates a null favourite.

The patch modifies the updateFavourite() routine to track whether any part of the favourite has a value assigned to it. This determines whether the dialog is allowed to call quit(), exiting the dialog with a null favourite.

After the patch is applied, there remain two deficiencies in the favourite list/dialog:

1) It is still possible to shoot oneself in the foot -- a favourite which selects all programs on a given day, after a certain time, before a certain time or on a specific channel can still be created. Most choices of this sort are probably not reasonable. The current code does almost no validation (which is why it was possible to create a null in the first place).

2) The user is not notified why clicking "OK" has not resulted in the closure of the dialog -- it should most likely have an audible sound and/or a message box.

Otherwise, I don't believe it's possible to create a null after the patches are applied.

Revision history for this message
Arisian (mmclagan) wrote :

In comment #3, item #1 it turns out the sort isn't as redundant as I thought -- it turns out my favourites are already pretty well sorted to start with. It seemed like the list box model was doing sorting of the entries when it displayed them. Apparently it's not. That section of the patch should be removed.

That creates a different problem -- when a favourite is added or edited, the list and associated model should be resorted

Revision history for this message
Andy Balaam (mail-artificialworlds) wrote :

Thanks - I have committed freeguide-0.10.12-bug193423-c.patch with an added error dialog when we refuse to allow the user to click OK.

Revision history for this message
Andy Balaam (mail-artificialworlds) wrote :

Thanks! I have committed a modified version of freeguide-0.10.12-bug193423-b.patch, and I think this bug is now fixed.

Changed in freeguide-tv:
status: Confirmed → Fix Committed
Changed in freeguide-tv:
milestone: none → 0.11
Changed in freeguide-tv:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.