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 82336 - Branding out FindAction from toolbar causes exception in FindActionManager
Summary: Branding out FindAction from toolbar causes exception in FindActionManager
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Search (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Marian Petras
URL:
Keywords:
: 91429 96369 99566 100046 117628 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-10 02:19 UTC by phamernik
Modified: 2007-10-05 16:04 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exception (1.23 KB, text/plain)
2006-08-10 02:20 UTC, phamernik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description phamernik 2006-08-10 02:19:12 UTC
I branded out FindAction from toolbar and menu. It caused AssertionError in
FindActionManager.getFindActionMapKey() method. It looks that the action
instance is not created when method is called, because nobody requests it.

The fix seems to be trivial:
If you really need the instance, then please call
SharedClassObject.findObject(FindAction.class, true) instead of single param
version of this method (create=true). 
Or if you don't need it then do not test null using assert.

Current code causes an exception immediately after our application start.
As workaround I must call SharedClassObject.findObject(FindAction.class, true) 
somewhere in my code before FindActionManager is called.
Comment 1 phamernik 2006-08-10 02:20:21 UTC
Created attachment 32731 [details]
Exception
Comment 2 emlope 2006-09-01 19:23:08 UTC
I got the same exception. Can you give me some guidance as to where to put the 
workaround code? I figured that I could do it in a ModuleInstall class (I 
tried in the constructor, restored and initialize methods), but that didn't 
work, I still get one exception. Any suggestions?
Comment 3 phamernik 2006-09-03 21:02:28 UTC
Put it to static block of your module installer class. Then it is called when
class is loaded. You also need to hold this reference, otherwise it can be
"garbage collected" immediately.

<code>
public class MyModule extends ModuleInstall {
    private static final FindAction FIND_ACTION_HOOK;
    static {
        FIND_ACTION_HOOK = (FindAction)
SharedClassObject.findObject(FindAction.class, true);
    }
}
</code>
Comment 4 Jiri Prox 2007-01-03 08:53:19 UTC
*** Issue 91429 has been marked as a duplicate of this issue. ***
Comment 5 Marian Petras 2007-01-12 16:41:20 UTC
Accepted.
Comment 6 Marian Petras 2007-03-23 14:55:48 UTC
*** Issue 96369 has been marked as a duplicate of this issue. ***
Comment 7 Jiri Prox 2007-04-02 16:46:16 UTC
*** Issue 99566 has been marked as a duplicate of this issue. ***
Comment 8 Marian Petras 2007-04-05 09:54:19 UTC
*** Issue 100046 has been marked as a duplicate of this issue. ***
Comment 9 phamernik 2007-04-05 11:27:13 UTC
Is anyone responsible for this module?
Marian, according to your comment you started to work on this in January/12?

IMHO fixing this bug would take <2 minutes. I proposed two options of bugfix 3/4
year ago and both are trivial. I guess fixing it would be less time than reading
new and new bugs and marking them as duplicate of this one...
Comment 10 Marian Petras 2007-06-12 15:54:39 UTC
Fixed in the trunk.

Modified file:
   utilities/src/org/netbeans/modules/search/FindActionManager.java   (1.14)

Diff:
http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/FindActionManager.java?r1=1.12&r2=1.14&diff_format=u
Comment 11 Marian Petras 2007-10-05 16:04:43 UTC
*** Issue 117628 has been marked as a duplicate of this issue. ***