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 156889 - NullPointerException at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run
Summary: NullPointerException at org.netbeans.modules.j2ee.ejbverification.EJBProblemF...
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: issues@javaee
URL: http://statistics.netbeans.org/except...
Keywords:
: 161273 (view as bug list)
Depends on: 168235
Blocks:
  Show dependency tree
 
Reported: 2009-01-15 13:58 UTC by Jiri Prox
Modified: 2009-07-17 13:38 UTC (History)
22 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 145225


Attachments
stacktrace (939 bytes, text/plain)
2009-01-15 13:58 UTC, Jiri Prox
Details
stacktrace (939 bytes, text/plain)
2009-01-20 13:00 UTC, Peter Pis
Details
stacktrace (939 bytes, text/plain)
2009-01-21 20:49 UTC, Petr Dvorak
Details
stacktrace (939 bytes, text/plain)
2009-01-27 07:39 UTC, kawazu428
Details
stacktrace (939 bytes, text/plain)
2009-01-27 09:42 UTC, Jan Lahoda
Details
stacktrace (939 bytes, text/plain)
2009-01-28 13:17 UTC, Jiri Prox
Details
stacktrace (939 bytes, text/plain)
2009-01-28 19:04 UTC, athompson
Details
stacktrace (939 bytes, text/plain)
2009-01-28 19:12 UTC, athompson
Details
stacktrace (939 bytes, text/plain)
2009-02-01 21:02 UTC, Lukas Jungmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2009-01-15 13:58:00 UTC
Build: NetBeans IDE Dev (Build 20090115032805)
VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03
OS: Linux, 2.6.24-23-generic, i386

User Comments:
jiriprox: NPE whne pressing Step Into during debugging Netbeams test



Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
Comment 1 Jiri Prox 2009-01-15 13:58:05 UTC
Created attachment 75857 [details]
stacktrace
Comment 2 Peter Pis 2009-01-20 13:00:40 UTC
Build: NetBeans IDE Dev (Build 200901190201)
VM: Java HotSpot(TM) Client VM, 1.5.0_16-133, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_16-b06-284
OS: Mac OS X, 10.5.5, i386

User Comments: 
NPE while opening file from Favorites view. 

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
Comment 3 Peter Pis 2009-01-20 13:00:49 UTC
Created attachment 76041 [details]
stacktrace
Comment 4 Petr Dvorak 2009-01-21 20:49:08 UTC
Build: NetBeans IDE Dev (Build 200901210201)
VM: Java HotSpot(TM) Client VM, 11.0-b13, Java(TM) SE Runtime Environment, 1.6.0_10-rc-b26
OS: Linux, 2.6.27-11-generic, i386

User Comments: 
I pressed Ctrl+Space above the "ExecutorService", suddenly I navigated to source of file ExecutorService and this exception was thrown.

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
Comment 5 Petr Dvorak 2009-01-21 20:49:12 UTC
Created attachment 76118 [details]
stacktrace
Comment 6 Exceptions Reporter 2009-01-23 12:26:59 UTC
This issue has already 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=145225
Comment 7 kawazu428 2009-01-27 07:39:22 UTC
Build: NetBeans IDE Dev (Build 200901250201)
VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03
OS: Linux, 2.6.27-11-generic, i386

User Comments: 
switched to a project group containing maven2 ejb artifacts

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
Comment 8 kawazu428 2009-01-27 07:39:26 UTC
Created attachment 76259 [details]
stacktrace
Comment 9 Jan Lahoda 2009-01-27 09:42:25 UTC
Build: NetBeans IDE Dev (Build 090123)
VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03
OS: Linux, 2.6.24-19-generic, i386

User Comments: 
Opening j.u.Map from the src.zip.

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
Comment 10 Jan Lahoda 2009-01-27 09:42:35 UTC
Created attachment 76261 [details]
stacktrace
Comment 11 Jiri Prox 2009-01-28 13:17:10 UTC
Build: NetBeans IDE Dev (Build 20090126095307)
VM: Java HotSpot(TM) Client VM, 11.0-b16, Java(TM) SE Runtime Environment, 1.6.0_11-b03
OS: Linux, 2.6.24-23-generic, i386

