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 49867 - Occasional NPEs from UsageFinder
Summary: Occasional NPEs from UsageFinder
Status: RESOLVED WORKSFORME
Alias: None
Product: contrib
Classification: Unclassified
Component: Code (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: _ tboudreau
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-04 05:54 UTC by _ tboudreau
Modified: 2004-11-19 07:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2004-10-04 05:54:09 UTC
As Martin suggested, I'm using UsageFinder over only the 
currently open class to locate callers of whatever method the 
caret is in and highlight them.

Once in a while, when this code runs in a background thread, I 
will see the following NPE.  AFAIK the values being passed are 
valid - not sure what the trigger is.

java.lang.NullPointerException
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.i
sMatch(UsageFinder.java:200)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.
getUsers(UsageFinder.java:157)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.
getUsers(UsageFinder.java:160)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.
getUsers(UsageFinder.java:160)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.
getUsers(UsageFinder.java:160)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.
getUsers(UsageFinder.java:160)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.
getUsers(UsageFinder.java:160)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.
getUsers(UsageFinder.java:160)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.
getUsers(UsageFinder.java:142)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder.a
ccess$200(UsageFinder.java:34)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder$
LazyIterator.findNext(UsageFinder.java:285)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder$
LazyIterator.hasNext(UsageFinder.java:309)
        at 
org.netbeans.modules.javacore.jmiimpl.javamodel.UsageFinder$
LazyCollection.size(UsageFinder.java:223)
        at 
java.util.AbstractCollection.isEmpty(AbstractCollection.java:77)
        at 
org.netbeans.modules.javagator.Hacks.extractClassMembers(Ha
cks.java:206)
[catch] at 
org.netbeans.modules.javagator.Hacks.findUsagesOfElement(Ha
cks.java:182)
        at 
org.netbeans.modules.javagator.ClassMemberRelatedItemProvid
er.collectRelatedItems(ClassMemberRelatedItemProvider.java:62)
        at 
org.netbeans.spi.navigator.RelatedItemProviderSupport$Updater
.run(RelatedItemProviderSupport.java:253)
        at org.openide.util.Task.run(Task.java:136)
        at 
org.openide.util.RequestProcessor$Task.run(RequestProcessor.ja
va:330)
        at 
org.openide.util.RequestProcessor$Processor.run(RequestProces
sor.java:686)
Comment 1 Jan Becicka 2004-10-21 12:34:46 UTC
I'm not sure what is null, but it looks like
method.getDeclaringClass() returned null. Can you reproduce it?
Comment 2 _ tboudreau 2004-10-21 16:24:29 UTC
It was happening very regularly, though it's tough to determine exactly what triggers it.

Try building a copy of Navigator:
cd contrib/navigator
ant rebuild-modules

and just run with it enabled for a while.  Eventually, when you are editing something, you 
will start to see thousands of exceptions scroll up the console - that is it.
Comment 3 Jan Becicka 2004-10-22 12:27:16 UTC
I'm not able to reproduce it. I'm getting lots of Illegal State
Exceptions and NPEs from ui.nodes.BridgeUtils, which is called by
javagator.actions.OpenAction. But no NPE from UsageFinder
Comment 4 Jan Becicka 2004-10-29 08:33:53 UTC
Tim, is this bug still reproducible?
Comment 5 _ tboudreau 2004-10-29 13:12:41 UTC
As you probably know, I'm in the middle of packing to move to California, so I won't be 
able to look at much of anything for a few weeks.  I think it was still reproducible on the 
1017 build, but I'm not sure.

I recommend you run Navigator/Javagator yourself (it's useful and fun!!!  You'll love it!  
You won't be able to live without it!!) - if you hit this bug, believe me, you'll know it.

Sorry I can't be more help right now.  I should be more settled in mid-late November.
Comment 6 Jan Becicka 2004-11-03 14:54:01 UTC
I'm sorry I cannot reproduce it. I tried to use Navigator, but it
looks like it does not work at all now. No Exceptions, No Warnings -
just empty Navigator.

NPE was probably caused by incorrect usage of UsageFinder.

Tim, please attach fresh stack trace. Thanks.
Comment 7 _ tboudreau 2004-11-03 17:01:28 UTC
You have to have javagator installed as well.  Navigator is just the view; javagator provides 
a model over java sources.
Comment 8 Jan Becicka 2004-11-04 06:11:36 UTC
Oops I didn't have javagator.

Anyway I'm having it now and I'm getting various ClassCast and
IllegalState Exceptions, but no NPE from UsageFinder.
Comment 9 _ tboudreau 2004-11-19 07:09:07 UTC
Haven't seen this problem in a while either.