Bug 712211 - Null Pointer Exception in SwingUtilities2
Null Pointer Exception in SwingUtilities2
Product: Fedora
Classification: Fedora
Component: java-1.6.0-openjdk (Show other bugs)
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Denis Lila
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2011-06-09 15:39 EDT by Kyle J. Harms
Modified: 2011-07-26 02:18 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-07-26 02:18:20 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Kyle J. Harms 2011-06-09 15:39:06 EDT
Description of problem:
Java applications (For example: Alice) with empty swing popup menus crash because of a null pointer exception in SwingUtilities2.

Version-Release number of selected component (if applicable):
$ java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.1) (fedora-
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

How reproducible:
Use test program: http://hg.openjdk.java.net/jdk7/jdk7/jdk/rev/d353dcff4f14

Actual results:
	at sun.swing.SwingUtilities2.getLeftSideBearing(SwingUtilities2.java:241)
	at sun.swing.MenuItemLayoutHelper.getLeftExtraWidth(MenuItemLayoutHelper.java:162)
	at sun.swing.MenuItemLayoutHelper.calcExtraWidths(MenuItemLayoutHelper.java:158)
	at sun.swing.MenuItemLayoutHelper.reset(MenuItemLayoutHelper.java:148)
	at javax.swing.plaf.synth.SynthMenuItemLayoutHelper.<init>(SynthMenuItemLayoutHelper.java:119)
	at javax.swing.plaf.synth.SynthGraphicsUtils.getPreferredMenuItemSize(SynthGraphicsUtils.java:434)
	at javax.swing.plaf.synth.SynthMenuItemUI.getPreferredMenuItemSize(SynthMenuItemUI.java:195)
	at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredSize(BasicMenuItemUI.java:363)
	at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
	at javax.swing.BoxLayout.checkRequests(BoxLayout.java:481)
	at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:298)
	at javax.swing.plaf.synth.DefaultMenuLayout.preferredLayoutSize(DefaultMenuLayout.java:66)
	at java.awt.Container.preferredSize(Container.java:1605)
	at java.awt.Container.getPreferredSize(Container.java:1590)
	at javax.swing.JComponent.getPreferredSize(JComponent.java:1636)
	at javax.swing.JPopupMenu.adjustPopupLocationToFitScreen(JPopupMenu.java:358)
	at javax.swing.JPopupMenu.getPopup(JPopupMenu.java:791)
	at javax.swing.JPopupMenu.setVisible(JPopupMenu.java:748)
	at javax.swing.JPopupMenu.show(JPopupMenu.java:921)

Expected results:
No exception. No crash.

Additional info:
jdk7 bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7037283
jdk7 fix: http://hg.openjdk.java.net/jdk7/jdk7/jdk/rev/d353dcff4f14
Comment 1 Denis Lila 2011-06-10 11:43:41 EDT
Hi Kyle.

Thank you very much for finding the changeset that fixes this (in jdk7). I will test it out and backport it.
Comment 2 Kyle J. Harms 2011-06-17 13:19:03 EDT
I reported the wrong bug for openjdk for this:  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7036148
Comment 3 Denis Lila 2011-06-17 13:26:05 EDT
That makes sense. The first bug description didn't seem very related.

Either way, the changeset link you posted does fix the problem, and I've backported it. The fix should be in the next update of icedtea6-1.10.

Note You need to log in before you can comment on or make changes to this bug.