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 115431 - java.lang.NullPointerException
Summary: java.lang.NullPointerException
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@guibuilder
URL: http://statistics.netbeans.org/except...
Keywords: RANDOM
Depends on:
Blocks:
 
Reported: 2007-09-13 12:06 UTC by Michal Zlamal
Modified: 2007-09-18 15:21 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 3739


Attachments
stacktrace (2.58 KB, text/plain)
2007-09-13 12:06 UTC, Michal Zlamal
Details
Messages.log (523.61 KB, text/plain)
2007-09-13 18:08 UTC, Michal Zlamal
Details
Messages log from IDE (66.40 KB, text/plain)
2007-09-18 08:20 UTC, Michal Zlamal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Zlamal 2007-09-13 12:06:25 UTC
Build: NetBeans IDE 6.0 Beta 1 (Build 200709070000)
VM: Java HotSpot(TM) Client VM, 1.5.0_12-b04
OS: Linux, 2.6.21-suspend2-r4, i386

User Comments: 
While using java.awt.Frame form designer I added a java.awt.Panel and tried to set its layout to the BorderLayout.
Comment 1 Michal Zlamal 2007-09-13 12:06:33 UTC
Created attachment 48735 [details]
stacktrace
Comment 2 Jana Maleckova 2007-09-13 12:25:28 UTC
tested on build 070913 and it doesn't happened
Can you reproduce this issue? For this time I assign keyword RANDOM for this bug..
Comment 3 Michal Zlamal 2007-09-13 12:59:21 UTC
It happened to me once, after reporting and restart of IDE I tried to do it once more and it was OK then.
Comment 4 Tomas Pavek 2007-09-13 17:43:50 UTC
Wasn't there an exception before this one? Just after adding the panel? Don't you have it still in the log by chance?
Comment 5 Michal Zlamal 2007-09-13 18:08:57 UTC
Created attachment 48763 [details]
Messages.log
Comment 6 Michal Zlamal 2007-09-13 18:09:50 UTC
Tomasi, I've attached the messages log I've found, hopefully it the correct one.
Comment 7 Tomas Pavek 2007-09-14 16:40:31 UTC
The following exception seems to be the culprit:

java.lang.NullPointerException
	at sun.awt.X11.XWindow.getParentWindow(XWindow.java:221)
	at sun.awt.X11.XWindow.<init>(XWindow.java:110)
	at sun.awt.X11.XComponentPeer.<init>(XComponentPeer.java:148)
	at sun.awt.X11.XLabelPeer.<init>(XLabelPeer.java:45)
	at sun.awt.X11.XToolkit.createLabel(XToolkit.java:623)
	at java.awt.Label.addNotify(Label.java:171)
	at java.awt.Container.addImpl(Container.java:1052)
	at java.awt.Container.add(Container.java:390)
	at org.netbeans.modules.form.layoutsupport.AbstractLayoutSupport.addComponentsToContainer(AbstractLayoutSupport.java:568)
	at org.netbeans.modules.form.layoutsupport.LayoutSupportManager.fillLayout(LayoutSupportManager.java:373)
	at org.netbeans.modules.form.layoutsupport.LayoutSupportManager.setLayoutDelegate(LayoutSupportManager.java:204)
	at org.netbeans.modules.form.RADVisualContainer.setLayoutSupportDelegate(RADVisualContainer.java:88)
	at org.netbeans.modules.form.FormModel.setContainerLayoutImpl(FormModel.java:426)
	at org.netbeans.modules.form.FormModel.setContainerLayout(FormModel.java:436)
[catch] at org.netbeans.modules.form.MetaComponentCreator.setContainerLayout(MetaComponentCreator.java:948)
	at org.netbeans.modules.form.MetaComponentCreator.createAndAddComponent2(MetaComponentCreator.java:326)
	at org.netbeans.modules.form.MetaComponentCreator.access$300(MetaComponentCreator.java:62)
	at org.netbeans.modules.form.MetaComponentCreator$3.run(MetaComponentCreator.java:306)
	at org.netbeans.modules.form.FormLAF$2.run(FormLAF.java:210)
	at org.openide.util.Mutex.doEventAccess(Mutex.java:1201)
	at org.openide.util.Mutex.readAccess(Mutex.java:262)
	at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:195)
	at org.netbeans.modules.form.MetaComponentCreator.createAndAddComponent(MetaComponentCreator.java:303)
	at org.netbeans.modules.form.MetaComponentCreator.createComponent(MetaComponentCreator.java:96)
	at org.netbeans.modules.form.actions.SelectLayoutAction$LayoutActionListener.actionPerformed(SelectLayoutAction.java:216)
...
Failed to initialize layout java.awt.FlowLayout.
The layout cannot be set.SEVERE [global]

This means there was a failure setting FlowLayout to a container that already contained java.awt.Label. Before that the
container must have "Free Design" set - the failure returned the original layout delegate which was null - and this null
caused all the other exceptions.

Looks like some problem with replacing the native peers in AWT components, but probably hard to fix if not able to
reproduce. Also might be Linux specific.
Comment 8 Tomas Pavek 2007-09-17 11:25:23 UTC
Tried to reproduce various possible scenarios on XP and Linux - with no luck. If we find steps to reproduce we'll fix in
the future. Given the sporadic occurrence and that it only with AWT, I'm lowering the priority.
Comment 9 Michal Zlamal 2007-09-18 08:20:29 UTC
Created attachment 48959 [details]
Messages log from IDE
Comment 10 Michal Zlamal 2007-09-18 08:23:49 UTC
It happened to me once more and caused a data loss, because I wasn't able to save the changes I did. So think that the
priority is P2.
I've attached the messages log from IDE from last occurrence.
BTW: the AWT is required while you like to create an application for mobile devices, so it is used often.
Comment 11 Tomas Pavek 2007-09-18 15:21:06 UTC
I've made a fix which should try to recover from the first exception not to cause the later problems. Still don't know
how the original exception could happen - tried another fix here, but not sure if it helps. We'll see.

/cvs/form/src/org/netbeans/modules/form/FormModel.java
new revision: 1.79; previous revision: 1.78
/cvs/form/src/org/netbeans/modules/form/layoutsupport/LayoutSupportManager.java
new revision: 1.42; previous revision: 1.41