User Comments: 


Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
Comment 12 Jiri Prox 2009-01-28 13:17:20 UTC
Created attachment 76303 [details]
stacktrace
Comment 13 athompson 2009-01-28 19:04:03 UTC
Build: NetBeans IDE Dev (Build 200901280348)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Linux, 2.6.27-11-generic, i386

User Comments: 
opening the source for a jar in the editor

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
Comment 14 athompson 2009-01-28 19:04:16 UTC
Created attachment 76320 [details]
stacktrace
Comment 15 athompson 2009-01-28 19:12:10 UTC
Build: NetBeans IDE Dev (Build 200901280348)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Linux, 2.6.27-11-generic, i386

User Comments: 
setting formatting options

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
Comment 16 athompson 2009-01-28 19:12:21 UTC
Created attachment 76321 [details]
stacktrace
Comment 17 Lukas Jungmann 2009-02-01 21:02:31 UTC
Build: NetBeans IDE Dev (Build 20090201144329)
VM: Java HotSpot(TM) Server VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-b33
OS: Windows Vista, 6.0, x86

User Comments: 
selecting text by mouse in Base part of Diff view on a mercurial versioned file

Stacktrace: 
java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:106)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:192)
        at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:690)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
Comment 18 Lukas Jungmann 2009-02-01 21:02:41 UTC
Created attachment 76432 [details]
stacktrace
Comment 19 mslama 2009-02-04 19:17:14 UTC
It looks it happens when there is compile error in java file which is not in any project.
Comment 20 mslama 2009-02-04 19:41:35 UTC
core-main #6dbb6add70c8
Comment 21 Quality Engineering 2009-02-05 08:46:37 UTC
Integrated into 'main-golden', will be available in build *200902050256* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/6dbb6add70c8
User: Marek Slama <mslama@netbeans.org>
Log: #156889: Add check for null.
Comment 22 Jesse Glick 2009-03-04 23:32:57 UTC
I think this is still broken. Testing autoproject on ant-dev using enterprise cluster from fc4e5962809d, I get:

java.lang.NullPointerException
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:111)
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder$ProblemFinderCompInfo.run(EJBProblemFinder.java:196)
[catch] at org.netbeans.modules.java.source.JavaSourceAccessor$CancelableTaskWrapper.run(JavaSourceAccessor.java:288)
        at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:679)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
Comment 23 Petr Jiricka 2009-03-05 08:11:53 UTC
Ok, reopening.
Comment 24 Petr Jiricka 2009-03-18 14:47:08 UTC
Hopefully fixed now, plus some more logging added:
http://hg.netbeans.org/web-main/rev/a82ac40101bc
Comment 25 Quality Engineering 2009-03-19 20:36:01 UTC
Integrated into 'main-golden', will be available in build *200903191401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/a82ac40101bc
User: pjiricka@netbeans.org
Log: Trying to fix issue #156889 plus more diagnostic logging.
Comment 26 Petr Jiricka 2009-03-27 15:40:52 UTC
*** Issue 161273 has been marked as a duplicate of this issue. ***
Comment 27 Jesse Glick 2009-06-29 19:04:39 UTC
It is not fixed, just changed form:

java.lang.NullPointerException: null J2eeModule from org.netbeans.modules.autoproject.web.WebModuleProviderImpl@6abc19
        at org.netbeans.modules.j2ee.ejbverification.EJBProblemFinder.run(EJBProblemFinder.java:115) 

(Still being reported in 6.7 RC1 so not sure why exception reporter did not automatically reopen it?)

Still thrown when using autoproject, on a non-Java EE-related project. The problem is that
autoproject.web.WebModuleProviderImpl must return null from getJ2eeModule, the way it does from findWebModule, when it
cannot in fact find any information about Java EE modules. WebModuleProvider.findWebModule is already documented to
permit a null return value; J2eeModuleProvider.getJ2eeModule should be changed to explicitly permit a null return as
well (there is no reasonable non-null value to return), and callers should be reviewed to make sure they react gracefully.

I presume EJBProblemFinder could simply delete the throw of the NPE, so that !isEjb and the task would be skipped.
Suggest at least this be put into a 6.7 update:

