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 153859 - NbBuildPopupMenuAction throws exception if no PopupMenuActionsProvider present
Summary: NbBuildPopupMenuAction throws exception if no PopupMenuActionsProvider present
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-25 13:54 UTC by emi
Modified: 2012-10-30 02:33 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch which creates a new Array when an empty list is returned to avoid adding to Collections.emptyList() (1.12 KB, patch)
2008-11-25 13:57 UTC, emi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description emi 2008-11-25 13:54:37 UTC
Hy,

NbBuildPopupMenuAction uses the List returned from PopupMenuActionsProvider.getPopupMenuItems() to add some more data if
the list is empty.

The error is that PopupMenuActionsProvider.getPopupMenuItems() might also return Collections.emptyList(), which doesn't
allow add() so we get an Exception.

Attaching a patch which fixes this.
Comment 1 emi 2008-11-25 13:57:15 UTC
Created attachment 74135 [details]
Patch which creates a new Array when an empty list is returned to avoid adding to Collections.emptyList()
Comment 2 David Strupl 2012-10-25 13:39:12 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 3 David Strupl 2012-10-26 13:34:46 UTC
I don't think that returning unmodifiable list is any problem. Closing as wontfix.
Comment 4 emi 2012-10-26 13:54:55 UTC
Nor was returning an unmodifiable list the problem.

The problem is calling List.add on an unmodifiable list. To prevent that I instantiate a new ArrayList.
Comment 5 emi 2012-10-26 13:57:01 UTC
If you want I can review this again (it's quite old but seems ok) and commit it myself on jet-main.
Comment 6 Miloslav Metelka 2012-10-28 22:33:47 UTC
I guess the code was not touched and the fastest solution will be to just fix it. Thanks anyway.
http://hg.netbeans.org/jet-main/rev/22825c490d22
Comment 7 Quality Engineering 2012-10-30 02:33:17 UTC
Integrated into 'main-golden', will be available in build *201210300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/22825c490d22
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #153859 - NbBuildPopupMenuAction throws exception if no PopupMenuActionsProvider present.