Bug 121006 - NullPointerException at org.netbeans.modules.search.FindInFilesAction$LookupSensitive$1.run
NullPointerException at org.netbeans.modules.search.FindInFilesAction$LookupS...
Status: RESOLVED FIXED
Product: utilities
Classification: Unclassified
Component: Search
6.x
All All
: P3 (vote)
: 6.x
Assigned To: Marian Petras
issues@utilities
http://statistics.netbeans.org/except...
EXCEPTIONS_REPORT
: RANDOM, REGRESSION, THREAD
Depends on:
Blocks: 106082
  Show dependency treegraph
 
Reported: 2007-11-02 17:44 UTC by Jesse Glick
Modified: 2007-12-07 16:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (705 bytes, text/plain)
2007-11-02 17:44 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2007-11-02 17:44:02 UTC
Build: NetBeans IDE Dev (Build 071102)
VM: Java HotSpot(TM) Client VM, 1.5.0_12-b04
OS: Linux, 2.6.22-14-generic, i386

User Comments: 
Just closed a couple of projects.
Comment 1 Jesse Glick 2007-11-02 17:44:11 UTC
Created attachment 52399 [details]
stacktrace
Comment 2 Jesse Glick 2007-11-02 17:56:08 UTC
Looks like a race condition introduced by fix of issue #106082.

I would recommend simplifying code:

private final PropertyChangeSupport support;
LS(...) {
  // ...
  support = new PropertyChangeSupport(this);
  searchScopeRegistry.addChangeListener(WeakListeners.change(this, searchScopeRegistry));
  enabled = searchScopeRegistry.hasApplicableSearchScope();
}
void addPCL(l) {
  support.addPCL(l);
}
void removePCL(l) {
  support.removePCL(l);
}

Besides the race condition, the current code looks like it could be a memory leak anyway, if FIFA.LS.rPCL is never
called for whatever reason.
Comment 3 Marian Petras 2007-11-05 07:24:46 UTC
I will try to fix this for NB 6.0.
Comment 4 Marian Petras 2007-11-14 17:10:19 UTC
Fixed in the trunk.

I did not do the suggested changes because:
a) field 'support' is also used as an indication whether there is some listener registered
b) I am sure FIFA.LS.rPCL is called - the NullPointerException would never be thrown if it was not called

The change I made just changes the code such that when stateChanged() is called, the list of currently registered
listeners is stored and this list is later used for actual notification. This guarantees that the NullPointerException
is never called and that the correct list of listeners is called.

Modified file:
    utilities/src/org/netbeans/modules/search/FindInFilesAction.java   (1.9)

Diff:
http://deadlock.netbeans.org/fisheye/browse/netbeans/utilities/src/org/netbeans/modules/search/FindInFilesAction.java?r1=1.8&r2=1.9


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo