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 119335

Summary: java.lang.NullPointerException
Product: guibuilder Reporter: solgius <solgius>
Component: CodeAssignee: Viktor Lapitski <lvv>
Status: RESOLVED WORKSFORME    
Severity: blocker CC: amurati, gvasick, issues, krajeswaran, sustaining
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=2348
Issue Type: TASK Exception Reporter: 2348
Attachments: stacktrace
stacktrace

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]
stacktrace
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:
===========
java.lang.NullPointerException
        at org.netbeans.modules.form.CodeCustomEditor.<init>(CodeCustomEditor.java:95)
        at org.netbeans.modules.form.RADConnectionPropertyEditor.getCustomEditor(RADConnectionPropertyEditor.java:143)
        at org.netbeans.modules.form.FormCustomEditor.<init>(FormCustomEditor.java:151)
        at org.netbeans.modules.form.FormPropertyEditor.getCustomEditor(FormPropertyEditor.java:270)
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) 
tool?
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]
stacktrace
Comment 7 Karthikeyan Rajeswaran 2008-02-05 18:43:27 UTC
This issue has also been raised on the nbusers forum:
http://www.nabble.com/Problem-with-the-%27more%27-buttons-on-the-properties-sheet-after-adding-UML-markers-td15248390.html
Comment 8 Karthikeyan Rajeswaran 2008-02-05 21:08:18 UTC
As per
http://www.nabble.com/Problem-with-the-%27more%27-buttons-on-the-properties-sheet-after-adding-UML-markers-td15248390.html :

> 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
THIS ISSUE HAS ALREADY 20 DUPLICATES
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
ework/parsingframework/CommentGather.java;
/cvs/uml/core/src/org/netbeans/modules/uml/core/reverseengineering/reframework/p
arsingframework/Attic/CommentGather.java,v  <--  CommentGather.java
new revision: 1.2.6.4; previous revision: 1.2.6.3
done
Checking in uml/core/src/org/netbeans/modules/uml/core/reverseengineering/parsin
gfacilities/translation/statehandlers/StateHandler.java;
/cvs/uml/core/src/org/netbeans/modules/uml/core/reverseengineering/parsingfacili
ties/translation/statehandlers/Attic/StateHandler.java,v  <--  StateHandler.java

new revision: 1.2.6.3; previous revision: 1.2.6.2
done
Checking in uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Elemen
tMatcher.java;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Attic/Element
Matcher.java,v  <--  ElementMatcher.java
new revision: 1.1.2.4; previous revision: 1.1.2.3
done
Checking in uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Merger
.java;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Attic/Merger.
java,v  <--  Merger.java
new revision: 1.1.2.6; previous revision: 1.1.2.5


and

changeset d432596a24e2 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=d432596a24e2
description:
	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
editor
- 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/ElementMatcher.java;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Attic/ElementMatcher.java,v  <--  ElementMatcher.java
new revision: 1.11.8.1; previous revision: 1.11
done
Checking in codegen/src/org/netbeans/modules/uml/codegen/java/merging/Merger.java;
/cvs/uml/codegen/src/org/netbeans/modules/uml/codegen/java/merging/Attic/Merger.java,v  <--  Merger.java
new revision: 1.19.8.2; previous revision: 1.19.8.1
done
Checking in
core/src/org/netbeans/modules/uml/core/reverseengineering/parsingfacilities/translation/statehandlers/StateHandler.java;
/cvs/uml/core/src/org/netbeans/modules/uml/core/reverseengineering/parsingfacilities/translation/statehandlers/Attic/StateHandler.java,v
 <--  StateHandler.java
new revision: 1.7.8.1; previous revision: 1.7
done
Checking in core/src/org/netbeans/modules/uml/core/reverseengineering/reframework/parsingframework/CommentGather.java;
/cvs/uml/core/src/org/netbeans/modules/uml/core/reverseengineering/reframework/parsingframework/Attic/CommentGather.java,v
 <--  CommentGather.java
new revision: 1.6.6.1; previous revision: 1.6
done
Comment 19 Exceptions Reporter 2008-10-16 07:32:07 UTC
Reopening - reproduced in NetBeans IDE 6.1 (Build 200804211638)
http://statistics.netbeans.org/exceptions/detail.do?id=128667
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.