This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 201786 - [71cat] AssertionError at org.netbeans.modules.form.layoutsupport.griddesigner.GridDesigner$3.actionPerformed
Summary: [71cat] AssertionError at org.netbeans.modules.form.layoutsupport.griddesigne...
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Petr Somol
URL:
Keywords:
: 203770 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-07 22:42 UTC by sunbiz
Modified: 2011-10-26 14:27 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 181020


Attachments
stacktrace (2.86 KB, text/plain)
2011-09-07 22:42 UTC, sunbiz
Details
stacktrace (2.86 KB, text/plain)
2011-09-19 23:30 UTC, sunbiz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sunbiz 2011-09-07 22:42:18 UTC
Build: NetBeans IDE Dev (Build 201109060600)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.1-b02, Java(TM) SE Runtime Environment, 1.6.0_26-b03
OS: Windows 7

User Comments:
sunbiz: Pressed on Upgrade in the Grid bag layout designer while was pressing the Undo button to change, got this exception




Stacktrace: 
java.lang.AssertionError
   at org.netbeans.modules.form.layoutsupport.griddesigner.GridDesigner$3.actionPerformed(GridDesigner.java:365)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
   at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
Comment 1 sunbiz 2011-09-07 22:42:22 UTC
Created attachment 110507 [details]
stacktrace
Comment 2 Jan Stola 2011-09-08 08:58:02 UTC
Steps to reproduce:
1. Create a new JPanel.
2. Set its layout to GridBagLayout.
3. Invoke Customize Layout... action from the context menu of the panel.
   => grid designer is shown.
4. Press 'Enable uniform gaps' button in grid designer's toolbar.
5. Press 'Undo' button in grid designer's toolbar.
6. Press 'Enable uniform gaps' button in grid designer's toolbar again.
   => the mentioned exception is thrown.
Comment 3 asenk 2011-09-13 14:05:16 UTC
I don't want to fill a new bug, because I think this problem is related.

If I follow Jans steps, one problem is this exception. The second problem is that in the end there is twice more columns and rows. Using undo or redo again doesn't help.
Comment 4 sunbiz 2011-09-19 23:30:59 UTC
Created attachment 110887 [details]
stacktrace

1.) New CDC Application
2.) New CrEme JFrame Form
3.) Right-click on the JFrame -> Set Layout -> Gridbag Layout
4.) Customize Layout
5.) Click on Enable Uniform Gaps
6.) GUI Form Form Upgrade request window comes up. Press Cancel.
7.) Click the Enable Uniform Gaps toggle again... and this exception is thrown
Comment 5 Petr Somol 2011-09-27 07:49:16 UTC
fixed in jet-main
http://hg.netbeans.org/jet-main/rev/d91a554b464f
Comment 6 Quality Engineering 2011-09-28 14:00:44 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/d91a554b464f
User: Petr Somol <psomol@netbeans.org>
Log: #201786 - [71cat] AssertionError at form.layoutsupport.griddesigner.GridDesigner$3.actionPerformed
Comment 7 Jan Stola 2011-10-09 22:44:42 UTC
> fixed in jet-main
> http://hg.netbeans.org/jet-main/rev/d91a554b464f

The fix of this issue is incorrect. The part that adds listener support to UndoRedoSupport should be removed. You shouldn't observe undo/redo actions, you should observe the model properties that affect the state of the gap button, i.e., columnWidths and rowHeights properties.

The following test-case shows where the mentioned "fix" fails

1. Create Samples > Java > GUI Form Examples project
2. Open Antenna.java
3. Set layout of the root container (JFrame) to Grid Bag Layout.
4. Invoke Cutomize Layout ... action on the root container.
5. Press Enable Uniform Gaps button.
   => Upgrade dialog is shown.
6. Press Cancel in the dialog.
7. Press Disable Uniform Gaps button
   => the exception is thrown

Your fix fails here because the model properties are not modified through the undo/redo actions that you are observing.
Comment 8 Jan Stola 2011-10-19 13:10:16 UTC
*** Bug 203770 has been marked as a duplicate of this bug. ***
Comment 9 Petr Somol 2011-10-25 15:41:21 UTC
Jan, thank you for identifying the problem with listening on Undo/Redo. 
Fixed in jet-main:
http://hg.netbeans.org/jet-main/rev/1a0ec4409e0f
Comment 10 Quality Engineering 2011-10-26 14:27:46 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/1a0ec4409e0f
User: Petr Somol <psomol@netbeans.org>
Log: #201786 - (fix correction) AssertionError at form.layoutsupport.griddesigner.GridDesigner$3.actionPerformed