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 217213

Summary: NullPointerException at org.netbeans.modules.web.jsf.editor.JsfSupportImpl.<init>
Product: javaee Reporter: FrantaM
Component: JSF EditorAssignee: Marek Fukala <mfukala>
Status: VERIFIED FIXED    
Severity: normal CC: aldobrucale, alesak, berryware, dkonecny, exceptions_reporter, lallafa, marfous, masoodfaisal, mmirilovic, myshkin, pjiricka, ptomasek, sdlarsen, theshowmecanuck, tomaszk, tzezula, vriha, waldheinz, wissenstein, zdenek.rod
Priority: P1    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 191388
Attachments: stacktrace
stacktrace
stacktrace
stacktrace
stacktrace

Description FrantaM 2012-08-22 10:30:03 UTC
Build: NetBeans IDE Dev (Build 201208220001)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.1-b03, Java(TM) SE Runtime Environment, 1.7.0_05-b05
OS: Linux

User Comments:
GUEST: installed nightly 
(imported settings from existing 7.2 installation)
just started netbeans with some maven projects wich were in the old workspace




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.web.jsf.editor.JsfSupportImpl.<init>(JsfSupportImpl.java:155)
   at org.netbeans.modules.web.jsf.editor.JsfSupportImpl.findForProject(JsfSupportImpl.java:106)
   at org.netbeans.modules.web.jsf.editor.JsfSupportProviderImpl.getSupport(JsfSupportProviderImpl.java:59)
   at org.netbeans.modules.web.jsfapi.spi.JsfSupportProvider.get(JsfSupportProvider.java:105)
   at org.netbeans.modules.web.jsfapi.spi.JsfSupportProvider.get(JsfSupportProvider.java:85)
   at org.netbeans.modules.web.jsf.editor.JsfPageMetadataProvider.getMetadataMap(JsfPageMetadataProvider.java:78)
Comment 1 FrantaM 2012-08-22 10:30:09 UTC
Created attachment 123392 [details]
stacktrace
Comment 2 Tomas Zezula 2012-09-04 15:08:55 UTC
Reproduceable in 7.2 patch 1 candidate.
Comment 3 aldobrucale 2012-09-28 08:59:14 UTC
Created attachment 125058 [details]
stacktrace

starting netbeans
Comment 4 aldobrucale 2012-10-03 09:38:13 UTC
Created attachment 125282 [details]
stacktrace

