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 189837 - NullPointerException at org.netbeans.modules.form.FormDesigner.isInDesigner
Summary: NullPointerException at org.netbeans.modules.form.FormDesigner.isInDesigner
Status: VERIFIED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
: 190944 193784 197001 216616 (view as bug list)
Depends on:
Blocks: 136425
  Show dependency tree
 
Reported: 2010-08-25 11:53 UTC by Jesse Glick
Modified: 2012-08-22 16:58 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 80546


Attachments
stacktrace (6.37 KB, text/plain)
2010-08-25 11:53 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2010-08-25 11:53:48 UTC
Build: NetBeans IDE Dev (Build 100825-17b3cdd7aa68)
VM: Java HotSpot(TM) Client VM, 17.0-b16, Java(TM) SE Runtime Environment, 1.6.0_21-b06
OS: Linux

User Comments:
GUEST: using swing and trying to add swing containers

jglick: Trying to fix up a form. Could not convince Matisse to put anything where I wanted it. Moved all components out into central area of form and tried to reposition everything. Failed. Closed form, reopened it; now trying to right-click on the form node in Inspector gives this NPE. Have to just discard all changes and give up or switch to GridBagLayout I guess.

bartvdc: open frame




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.form.FormDesigner.isInDesigner(FormDesigner.java:542)
   at org.netbeans.modules.form.FormUtils.isVisualInDesigner(FormUtils.java:1547)
   at org.netbeans.modules.form.actions.DefaultSizeAction.getValidComponent(DefaultSizeAction.java:144)
   at org.netbeans.modules.form.actions.DefaultSizeAction.enable(DefaultSizeAction.java:64)
   at org.openide.util.actions.NodeAction$DelegateAction.resultChanged(NodeAction.java:615)
   at sun.reflect.GeneratedMethodAccessor25.invoke(GeneratedMethodAccessor25.java:0)
Comment 1 Jesse Glick 2010-08-25 11:53:52 UTC
Created attachment 101656 [details]
stacktrace
Comment 2 Tomas Pavek 2011-02-02 13:35:25 UTC
*** Bug 190944 has been marked as a duplicate of this bug. ***
Comment 3 Tomas Pavek 2011-02-02 14:31:20 UTC
*** Bug 193784 has been marked as a duplicate of this bug. ***
Comment 4 Tomas Pavek 2011-02-21 16:29:07 UTC
Steps to reproduce:
* Have two GUI forms, start IDE where none is opened.
* Open the first form, then second. Note that Inspector still shows the first one (bug 195491).
* Do not touch anything and close the second form (by x button). Then close the first form as well.
* Open the first form again. Note that Inspector shows content of the second form (that should now be closed).
* Try to right click e.g. on JFrame node in the Inspector, or close the form -> NPE.

The problem is that after opening a form it is not properly "activated", i.e. connected with Inspector and given some selected node. (It works for the first form due to a specific workaround of another problem). Such inactivated form is then not properly closed - the designer is cleaned, but the form stays registered as opened. This causes various problems later.

The cause is the separation of form loading into several phases when componentActivated originally called at the end is now called too early.

http://hg.netbeans.org/core-main/rev/9bbf1d157bba
Comment 5 Quality Engineering 2011-02-23 05:28:31 UTC
Integrated into 'main-golden', will be available in build *201102230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/9bbf1d157bba
User: Tomas Pavek <tpavek@netbeans.org>
Log: #189837, 195491: componentActivated() called two early in the two-phase opening, so make sure the form is correctly activated (selected) later
Comment 6 Tomas Pavek 2011-03-23 12:15:00 UTC
*** Bug 197001 has been marked as a duplicate of this bug. ***
Comment 7 Tomas Pavek 2012-08-22 16:58:05 UTC
*** Bug 216616 has been marked as a duplicate of this bug. ***