-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
6
-
Cause Known
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)
Also tested on
robo@troll:~/src/java$ ~/pkg/java/jdk1.7.0/bin/java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b24)
Java HotSpot(TM) 64-Bit Server VM (build 12.0-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux troll 2.6.24-12-generic #1 SMP Wed Mar 12 22:31:43 UTC 2008 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Creating a panel where I want one component on top, empty space for components and a filler to push things up.
I create a GridBagLayout and add the top component and then try to add the filler component at GridBagConstraints.gridy = Integer.MAX_VALUE.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile supplied code, run class
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program runs without problems
ACTUAL -
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2147483647
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2147483647
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:1507)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:893)
at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:713)
at java.awt.Container.preferredSize(Container.java:1616)
at java.awt.Container.getPreferredSize(Container.java:1601)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize(JRootPane.java:903)
at java.awt.Container.preferredSize(Container.java:1616)
at java.awt.Container.getPreferredSize(Container.java:1601)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:702)
at java.awt.Container.preferredSize(Container.java:1616)
at java.awt.Container.getPreferredSize(Container.java:1601)
at java.awt.Window.pack(Window.java:670)
at GBLTest.createAndShowGUI(GBLTest.java:19)
at GBLTest.access$000(GBLTest.java:6)
at GBLTest$1.run(GBLTest.java:26)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class GBLTest {
private static void createAndShowGUI() {
JFrame frame = new JFrame("Crash Test Dummy");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridBagLayout layout = new GridBagLayout ();
GridBagConstraints gc = new GridBagConstraints ();
gc.gridx = 0;
gc.gridy = Integer.MAX_VALUE;
gc.weightx = 1;
JTextField tf = new JTextField (15);
frame.setLayout (layout);
frame.add (tf, gc);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Let gridy be some random reasonably large value like 1000 instead.
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)
Also tested on
robo@troll:~/src/java$ ~/pkg/java/jdk1.7.0/bin/java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b24)
Java HotSpot(TM) 64-Bit Server VM (build 12.0-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux troll 2.6.24-12-generic #1 SMP Wed Mar 12 22:31:43 UTC 2008 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Creating a panel where I want one component on top, empty space for components and a filler to push things up.
I create a GridBagLayout and add the top component and then try to add the filler component at GridBagConstraints.gridy = Integer.MAX_VALUE.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
compile supplied code, run class
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program runs without problems
ACTUAL -
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2147483647
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 2147483647
at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:1507)
at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:893)
at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:713)
at java.awt.Container.preferredSize(Container.java:1616)
at java.awt.Container.getPreferredSize(Container.java:1601)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize(JRootPane.java:903)
at java.awt.Container.preferredSize(Container.java:1616)
at java.awt.Container.getPreferredSize(Container.java:1601)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:702)
at java.awt.Container.preferredSize(Container.java:1616)
at java.awt.Container.getPreferredSize(Container.java:1601)
at java.awt.Window.pack(Window.java:670)
at GBLTest.createAndShowGUI(GBLTest.java:19)
at GBLTest.access$000(GBLTest.java:6)
at GBLTest$1.run(GBLTest.java:26)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JFrame;
import javax.swing.JTextField;
public class GBLTest {
private static void createAndShowGUI() {
JFrame frame = new JFrame("Crash Test Dummy");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridBagLayout layout = new GridBagLayout ();
GridBagConstraints gc = new GridBagConstraints ();
gc.gridx = 0;
gc.gridy = Integer.MAX_VALUE;
gc.weightx = 1;
JTextField tf = new JTextField (15);
frame.setLayout (layout);
frame.add (tf, gc);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Let gridy be some random reasonably large value like 1000 instead.