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 118562 - java.lang.NullPointerException
Summary: java.lang.NullPointerException
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Natural Layout (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: issues@guibuilder
URL: http://statistics.netbeans.org/except...
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-11 15:41 UTC by marano
Modified: 2009-07-15 14:46 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 7256


Attachments
stacktrace (2.88 KB, text/plain)
2007-10-11 15:41 UTC, marano
Details
stacktrace (2.97 KB, text/plain)
2009-07-15 04:54 UTC, Michel Graciano
Details
Form sample for NPE (2.59 KB, application/x-compressed)
2009-07-15 04:55 UTC, Michel Graciano
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marano 2007-10-11 15:41:54 UTC
Build: NetBeans IDE 6.0 Beta 1 (Build 200709101200)
VM: Java HotSpot(TM) Client VM, 1.6.0-b105
OS: Windows XP, 5.1, x86

User Comments:
Comment 1 marano 2007-10-11 15:41:59 UTC
Created attachment 50696 [details]
stacktrace
Comment 2 Jan Stola 2007-10-11 16:13:43 UTC
I am sorry, it is not possible to track the problem down only from the stack trace of the exception. Could you, please, 
provide more information? It would be ideal to attach the corresponding .form and .java files (saved in the last good 
state) and describe the exact steps that lead to this exception.
Comment 3 Jan Stola 2007-11-16 08:15:50 UTC
No additional information provided => closing as WORKSFORME.
Comment 4 Jan Stola 2007-11-16 08:19:37 UTC
Changing resolution to WORKSFORME.
Comment 5 Exceptions Reporter 2008-10-29 16:15:27 UTC
Reopening - reproduced in NetBeans IDE Dev (Build 200810140201)
http://statistics.netbeans.org/exceptions/detail.do?id=133867
Comment 6 Jana Maleckova 2008-10-30 16:28:01 UTC
StackTrace:
===========
java.lang.NullPointerException
        at org.netbeans.modules.form.layoutdesign.LayoutModel.removeInterval(LayoutModel.java:301)
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner.intervalRemoved(LayoutDesigner.java:3736)
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner.layoutChanged(LayoutDesigner.java:2184)
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner.access$100(LayoutDesigner.java:35)
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner$Listener.layoutChanged(LayoutDesigner.java:2150)
Comment 7 Peter Pis 2008-12-02 12:16:37 UTC
Any steps to reproduce?
Comment 8 pribyl 2009-02-10 14:47:12 UTC
No additional info provided since the last reopening -> closing again as worksforme
Comment 9 pribyl 2009-02-10 14:52:32 UTC
Sorry, I accidentally set this to FIXED. Reopening ... 
Comment 10 pribyl 2009-02-10 14:53:22 UTC
... and setting the resolution to: WORKSFORME
Comment 11 sandi_ro 2009-04-15 11:43:48 UTC
Hi,

I encountered this on NB 6.5 with latest updates as of date of filling this comment.
The root cause is some bad xml from the xxx.form file (note duplicated elements):
i.e:

------------- sample from the file when this ocurs ----
              <Group type="103" groupAlignment="0" attributes="0">
                  <Component id="jButtonRecordClippp" max="32767" attributes="1"/>
                  <Component id="jButtonRecordClippp" max="32767" attributes="1"/>
              </Group>
------------------------

I have no idea how this gets into the xxx.form , maybe some bugs in code that syncs the xml . 
As I can remember I was trying to move the button in a jpannel when the problem started to show up.

Thanks. 
Andrei.

Comment 12 sandi_ro 2009-04-15 11:47:38 UTC
Hi ,

Please note that fixing content of xml in xxx.form makes this exception not showing again. I actually edited the content
of form file with an external editor and removed the duplicate element, reopened the form in netbeans and all works again.

Thanks.
Comment 13 Jan Stola 2009-04-15 13:26:38 UTC
Please, let us know if you find a reproducible test case showing how the duplicate elements can be created.
Comment 14 sandi_ro 2009-04-15 16:21:34 UTC
Hi, 

I have submitted before my initial comments on this issue some usage data , not sure if they helps but www.netbeans.org
pointed to this issue as fix for the usage data . 

Meanwhile I will keep my eyes open to identify a test case.

Thanks, Andrei.
Comment 15 sandi_ro 2009-05-25 11:28:06 UTC
Hi , 

I think one shall look into the code that ads components into a group so that there are no duplicate items in that group
and put there a stack trace so that the problem can be further traced . 
It seems to randomly occur but all the cases I encountered until now leads to bad xml code with duplicate items ,
therefore stacktracing when this duplicate items ocurs may add more details for the problem.


Hope this helps.
Thanks,
Andrei
Comment 16 Michel Graciano 2009-07-15 04:53:55 UTC
Build: NetBeans IDE 6.7 (Build 200906241340)
VM: Java HotSpot(TM) Client VM, 14.0-b16, Java(TM) SE Runtime Environment, 1.6.0_14-b08
OS: Linux, 2.6.27-14-generic, i386

User Comments: 
Moving 'dataDesembaraco6' for any place at form. I will attach the sample soon.

Stacktrace: 
java.lang.NullPointerException<br/>
        at org.netbeans.modules.form.layoutdesign.LayoutModel.removeInterval(LayoutModel.java:334)<br/>
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner.intervalRemoved(LayoutDesigner.java:3884)<br/>
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner.layoutChanged(LayoutDesigner.java:2283)<br/>
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner.access$100(LayoutDesigner.java:58)<br/>
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner$Listener.layoutChanged(LayoutDesigner.java:2249)<br/>
        at org.netbeans.modules.form.layoutdesign.LayoutModel.fireEvent(LayoutModel.java:805)<br/>
Comment 17 Michel Graciano 2009-07-15 04:54:01 UTC
Created attachment 84751 [details]
stacktrace
Comment 18 Exceptions Reporter 2009-07-15 04:54:07 UTC
This issue already has 50 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=7256
Comment 19 Michel Graciano 2009-07-15 04:55:33 UTC
Created attachment 84752 [details]
Form sample for NPE
Comment 20 sandi_ro 2009-07-15 10:28:49 UTC
The recent added attachments reveals same problem as I saw : bad  xml in form that triggers it:

  <Group type="103" groupAlignment="0" attributes="0">
        <Component id="dataDesembaraco6" alignment="0" min="-2" max="-2" attributes="0"/>
        <Component id="dataDesembaraco6" alignment="0" min="-2" max="-2" attributes="0"/>
  </Group>

Netbeans please add stack trace when duplicates occurs, so that we can easy find the steps to reproduce. 

Thanks.

P.S:
It looks this floats around from 6.0 ? !!! So it is a tough one !
Comment 21 Jan Stola 2009-07-15 11:10:17 UTC
Thanks to sandi_ro for evaluation and to hmichel for a test-case.

I have added a check for a duplicate insertion of the same component
into one layout interval. IllegalArgumentException is thrown when
this happens. This should allow us to track the original defect.
The annoying side effect of this change is that forms that already
contain the duplicate components cannot by opened - the mentioned
IllegalArgumentException is throw when you attempt to open them.

The workaround is either to remove the duplicate definition
from the .form file manually (as sandi_ro suggested) or
to start NetBeans with netbeans.ignore.issue118562 system
property set to anything non-null. This will force
the insertion code to ignore the duplicit component
and continue without exception being thrown.

I am closing this issue as fixed because it is about an exception that
is a consequence of the original problem. The original problem will
appear in the issue/exception database under a different stack trace.

Feel free to reopen this issue if you find a different
cause of this exception.

Modified file: http://hg.netbeans.org/cdev/rev/415cbabaebb5
Comment 22 sandi_ro 2009-07-15 11:33:53 UTC
Thank you for adding code to throw exception .
Comment 23 Michel Graciano 2009-07-15 14:30:19 UTC
Could you please try to insert into exception the component name? It should make easier to find the problematic
component when opening an "old" form. Something like 'Cannot add a component 'XYZ' into a group twice!'

Thanks.
Comment 24 Jan Stola 2009-07-15 14:46:23 UTC
> Could you please try to insert into exception the component name?

I was considering that, but I cannot do that unfortunately. The corresponding code identifies the component by some 
internal ID and the mapping between the IDs and component names is not accessible at that place.