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.
P2 because it is a regression that can cause exceptions to be thrown by module code which worked before. I think rev. 1.60 of Actions.java caused a problem: ---%<--- revision 1.60 date: 2002/05/14 10:15:53; author: pnejedly; state: Exp; lines: +20 -11 Fix for #21197. Not optimal because it assumes the multi-action will perform the first subaction on accelerator stroke. ---%<--- [...other stuff then:] + boolean useAccel() { + return subModel.getCount() <= 1; + } ---%<--- The following stack trace seems to be triggered by it: ---%<--- java.lang.NullPointerException at wfedit.actions.WFLocalAction$ActSubMenuModel.getCount(WFLocalAction.java:106 ) at org.openide.awt.Actions$SubMenu.useAccel(Actions.java:1021) at org.openide.awt.Actions.updateKey(Actions.java:744) at org.openide.awt.Actions$MenuBridge.updateState(Actions.java:512) at org.openide.awt.Actions$SubMenu.<init>(Actions.java:949) at wfedit.actions.WFLocalAction$SpecialSubMenu.<init>(WFLocalAction.java:83) at wfedit.actions.WFLocalAction.getMenuPresenter(WFLocalAction.java:58) at org.openide.awt.MenuBar$LazyMenu$MenuFolder.createInstance(MenuBar.java:403) ---%<--- from a submenu action created according to the standard template, i.e.: ---%<--- // ... private static final class SpecialSubMenu extends Actions.SubMenu { // ... public void addNotify() { model.addNotify(); super.addNotify(); } } private static final class ActSubMenuModel implements Actions.SubMenuModel { private List displayNames; // List<String> private List associatedInfo; // List<Object> public int getCount() { return displayNames.size(); } // ... } ---%<--- I have this seen same problem as well. The regression appears to be this: that useAccel() should not be called until addNotify() has been called on the submenu. Otherwise it is too early to know whether it should use an accelerator or not, since that depends on information from the model, which should not be computed until the menu is really displayed. Workaround: replace public int getCount() { return displayNames.size(); } with public int getCount() { return displayNames != null ? displayNames.size() : 0; } I could update the apisupport template to use this workaround, but it would be nicer to just get the bug fixed so there is no regression.
addNotify, as proven over the time, is generally quite bad place for lazy initialization but the Swing gives us no better alternative. I had to split the initialization and place only part of it to the addNotify to fulfill this request while keeping Swing happy (I had layout problems otherwise)
Hi Petr and Jesse (not sure who did the commit), where're the .diff-s ?!!! I'd like to get this bug fixed in 3.4.1, but how can I apply a nothing to the code ;-) Sincerely yours, Maxym Mykhalchuk, Netbeans 3.4.1 "Merak" Release Coordinator
Petr, is a diff available for this fix? I have no idea how you fixed it or when.
BTW it is easy to reproduce in current 3.4.1 builds: - download apisupport-2.10.2.nbm from apisupport.netbeans.org - install - open Tools menu - NPE thrown many times
Hi. This issue is marked as 3.4.1_CANDIDATE. It means that it should be integrated into release341 one branch. The plan at http://www.netbeans.org/devhome/docs/releases/34/index.html expected beta1 to be produced on Dec01. That did not happen due to a lot of outstanding not integrated candidates like this one. Would it be possible to spend few minutes by backporting this fix? Thank you in advance.
Petr is on vacation, I guess, and no one seems to know where the diff is.
OK, this won't go into 3.4.1 :-( What a shame, Petr ;-)
fixed long time ago..... ...verified.... if it happens again reopen please