diff --git a/j2ee.ejbverification/src/org/netbeans/modules/j2ee/ejbverification/EJBProblemFinder.java
b/j2ee.ejbverification/src/org/netbeans/modules/j2ee/ejbverification/EJBProblemFinder.java
--- a/j2ee.ejbverification/src/org/netbeans/modules/j2ee/ejbverification/EJBProblemFinder.java
+++ b/j2ee.ejbverification/src/org/netbeans/modules/j2ee/ejbverification/EJBProblemFinder.java
@@ -109,12 +109,8 @@
             }
             J2eeModuleProvider provider = (J2eeModuleProvider) prj.getLookup().lookup(J2eeModuleProvider.class);
             if (provider != null) {
-                // logging for #156889
                 J2eeModule module = provider.getJ2eeModule();
-                if (module == null) {
-                    NullPointerException npe = new NullPointerException("null J2eeModule from " + provider);
-                    LOG.log(Level.WARNING, npe.getMessage(), npe);
-                } else {
+                if (module != null) {
                     if (J2eeModule.Type.EJB.equals(module.getType())) {
                         isEjb = true;
                     }
Comment 28 David Konecny 2009-07-01 02:21:12 UTC
Simplified as Jesse suggested: 2f360a8cb797.
Comment 29 Martin Schovanek 2009-07-02 10:50:09 UTC
v.
Comment 30 Quality Engineering 2009-07-02 17:29:17 UTC
Integrated into 'main-golden', will be available in build *200907021400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2f360a8cb797
User: David Konecny <dkonecny@netbeans.org>
Log: #156889 - avoid NPE from EJBProblemFinder.run
Comment 31 pgebauer 2009-07-03 17:33:08 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/043a2641a623
Comment 32 Jesse Glick 2009-07-06 18:33:58 UTC
Javadoc of getJ2eeModule should still be updated, and existing callers still need to be reviewed for null handling.
David do you plan to do these things, or do I need to reopen or file a blocking issue?
Comment 33 David Konecny 2009-07-06 22:57:58 UTC
Re. "Javadoc of getJ2eeModule should still be updated" - thanks for reminder Jesse. I looked at the usages of
J2eeModuleProvider.getJ2eeModule() and out of 76 occurrences at least half assumes that value cannot be null. Hard to
say what original intentions of J2eeModuleProvider.getJ2eeModule were as there is no Javadoc. I wonder whether it
actually would be better to say in Javadoc that non-null value has to be returned. And looking at
autoproject.web.WebModuleProviderImpl I wonder why I wrote it that way. :-) I don't see any reason why J2eeModule could
not be created for null docRoot. If you agree that's what I would do.
Comment 34 Jesse Glick 2009-07-06 23:19:44 UTC
It seems to me that the J2eeModule object implies that there is actually a Java EE module, which there may not be. As
mentioned before, findWebModule returns null when there is no Java EE web module, so it is getJ2eeModule which is
inconsistent.

Another option would be to dynamically insert or remove J2eeModuleProvider from project lookup, though I generally do
not recommend changing project lookups dynamically in this way.
Comment 35 David Konecny 2009-07-06 23:51:09 UTC
Re. "WebModule" - or we could fix AutoProject to always return an instance of WebModule. Looking at WM API most of the
methods are documented they can return null which would work well in AutoProject case. I think in order to get something
working in AP you must have J2eeModule and WebModule for project, but these impls can return null for most of the methods.
Comment 36 Jesse Glick 2009-07-07 16:08:13 UTC
OK, you would know best. I have always found it odd that these services do not return List<WebModule> etc. (what if you
have a big project with multiple Java EE components in it?), but perhaps there is some reason for this.
Comment 37 David Konecny 2009-07-08 00:01:23 UTC
Re. "you would know best" - I wish I did. The code is old, not very well documented, during the time it got less strict
and more flexible then originally designed (to cater for various edge cases and configuration scenarios) and because
there were no changes required in last two years I've just let it sit around and more or less ignored it.

Do you want me to fix AutoProjs the way I suggested? That should be quick. I cannot guarantee there will not be new
issues though.
Comment 38 Jesse Glick 2009-07-08 00:10:55 UTC
If you think you can change autoproject.web to create a no-op J2eeModule then go ahead.
Comment 39 David Konecny 2009-07-13 11:13:35 UTC
*** Issue 168235 has been marked as a duplicate of this issue. ***
Comment 40 Jindrich Sedek 2009-07-17 13:38:07 UTC
verified in 6.7.1 build
NetBeans IDE 6.7.1 RC (Build 200907162301)