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 203394 - Incorrect calculation of a gap size resulting in an invalid code generated
Summary: Incorrect calculation of a gap size resulting in an invalid code generated
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Natural Layout (show other bugs)
Version: 7.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-09 13:11 UTC by Jan Stola
Modified: 2011-10-11 14:14 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project demonstrating the problem (25.06 KB, application/x-zip-compressed)
2011-10-09 13:11 UTC, Jan Stola
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Stola 2011-10-09 13:11:06 UTC
Created attachment 111731 [details]
Project demonstrating the problem

This issue is inspired by the first test-case in issue 203129.

Steps to reproduce:
1. Open the attached project.
2. Open NewJFrame.java in Design mode.
3. Move jButton3 to the left such that it snaps at the small
   preferred gap next to jButton2.
   => notice that there is no gap in the resulting layout.
4. Select jButton2 and invoke Space Around Component ...
   => the dialog shows that the size of the right gap is negative
   (-219 in my case).
5. Cancel/close the Space Around Component dialog.
6. Execute the form.
   => the following exception is thrown

java.lang.IllegalArgumentException: Invalid size
  at javax.swing.GroupLayout.checkResizeType(GroupLayout.java:337)
  at javax.swing.GroupLayout.checkSize(GroupLayout.java:322)
  at javax.swing.GroupLayout.access$500(GroupLayout.java:191)
  at javax.swing.GroupLayout$GapSpring.<init>(GroupLayout.java:3088)
  at javax.swing.GroupLayout$Group.addGap(GroupLayout.java:1516)
  at javax.swing.GroupLayout$SequentialGroup.addGap(GroupLayout.java:1810)
  at javaapplication52.NewJFrame.initComponents(NewJFrame.java:72)
  at javaapplication52.NewJFrame.<init>(NewJFrame.java:18)
  at javaapplication52.NewJFrame$3.run(NewJFrame.java:181)
  ...

The exception is caused by 
.addGap(GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
call that corresponds to the mentioned negative gap.

GroupLayout.DEFAULT_SIZE is not allowed as a minimum size of a gap.
Comment 1 Tomas Pavek 2011-10-10 14:30:54 UTC
http://hg.netbeans.org/jet-main/rev/89a044270c75
Comment 2 Quality Engineering 2011-10-11 14:14:07 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/89a044270c75
User: Tomas Pavek <tpavek@netbeans.org>
Log: #203394: component behind a border gap can be in subgroup (was skipped)