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 129972 - NPE during Find Usages
Summary: NPE during Find Usages
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 5.x
Hardware: Sun All
: P2 blocker (vote)
Assignee: Jan Becicka
URL:
Keywords: REGRESSION
: 129906 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-03-12 23:23 UTC by _ pcw
Modified: 2008-03-18 09:05 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NPE stack trace (1.09 KB, text/plain)
2008-03-12 23:24 UTC, _ pcw
Details
Proposed fix (5.18 KB, patch)
2008-03-14 18:29 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description _ pcw 2008-03-12 23:23:32 UTC
Latest NB 6.1 builds ~ March 12.  <Find Usages> for a method in an NBM project when the caller of the method is in an
unopened project.

Gave NPE (attached).
Comment 1 _ pcw 2008-03-12 23:24:07 UTC
Created attachment 58276 [details]
NPE stack trace
Comment 2 _ pcw 2008-03-12 23:25:39 UTC
Marked regression because this was supposedly fixed in 6.0.  See issue 120041.
Comment 3 Jan Becicka 2008-03-13 11:19:55 UTC
It must be very recent regression, or it is not that easy to reproduce.
Can you provide steps by step instructions?
Find Usages should work only with open projects.
Comment 4 _ pcw 2008-03-13 18:37:41 UTC
The symbol was only referenced from j2eeserver module, which was not open.  Instead of informing me there were no
references, I got the NPE.  I can try it with a new userdir in case there is cache corruption (different problem?)

FWIW, when I manually opened j2eeserver later in the session, and did the same FindUsages attempt, it worked and I got
the results I wanted.
Comment 5 _ pcw 2008-03-14 00:03:00 UTC
Now it shows this exception on the console (nothing visible in IDE):

SEVERE [org.openide.util.RequestProcessor]
java.lang.IllegalArgumentException: Cannot pass null as an argument of the SourceUtils.getFile
        at org.netbeans.api.java.source.SourceUtils.getFile(SourceUtils.java:354)
        at org.netbeans.modules.refactoring.java.RetoucheUtils$CompilerTask.run(RetoucheUtils.java:808)
        at org.netbeans.modules.refactoring.java.RetoucheUtils$CompilerTask.run(RetoucheUtils.java:774)
        at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:665)
        at org.netbeans.modules.refactoring.java.RetoucheUtils.getFileObject(RetoucheUtils.java:543)
        at org.netbeans.modules.refactoring.java.RetoucheUtils.getClasspathInfoFor(RetoucheUtils.java:635)
        at org.netbeans.modules.refactoring.java.ui.WhereUsedQueryUI.setParameters(WhereUsedQueryUI.java:130)
        at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$Prepare.run(ParametersPanel.java:749)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)

This is with latest sources, clean build, clean userdir.

Steps:

1. Open contrib/j2ee.hk2 (maybe also contrib/glassfish.[common, jruby, javaee], I had them open, but they are not related.)
2. Open the java file [SP] / org.netbeans.modules.j2ee.hk2.ide / FastDeploy.java
3. Scroll to line ~109 - "public ProgressObject incrementalDeploy(TargetModuleID targetModuleID, AppChangeDescriptor
appChangeDescriptor)"
4. Right click the method <incrementalDeploy> and perform <Find Usages>, default options (search open projects, search
from base, etc.)
5. In a 3/13 build, it will show the aforementioned IAEx on the console and correctly show no hits in the output.
6. If you open the "j2eeserver" project, there are no problems, because that's where the caller of this method is.
Comment 6 Jan Becicka 2008-03-14 10:27:40 UTC
Hm. It works for me. I have build from 8/3.
One usage found in TargetServer.java. Is it correct?
Jirko, can you reproduce it?
Comment 7 Jiri Prox 2008-03-14 11:00:36 UTC
Product Version: NetBeans IDE Dev (Build 20080313092248)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.22-14-generic running on i386; UTF-8; en_US (nb)

I've got the original exception (MPE) if the j2eeserver module was not opened. If it was opened one usage in class
TargetServer was found
Comment 8 Jan Becicka 2008-03-14 11:14:45 UTC
OK. Trying to pull/checkout/build/test again.
BTW issue 129906 is probably duplicate of this one.
Comment 9 Jan Becicka 2008-03-14 12:18:57 UTC
I did update and now I'm able to reproduce it. Probably very recent regression.
Comment 10 Jan Becicka 2008-03-14 17:43:50 UTC
*** Issue 129906 has been marked as a duplicate of this issue. ***
Comment 11 Tomas Zezula 2008-03-14 18:24:54 UTC
It's caused by unknown source root on the source path, the IDE ignored whole source path when it contained unknown source to prevent parsing and OOM.
I suggest to ignore just the unknown root instead of the whole source path.
Here comes the suggested diff
Comment 12 Tomas Zezula 2008-03-14 18:29:45 UTC
Created attachment 58406 [details]
Proposed fix
Comment 13 Jan Becicka 2008-03-18 09:05:39 UTC
Fixed thanks to tzezula. ba2901ab6fb6