classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Please Comment - Patch for MenuSelectionManager or JMenuBar


From: Anthony Balkissoon
Subject: [cp-patches] Please Comment - Patch for MenuSelectionManager or JMenuBar
Date: Mon, 04 Jul 2005 13:55:32 -0400

Clicking on a popup menu and then clicking on another part of the swing
app (ie, not on of the popup menu items) sometimes caused a null pointer
exception.  I found this by running red hat's database gui tool
RHDB-Control Center.

I have 2 proposed solutions and would appreciate feedback on which is
appropriate.  In MenuSelectionManager the following code would generate
a NullPointerException:

subElements = ((MenuElement) selectedPath.get(i)).getSubElements();
for (int j = 0; j < subElements.length; j++)
 {
  if ((subElements[j].getComponent()).equals(c))
   return true;
 }

The problem is that subElements[j] would sometimes be null.
JMenuBar.getSubElements was including null components.  If this is not
allowed, then the patch JMenuBarNullSubElements.diff is most likely
appropriate.  However, if it is allowed, then we need to check for it in
MenuSelectionManager, and the patch
MenuSelectionManagerNullSubElements.diff is most likely appropriate.

Feedback please.

-Tony

Attachment: JMenuBarNullSubElements.diff
Description: Text Data

Attachment: MenuSelectionManagerNullSubElements.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]