starting netbeans
Comment 5 Petr Jiricka 2012-10-03 16:27:29 UTC
This is marked as a patch candidate. Marek/Martin, is this really just P3? How important is it to fix for 7.2.1 (aka patch2)?
Comment 6 Martin Fousek 2012-10-04 06:17:14 UTC
Created attachment 125345 [details]
stacktrace
Comment 7 Martin Fousek 2012-10-04 06:30:53 UTC
(In reply to comment #5)
> This is marked as a patch candidate. Marek/Martin, is this really just P3? How
> important is it to fix for 7.2.1 (aka patch2)?

At least P2 make sense to me since there are more then 40 reports. Happens in cases of no (null) compile classpath of the webproject, I browse sources a little bit and was able to reproduce it:
1, create new web application
2, remove web directory
3, create XHTML page in SRC directory
4, restart IDE and invoke CC inside #{} of the facelet
-> this NPE appears
Comment 8 Marek Fukala 2012-10-04 06:55:22 UTC
> At least P2 make sense to me since there are more then 40 reports. Happens in
> cases of no (null) compile classpath of the webproject, I browse sources a
> little bit and was able to reproduce it:
> 1, create new web application
> 2, remove web directory
> 3, create XHTML page in SRC directory
> 4, restart IDE and invoke CC inside #{} of the facelet
> -> this NPE appears

What does this mean? Creating an invalid project will cause a NPE? Just this one?

I would ask what is the project which have java sources but have no compile classpath. Is this normal?
Comment 9 Martin Fousek 2012-10-04 07:24:58 UTC
(In reply to comment #8)
> What does this mean? Creating an invalid project will cause a NPE? Just this
> one?

Marku, I really don't know! I attached steps I figured out if you would be interested in reproducing that but I can't tell you that there is no other way how the get it.

> I would ask what is the project which have java sources but have no compile
> classpath. Is this normal?

No, it doesn't look to me normal at all as well, but the count of reported cases speak about something different. So there must exist another way for reproducing or described steps can be in some cases valid? Probably David could know more?
Comment 10 Marek Fukala 2012-10-04 07:26:05 UTC
Martine, you are right the other branch cannot cause the NPE - it must be a the first one - a project with WebModule which have somehow broken the classpath. 

I can simply fix that by returning no JsfSupport for such project, but question is if all the duplicates are for broken web project or there is (more likely) a bug in the web project classpath provider.
Comment 11 masoodfaisal 2012-10-05 04:17:13 UTC
Created attachment 125423 [details]
stacktrace

opening a nomral complexit mvn project with submodules (around 15 hierarchical)
Comment 12 Exceptions Reporter 2012-10-05 04:17:21 UTC
This bug already has 50 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=191388
Comment 13 wissenstein 2012-10-05 06:18:48 UTC
By the way, JSF is not used in any module of my project.
Comment 14 Martin Fousek 2012-10-05 06:53:11 UTC
Would be anybody able to send us link to repo or project where is able to reproduce this issue? You could send it also "offline" to <login>[at]netbeans.org. We could try out discover where is the base cause of this issue.
Comment 15 wissenstein 2012-10-07 16:52:01 UTC
Unfortunately, I am not allowed to provide the link to the same project, which I am wokring on. When I encounter this problem working on my own project, I'll publish the link to its repository.
Comment 16 wissenstein 2012-10-07 17:02:43 UTC
Today I tried to open that project under 32-bit Windows 7, and NullPointerException did not appear.
Comment 17 David Konecny 2012-10-08 22:50:42 UTC
(In reply to comment #2)
> Reproduceable in 7.2 patch 1 candidate.

Tomas, do you know how to reproduce this problem?
Comment 18 David Konecny 2012-10-08 22:58:36 UTC
I had a look at the code but have no idea when this problem could happen. It does not make much sense. I would fix it the way you suggested Marek, maybe log a warning/info into the log and we will see. If we just preventing some other problem then sooner or later users will tell us about it, eg. "there is no NPE anymore but code completion does show ...." type of feedback.
Comment 19 Marian Mirilovic 2012-10-09 13:25:28 UTC
(In reply to comment #18)
> I had a look at the code but have no idea when this problem could happen. It
> does not make much sense. I would fix it the way you suggested Marek, maybe log
> a warning/info into the log and we will see. If we just preventing some other
> problem then sooner or later users will tell us about it, eg. "there is no NPE
> anymore but code completion does show ...." type of feedback.

Ok Davide, could you please do that before 24:00 Oct/9 in a releases branch ? Thanks in advance.
Comment 20 David Konecny 2012-10-09 14:03:28 UTC
(In reply to comment #19)
> Ok Davide, could you please do that before 24:00 Oct/9 in a releases branch ?
> Thanks in advance.

Marek, are you going to fix this today or should I do it?
Comment 21 David Konecny 2012-10-09 21:58:35 UTC
I tried to hotfix it. Please review. Because of typing I'm putting it straight into release72 branch.

web-main#07cdf5ff129c

changeset:   243065:16c5c1d8fe40
branch:      release72
user:        David Konecny <dkonecny@netbeans.org>
date:        Tue Oct 09 14:45:59 2012 -0700
summary:     changeset: 235198:07cdf5ff129c
Comment 22 David Konecny 2012-10-09 22:01:57 UTC
"timing" ... not "typing"
Comment 23 Marek Fukala 2012-10-10 07:11:40 UTC
thanks Davide, the hotfix is ok.
Comment 24 Quality Engineering 2012-10-10 14:18:48 UTC
Integrated into 'releases', will be available in build *201210100934* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/16c5c1d8fe40
User: David Konecny <dkonecny@netbeans.org>
Log: changeset: 235198:07cdf5ff129c
user: David Konecny <dkonecny@netbeans.org>
date: Tue Oct 09 14:41:46 2012 -0700
files: web.jsf.editor/src/org/netbeans/modules/web/jsf/editor/JsfSupportImpl.java
description:

#217213 - NullPointerException at org.netbeans.modules.web.jsf.editor.JsfSupportImpl.<init>
Comment 25 Quality Engineering 2012-10-11 02:02:32 UTC
Integrated into 'main-golden', will be available in build *201210110002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/07cdf5ff129c
User: David Konecny <dkonecny@netbeans.org>
Log: #217213 - NullPointerException at org.netbeans.modules.web.jsf.editor.JsfSupportImpl.<init>
Comment 26 Vladimir Riha 2012-10-11 11:45:28 UTC
I can't reproduce it following steps from comment #4, once I removed web directory, warning dialog about its missing is popping up and I can't finish New File dialog. I tried to create the xhtml JSF page externally and just open it in IDE and code completion did not throw this exception

So carefully verifying in patch...

Product Version: NetBeans IDE 7.2.1 (Build 201210100934)
Java: 1.7.0_07; Java HotSpot(TM) Client VM 23.3-b01
System: Linux version 3.2.0-31-generic-pae running on i386; UTF-8; en_US (nb)
Comment 27 Martin Fousek 2012-10-12 12:51:23 UTC
*** Bug 218538 has been marked as a duplicate of this bug. ***