Bug 27523 - ArrayIndexOutOfBoundsException with full-screen JFrame
Summary: ArrayIndexOutOfBoundsException with full-screen JFrame
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: swing (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: 0.92
Assignee: Roman Kennke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-09 18:39 UTC by Yvan Norsa
Modified: 2006-06-06 14:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Test-case (252 bytes, text/x-java)
2006-05-09 18:40 UTC, Yvan Norsa
Details
Patch preventing the exception (394 bytes, patch)
2006-05-09 18:48 UTC, Yvan Norsa
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yvan Norsa 2006-05-09 18:39:24 UTC
A full-screen JFrame with a JMenuBar, which has a JMenu inside, will throw an ArrayIndexOutOfBoundsException when visible.
Comment 1 Yvan Norsa 2006-05-09 18:40:22 UTC
Created attachment 11425 [details]
Test-case

Here is the corresponding stacktrace :
Exception during event dispatch:
java.lang.ArrayIndexOutOfBoundsException: 0
   at javax.swing.MenuSelectionManager.processKeyEvent(MenuSelectionManager.java:300)
   at javax.swing.JMenu.processKeyEvent(JMenu.java:769)
   at java.awt.Component.processEvent(Component.java:2967)
   at java.awt.Container.processEvent(Container.java:914)
   at java.awt.Component.dispatchEventImpl(Component.java:5033)
   at java.awt.Container.dispatchEventImpl(Container.java:1741)
   at java.awt.Component.dispatchEvent(Component.java:2322)
   at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1111)
   at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:280)
   at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:253)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:74)
   at java.lang.VMThread.run(VMThread.java:135)
Comment 2 Yvan Norsa 2006-05-09 18:48:49 UTC
Created attachment 11426 [details]
Patch preventing the exception

This patch checks the size of the selection array in MenuSelectionManager.processKeyEvent().
Comment 3 Roman Kennke 2006-06-06 14:14:06 UTC
Fixed in CVS.
Comment 4 cvs-commit@developer.classpath.org 2006-06-06 14:16:11 UTC
Subject: Bug 27523

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Changes by:	Roman Kennke <rabbit78>	06/06/06 14:12:50

Modified files:
	javax/swing    : MenuSelectionManager.java 
	.              : ChangeLog 

Log message:
	2006-06-06  Roman Kennke  <kennke@aicas.com>
	
		PR 27523
		* javax/swing/MenuSelectionManager.java
		(processKeyEvent): Added check to avoid
		ArrayIndexOutOfBoundsException.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/MenuSelectionManager.java?cvsroot=classpath&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.7677&r2=1.7678

Patches:

Index: ChangeLog
===================================================================
RCS file: /cvsroot/classpath/classpath/ChangeLog,v
retrieving revision 1.7677
retrieving revision 1.7678
diff -u -b -r1.7677 -r1.7678
--- ChangeLog	6 Jun 2006 13:51:36 -0000	1.7677
+++ ChangeLog	6 Jun 2006 14:12:50 -0000	1.7678
@@ -1,3 +1,10 @@
+2006-06-06  Roman Kennke  <kennke@aicas.com>
+
+	PR 27523
+	* javax/swing/MenuSelectionManager.java
+	(processKeyEvent): Added check to avoid
+	ArrayIndexOutOfBoundsException.
+
 2006-06-06  Audrius Meskauskas  <AudriusA@Bioinformatics.org>
 
 	* gnu/javax/swing/text/html/htmlAttributeSet.java