Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 119335 - java.lang.NullPointerException
Product: guibuilder
Classification: Unclassified
Component: Code
All All
: P2 (vote)
: 6.x
Assigned To: Viktor Lapitski
Depends on:
  Show dependency treegraph
Reported: 2007-10-18 11:28 UTC by solgius
Modified: 2011-10-12 08:19 UTC (History)
5 users (show)

See Also:
Issue Type: TASK

stacktrace (2.72 KB, text/plain)
2007-10-18 11:29 UTC, solgius
stacktrace (2.72 KB, text/plain)
2007-11-30 16:48 UTC, volkram

Note You need to log in before you can comment on or make changes to this bug.
Description solgius 2007-10-18 11:28:57 UTC
Build: NetBeans IDE 6.0 Beta 1 (Build 200709141330)
VM: Java HotSpot(TM) Client VM, 1.6.0_02-b06
OS: Windows XP, 5.1, x86

User Comments:
Comment 1 solgius 2007-10-18 11:29:09 UTC
Created attachment 51204 [details]
Comment 2 Jana Maleckova 2007-10-18 13:06:01 UTC
exception itself doesn't help us to fix bug. Could you provide exact steps how to reproduce it ?

StackTrace for better query:
        at org.netbeans.modules.form.CodeCustomEditor.<init>(
        at org.netbeans.modules.form.RADConnectionPropertyEditor.getCustomEditor(
        at org.netbeans.modules.form.FormCustomEditor.<init>(
        at org.netbeans.modules.form.FormPropertyEditor.getCustomEditor(
Comment 3 Jan Stola 2007-10-18 14:33:50 UTC
The exception is thrown by the following code:
SimpleSection sec = dobj.getFormEditorSupport().getInitComponentSection();
codePos = sec.getText().indexOf(codeSnippet); <- NPE

So, the "initComponentc" guarded block is not found in the .java file. Do you see this guarded block (non-editable area 
around initComponents() method) in the source code? Did you edit this .java file in external editor? Any chance that 
you removed //GEN-BEGIN:initComponents and //GEN-END:initComponents comments using some external (=outside NetBeans) 
Comment 4 Jan Stola 2007-11-16 08:12:29 UTC
I am sorry, I am not able to reproduce this issue => closing as WORKSFORME. Feel free to reopen it if you are still 
able to reproduce it, but provide exact steps to reproduce then.
Comment 5 volkram 2007-11-30 16:47:59 UTC
Build: NetBeans IDE 6.0 RC2 (Build 200711201000)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05
OS: Windows XP, 5.1, x86

User Comments: 
When attempting to change the border style on a jpanel by clicking on the [...] button next to the border property in the properties pane in the Gui designer using a Gridbag.
Comment 6 volkram 2007-11-30 16:48:02 UTC
Created attachment 53728 [details]
Comment 7 Karthikeyan Rajeswaran 2008-02-05 18:43:27 UTC
This issue has also been raised on the nbusers forum:
Comment 8 Karthikeyan Rajeswaran 2008-02-05 21:08:18 UTC
As per :

> I think it happened when Netbeans inserted the UML markers.

Comment 9 billslack 2008-02-05 23:16:49 UTC
When Netbeans added UML Markers to my code, it changed the guarded block.
When I tried to edit my gui, all of the "..." buttons threw an exception. 
When I followed the instructions to report the problem, I was led to this issue stating that it had been fixed and I 
should try updating.
I have the current update but the problem still occurs.
The change to the guarded block is as follows:
     *  This method is called from within the constructor to
     *       initialize the form.
     *       WARNING: Do NOT modify this code. The content of this method is
     *       always regenerated by the Form Editor.
     *       <editor-fold defaultstate="collapsed" desc="Generated Code">GEN-BEGIN:initComponents
    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.6EE9EE88-47E7-0631-86EA-5CD0787277E1]
    // </editor-fold> 
    private void initComponents () {
Comment 10 Karthikeyan Rajeswaran 2008-02-06 00:05:12 UTC
Reopening the issue, since more info has been provided; adding UML markers seems to be one way to reproduce this problem.
Comment 11 Karthikeyan Rajeswaran 2008-02-06 17:35:29 UTC
I have requested the user on nbusers forum to provide us with steps to reproduce this problem. When we do have a
testcase, we should raise the priority to P2 (since this bug leads to mangling of source code) and remove the
'INCOMPLETE' keyword.

In the meantime, form or UML QE may want to try and reproduce the problem. (Right now, it is not clear whether this is a
UML issue, caused only by adding UML markers, or it is an underlying form module issue of which adding UML marker is
just one usecase). 
Comment 12 billslack 2008-02-06 18:32:29 UTC
Here are the steps that created the problem:
In the projects window,selected a UML element of type FrameView; right-clicked and selected Generate Code...;
with all defaults selected (the 'add merge markers to existing elements' was checked), clicked the OK button.
At that point, I only observed the results and then left the project for a few days, so my recollection of the steps 
may be vague. 
Comment 13 Karthikeyan Rajeswaran 2008-02-06 18:42:21 UTC
Raising the priority to P2 , removing the INCOMPLETE keyword and reassigning to uml component.
Comment 14 Viktor Lapitski 2008-02-08 10:00:52 UTC
The problem isn't in markers. During RE the "//" in //GEN-BEGIN:initComponents 
is filtered out. 
Comment 15 Exceptions Reporter 2008-02-16 11:40:17 UTC
Comment 16 Viktor Lapitski 2008-02-20 01:25:19 UTC
Fixed. Corrected removal of "//" in //GEN-BEGIN:initComponents 
and avoid touching the elements that have the Netbeans gen marker in the comments.  

Checking in uml/core/src/org/netbeans/modules/uml/core/reverseengineering/refram
arsingframework/Attic/,v  <--
new revision:; previous revision:
Checking in uml/core/src/org/netbeans/modules/uml/core/reverseengineering/parsin
ties/translation/statehandlers/Attic/,v  <--

new revision:; previous revision:
Checking in uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Elemen;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Attic/Element,v  <--
new revision:; previous revision:
Checking in uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Merger
java,v  <--
new revision:; previous revision:


changeset d432596a24e2 in main
	Fix for 119335 java.lang.NullPointerException
Comment 17 Peter Lam 2008-02-29 20:25:27 UTC
Repro steps that took me to the exception in NB6.0 without the fix to this bug.
- create a Java Application project with defaults
- create a JFrame Form in the javaapplication package with the default form name
- when the Form Design editor opens, click on the Source button above the design window to switch to the source
- reverse engineer from the source editor to a new UML project
- expand nodes in the re'ed UML project to the NewJFrame class node
- right click on the NewJFrame class node and select Generate Code
- from the Generate Code dialog, select the Java Application from the 1st step as the Target Project
- leave all default checks alone
- check the checkbox for "Add Merge Markers to Existing Source Elements"
- click on the OK button to generate code
- now go back to the design editor by clicking on the Design button above the source window to switch to the form design
- click on the frame to select it
- from the properties window for the selected frame, click on any of the "..." buttons 
- now you will notice the flashing red button at the lower-right corner of the ide, click on the flashing red button to
popup the exception dialog

Verified in NB 6.1 M2 latest build netbeans-hudson-trunk-778 (20080229154759). Repeating the same steps above will bring
up the dialog for the corresponding "..." button when clicked w/o exception.
Comment 18 Karthikeyan Rajeswaran 2008-03-08 21:46:54 UTC
The fix has been ported into the release601_fixes branch.

Checking in codegen/src/org/netbeans/modules/uml/codegen/java/merging/;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Attic/,v  <--
new revision:; previous revision: 1.11
Checking in codegen/src/org/netbeans/modules/uml/codegen/java/merging/;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Attic/,v  <--
new revision:; previous revision:
Checking in
new revision:; previous revision: 1.7
Checking in core/src/org/netbeans/modules/uml/core/reverseengineering/reframework/parsingframework/;
new revision:; previous revision: 1.6
Comment 19 Exceptions Reporter 2008-10-16 07:32:07 UTC
Reopening - reproduced in NetBeans IDE 6.1 (Build 200804211638)
Comment 20 Sergey Petrov 2008-10-17 16:55:19 UTC
can't reproduce in 6.1 (and 6.5 also) may not be related to uml module.
can anybody provide steps to reproduce?
Comment 21 Sergey Petrov 2008-10-19 19:09:38 UTC
move back to form module for evaluation
Comment 22 Tomas Pavek 2008-10-24 13:38:23 UTC
Given that we can't reproduce it and there is no report for 6.5, closing as WORKSFORME.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo