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 149798 - [65cat] NullPointerException at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.updateCreatedFolder
Summary: [65cat] NullPointerException at org.netbeans.modules.project.ui.SimpleTargetC...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Projects UI (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: rbalada
URL: http://statistics.netbeans.org/except...
Keywords:
: 149797 158409 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-10 18:38 UTC by rajivderas
Modified: 2009-03-16 16:31 UTC (History)
24 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 121054


Attachments
stacktrace (4.60 KB, text/plain)
2008-10-10 18:38 UTC, rajivderas
Details
stacktrace (4.60 KB, text/plain)
2008-10-10 18:45 UTC, rajivderas
Details
stacktrace (7.84 KB, text/plain)
2008-10-17 02:57 UTC, sunbiz
Details
stacktrace (4.34 KB, text/plain)
2008-10-17 09:51 UTC, cadorca
Details
stacktrace (4.60 KB, text/plain)
2008-12-08 15:09 UTC, pbelbin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rajivderas 2008-10-10 18:38:16 UTC
Build: NetBeans IDE Dev (Build 200810100201)
VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b21
OS: Windows XP, 5.1, x86

User Comments:
GUEST: Right click on a folder in the "Files" window, then "Create New PHP File" and then I got the exception.



Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.updateCreatedFolder(SimpleTargetChooserPanelGUI.java:407)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.actionPerformed(SimpleTargetChooserPanelGUI.java:443)
        at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1240)
        at javax.swing.JComboBox.setSelectedItem(JComboBox.java:567)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.initValues(SimpleTargetChooserPanelGUI.java:136)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanel.readSettings(SimpleTargetChooserPanel.java:147)
Comment 1 rajivderas 2008-10-10 18:38:20 UTC
Created attachment 71579 [details]
stacktrace
Comment 2 rajivderas 2008-10-10 18:45:18 UTC
Build: NetBeans IDE Dev (Build 200810100201)
VM: Java HotSpot(TM) Client VM, 11.0-b11, Java(TM) SE Runtime Environment, 1.6.0_10-beta-b21
OS: Windows XP, 5.1, x86

User Comments: 
Steps to reproduce:
1) Create EJB Module project
2) Goto source packages folder and right click and select properties(NOT project proprties)
3) In the Source packages properties windows change the name field from java to some other name like 1
4) Then add a new WS to this projet

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.updateCreatedFolder(SimpleTargetChooserPanelGUI.java:407)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.actionPerformed(SimpleTargetChooserPanelGUI.java:443)
        at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1240)
        at javax.swing.JComboBox.setSelectedItem(JComboBox.java:567)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.initValues(SimpleTargetChooserPanelGUI.java:136)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanel.readSettings(SimpleTargetChooserPanel.java:147)
Comment 3 rajivderas 2008-10-10 18:45:28 UTC
Created attachment 71580 [details]
stacktrace
Comment 4 Milan Kubec 2008-10-10 20:10:43 UTC
*** Issue 149797 has been marked as a duplicate of this issue. ***
Comment 5 Exceptions Reporter 2008-10-15 15:25:47 UTC
This issue has already 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=121054
Comment 6 sunbiz 2008-10-17 02:57:34 UTC
Build: NetBeans IDE Dev (Build 200810140201)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc2-b32
OS: Windows Vista, 6.0, x86

User Comments: 
Clicked on new file -> New Webservice from WSDL and got this exception

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.updateCreatedFolder(SimpleTargetChooserPanelGUI.java:407)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.actionPerformed(SimpleTargetChooserPanelGUI.java:443)
        at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1240)
        at javax.swing.JComboBox.setSelectedItem(JComboBox.java:567)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.initValues(SimpleTargetChooserPanelGUI.java:136)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanel.readSettings(SimpleTargetChooserPanel.java:147)
Comment 7 sunbiz 2008-10-17 02:57:38 UTC
Created attachment 72077 [details]
stacktrace
Comment 8 cadorca 2008-10-17 09:51:49 UTC
Build: NetBeans IDE Dev (Build 200810161401)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc2-b32
OS: Linux, 2.6.24-21-generic, i386

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.updateCreatedFolder(SimpleTargetChooserPanelGUI.java:407)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.actionPerformed(SimpleTargetChooserPanelGUI.java:443)
        at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1240)
        at javax.swing.JComboBox.setSelectedItem(JComboBox.java:567)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.initValues(SimpleTargetChooserPanelGUI.java:136)
        at org.netbeans.modules.project.ui.SimpleTargetChooserPanel.readSettings(SimpleTargetChooserPanel.java:147)
Comment 9 cadorca 2008-10-17 09:51:52 UTC
Created attachment 72093 [details]
stacktrace
Comment 10 Exceptions Reporter 2008-10-29 22:58:17 UTC
This issue has already 10 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=121054
Comment 11 pbelbin 2008-12-08 15:09:00 UTC
Created attachment 74696 [details]
stacktrace
Comment 12 Milan Kubec 2009-02-12 08:04:23 UTC
*** Issue 158409 has been marked as a duplicate of this issue. ***
Comment 13 Milan Kubec 2009-02-12 09:24:26 UTC
Fixed: http://hg.netbeans.org/main/rev/eb56cc65aab7
Comment 14 rbalada 2009-02-12 16:04:16 UTC
I've enhanced the fix with secondary check for null directly in place where the NPE was throwing. Based on discussion
with mkubec this secondary fix is not that much necessary, but it should go to a patch in which higher assurance that
the NPE does not throw again is better. Especially in this case where we are not able to reproduce the bug.

http://hg.netbeans.org/main/rev/ced42c07a494
Comment 15 Jesse Glick 2009-02-12 16:19:13 UTC
"if (root == null) return;" should be deleted or replaced with an assertion "assert root != null : sg;", since it is
illegal for a SourceGroup to ever return null from this method.
Comment 16 sunbiz 2009-02-16 12:12:37 UTC
Yes, seems to have been fixed in build 200902121452.
Comment 17 Quality Engineering 2009-02-18 10:41:55 UTC
Integrated into 'main-golden', will be available in build *200902180201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/ced42c07a494
User: Rudolf Balada <rbalada@netbeans.org>
Log: #149798: [65cat] NullPointerException at org.netbeans.modules.project.ui.SimpleTargetChooserPanelGUI.updateCreatedFolder
Comment 18 vincewebb 2009-02-18 18:17:02 UTC
Does this mean the fix will be deployed via on-line updates in the next few days ? (Help -> Check for Updates) 
Comment 19 Michel Graciano 2009-02-18 18:30:14 UTC
I marked it as patch 3 candidate. QE will evaluate if it is possible, but the patch seems to be easily backported.

Regards
Comment 20 Milan Kubec 2009-02-25 09:22:46 UTC
Fixed in release65_fixes: http://hg.netbeans.org/release65_fixes/rev/3bac919fd9d7
Comment 21 rbalada 2009-02-27 11:26:29 UTC
Reopening.

The bugfix fixes a result, not it cause.

The root cause seems to be "strange" project configuration. I was able to reproduce this issue even with this fix.

The steps to reproduce are:

#1 install NetBeans 6.5 (full, or at least with java web support)
#2 create new web application project (you can use defaults offered)
#3 right-click on project node and select "Properties" from the context menu
#4 remove all source directories listed and click OK
#5 right-click on project node and create New Webservice

And the exception is thrown, red icon blinking in bottom right corner of your IDE. It may but must not behave
differently if you remove also test directories.

Suggested workaround:
Try to keep one source root and one test source root.
For creating a project with existing source if it does not work for you, create new empty web application project and
reconfigure source roots.
Comment 22 rbalada 2009-02-27 11:31:59 UTC
The fix actually has to happen in web module, in a class (Sources.java) which is responsible for recognizing source root
from test source root.

This issue could be in very wild and happening also for other project types as that routine for recognizing source root
from test source root was copy&pasted in several projects and that routine does not work well for project configurations
which deviate from "one source root and one test source root" configuration. IMHO it uses strange logic/assumption
covering just major cases and leaving corner cases in jeopardy.
Comment 23 vincewebb 2009-02-27 11:40:39 UTC
The "strange" project configuration that you describe is perhaps no that unusual.

In my older NetBeans projects java source files are located at:
<project directory>/src
The directory which is now favoured for java source
<project directory>/src/java
does not exist

Is this the root cause of the problem ?
Comment 24 rbalada 2009-02-27 11:53:03 UTC
Very likely. 

Because the NPE was thrown when attempting to retype result of SourceGroup.getRootFolder() method to FileObject
instance. When the directory does not exist on filesystem, its FileObject instance in NetBeans for it cannot exist as well.

I found that when trying to reproduce the issue and tracking the project behavior during resolution of the escalation
with Sun Support Services.

I'm still working on the fix, but at least we have got workaround.
Comment 25 Filip Zamboj 2009-02-27 12:03:48 UTC
The last comment from rbalada was reproduced in Product Version: NetBeans IDE 6.5.1 (Build 200902270001). 

@mkubec, how does it look like with this issue? Are you going to do something about this for 6.5.1? There is a
workaround so not a stopper for 6.5.1 but I can't verify in this state. 

Thanks. 
Comment 26 rbalada 2009-02-27 12:25:12 UTC
fzamboj,

reassigning to me as I tracked the issue to root cause. Unfortunately it may require changes in multiple projects. Also
the fix may require "hacking" as there's no explicit marking which source group is "simple" source group or "test"
source group (or other kind of source group).

I'm considering to check SourceGroup.<something>.Name starts with "${src." or "${test.", but it's ehm bit ugly and may
not work for all project types existing now or in future. But this may help in 6.5 context.
Comment 27 Filip Zamboj 2009-02-27 15:34:52 UTC
OK. So does that mean it is not safe to backport to 6.5.1 and we leave this issue to 67M3? In my opinion this a P3,
partially fixed so it shouldn't harm in 6.5.1 as it is now and you can come up with a good (and tested) solution for M3.
Would that be ok? 

Thanks. 
Comment 28 Filip Zamboj 2009-03-05 15:23:46 UTC
verified. This bug was partially fixed and there is workaround for it. However, there is a bug reported by rbalada. So
closing this one and opening another based on rbalada report.